Repository navigation
[RFC][expo-image] drop-in replacement for <Image /> from react-native #14351
bbarthec
started this conversation in
Proposals and Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Why
expo-imageis intended to be robust, versatile and performant module providing the core component -<Image />that would replace the component provided byreact-nativepackage.In order to make the transition to our module as simple as possible we need to provide the very same API as the original one, additionally adding support for Web. Ideally we would ship the exactly same API with no differences from the original one on mobile platforms.
Background
Currently we have a solid base for mobile platforms -
Glidefor Android andSDWebImagefor iOS (the very same libraries used in popularreact-native-fast-image). Web fallbacks to use the component coming fromreact-nativepackage.API comparison
react-native Imageexpo-imagefor iOSexpo-imagefor Androidexpo-imagefor Web<View />propsonStartShouldSetResponder?: (event: Event) => booleanaccessibilityHint?: stringaccessibilityRole?: AccessibilityRoleaccessibilityState?: AccessibilityStateaccessibilityValue?: AccessibilityValueaccessibilityActions?: AccessibilityAction[]onAccessibilityAction?: FunctiononAccessibilityTap?: FunctiononMagicTap?: Function(iOS only)onAccessibilityEscape?: Function(iOS only)accessibilityViewIsModal?: boolean(iOS only)accessibilityElementsHidden?: boolean(iOS only)accessibilityIgnoresInvertColors?: boolean(iOS only)accessibilityLiveRegion?: LiveRegion(Android only)importantForAccessibility?: AccessibilityImportance(Android only)hitSlop?: RectnativeID?: stringonMoveShouldSetResponder?: FunctiononMoveShouldSetResponderCapture?: FunctiononResponderGrant?: FunctiononResponderMove?: FunctiononResponderReject?: FunctiononResponderRelease?: FunctiononResponderTerminate?: FunctiononResponderTerminationRequest?: FunctiononStartShouldSetResponderCapture?: FunctionpointerEvents?: PointerEventsremoveClippedSubviews?: booleancollapsable?: boolean(Android only)needsOffscreenAlphaCompositing?: booleanrenderToHardwareTextureAndroid?: boolean(Android only)shouldRasterizeIOS?: boolean(iOS only)nextFocusDown?: number(Android only)nextFocusForward?: number(Android only)nextFocusLeft?: number(Android only)nextFocusRight?: number(Android only)nextFocusUp?: number(Android only)focusable?: boolean(Android only)<Image />propsaccessible?: booleanaccessibilityLabel?: stringblurRadius?: numbercapInsets?: Insets(iOS only)defaultSource?: ImageSourcefadeDuration?: number(Android only)loadingIndicatorSource?: ImageSourceonError?: ErrorCallbackonLayout?: LayoutCallbackonLoad?: LoadCallbackonLoadEnd?: () => voidonLoadStart?: () => voidonPartialLoad?: () => void(iOS only)onProgress?: ProgressCallbackprogressiveRenderingEnabled?: boolean(Android only)resizeMethod?: ResizeMethod(Android only)resizeMode?: ResizeModesource: ImageSourcetestID?: stringstyle?: Stylepropstyle.backfaceVisibility?: 'visible' | 'hidden'style.backgroundColor?: colorstyle.borderBottomLeftRadius?: numberstyle.borderBottomRightRadius?: numberstyle.borderColor?: colorstyle.borderRadius?: numberstyle.borderTopLeftRadius?: numberstyle.borderTopRightRadius?: numberstyle.borderWidth?: numberstyle.opacity?: numberstyle.overflow?: 'visible' | 'hidden'style.overlayColor?: string(Android only)style.resizeMode?: ResizeModestyle.tintColor?: colorstyle.alignContent?: Alignmentstyle.alignItems?: Alignmentstyle.alignSelf?: Alignmentstyle.aspectRatio?: numberstyle.borderBottomWidth?: numberstyle.borderEndWidth?: numberstyle.borderLeftWidth?: numberstyle.borderRightWidth?: numberstyle.borderStartWidth?: numberstyle.borderTopWidth?: numberstyle.borderWidth?: numberstyle.bottom?: number | stringstyle.direction?: Directionstyle.display?: Displaystyle.end?: number | stringstyle.flex?: numberstyle.flexBasis?: number | stringstyle.flexDirection?: Directionstyle.flexGrow?: numberstyle.flexShrink?: numberstyle.flexWrap?: Wrapstyle.height?: numberstyle.justifyContent?: Alignmentstyle.left?: numberstyle.margin?: number | stringstyle.marginBottom?: number | stringstyle.marginEnd?: number | stringstyle.marginHorizontal?: number | stringstyle.marginLeft?: number | stringstyle.marginRight?: number | stringstyle.marginStart?: number | stringstyle.marginTop?: number | stringstyle.marginVertical?: number | stringstyle.maxHeight?: number | stringstyle.maxWidth?: number | stringstyle.minHeight?: number | stringstyle.minWidth?: number | stringstyle.overflow?: Overflowstyle.padding?: number | stringstyle.paddingBottom?: number | stringstyle.paddingEnd?: number | stringstyle.paddingHorizontal?: number | stringstyle.paddingLeft?: number | stringstyle.paddingRight?: number | stringstyle.paddingStart?: number | stringstyle.paddingTop?: number | stringstyle.paddingVertical?: number | stringstyle.position?: Positionstyle.right?: number | stringstyle.start?: number | stringstyle.top?: number | stringstyle.width?: number | stringstyle.zIndex?: numberstyle.shadowColor?: colorstyle.shadowOffset?: Size(iOS only)style.shadowOpacity?: number(iOS only)style.shadowRadius?: number(iOS only)style.transform?: Transformstyle.transform.matrix?: number[]style.transform.perspective?: numberstyle.transform.rotate?: stringstyle.transform.rotateX?: stringstyle.transform.rotateY?: stringstyle.transform.rotateZ?: stringstyle.transform.scale?: numberstyle.transform.scaleX?: numberstyle.transform.scaleY?: numberstyle.transform.translateX?: numberstyle.transform.translateY?: numberstyle.transform.skewX?: numberstyle.transform.skewY?: number<Image />methodsabortPrefetch?(requestId: number): void(Android only)getSize(uri: string, success: Callback, failure?: Callback): anygetSizeWithHeaders(uri: string, headers: Record<string, string>, success: Callback, failure?: Callback): anyprefetch(url: string, callback: (requestId: number) => void): Promise<boolean>queryCache?(urls: string[]): Promise<Record<string, CacheType>>resolveAssetSource(source: ImageSource): AssetDescriptionAll reactions