mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
Unify defaultSource and defaultSrc ImageProp (#47710)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47710 There is Android code that supports remapping `defaultSrc` -> `defaultSource` for `ImageNativeComponent`. The docs reference this prop as `defaultSource`: https://reactnative.dev/docs/next/image#defaultsource It is not referenced as `defaultSrc` anywhere. Let's unify it as `defaultSource` across both platforms. Changelog: [Internal] Reviewed By: javache Differential Revision: D65819218 fbshipit-source-id: 0f468e2327ad07285a45e4c9f5e33d74da411c74
This commit is contained in:
parent
6f1cf004fa
commit
abeee154d5
@ -133,7 +133,6 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
|||||||
width: undefined,
|
width: undefined,
|
||||||
height: undefined,
|
height: undefined,
|
||||||
};
|
};
|
||||||
const defaultSource = resolveAssetSource(props.defaultSource);
|
|
||||||
const loadingIndicatorSource = resolveAssetSource(
|
const loadingIndicatorSource = resolveAssetSource(
|
||||||
props.loadingIndicatorSource,
|
props.loadingIndicatorSource,
|
||||||
);
|
);
|
||||||
@ -179,7 +178,6 @@ let BaseImage: AbstractImageAndroid = React.forwardRef(
|
|||||||
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found
|
||||||
* when making Flow check .android.js files. */
|
* when making Flow check .android.js files. */
|
||||||
headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
|
headers: (source?.[0]?.headers || source?.headers: ?{[string]: string}),
|
||||||
defaultSrc: defaultSource ? defaultSource.uri : null,
|
|
||||||
loadingIndicatorSrc: loadingIndicatorSource
|
loadingIndicatorSrc: loadingIndicatorSource
|
||||||
? loadingIndicatorSource.uri
|
? loadingIndicatorSource.uri
|
||||||
: null,
|
: null,
|
||||||
|
@ -82,6 +82,9 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|||||||
},
|
},
|
||||||
validAttributes: {
|
validAttributes: {
|
||||||
blurRadius: true,
|
blurRadius: true,
|
||||||
|
defaultSource: {
|
||||||
|
process: require('./resolveAssetSource'),
|
||||||
|
},
|
||||||
internal_analyticTag: true,
|
internal_analyticTag: true,
|
||||||
resizeMethod: true,
|
resizeMethod: true,
|
||||||
resizeMode: true,
|
resizeMode: true,
|
||||||
@ -100,7 +103,6 @@ export const __INTERNAL_VIEW_CONFIG: PartialViewConfig =
|
|||||||
borderRadius: true,
|
borderRadius: true,
|
||||||
headers: true,
|
headers: true,
|
||||||
shouldNotifyLoadEvents: true,
|
shouldNotifyLoadEvents: true,
|
||||||
defaultSrc: true,
|
|
||||||
overlayColor: {
|
overlayColor: {
|
||||||
process: require('../StyleSheet/processColor').default,
|
process: require('../StyleSheet/processColor').default,
|
||||||
},
|
},
|
||||||
|
@ -124,8 +124,7 @@ public constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// In JS this is Image.props.defaultSource
|
@ReactProp(name = "defaultSource")
|
||||||
@ReactProp(name = "defaultSrc")
|
|
||||||
public fun setDefaultSource(view: ReactImageView, source: String?) {
|
public fun setDefaultSource(view: ReactImageView, source: String?) {
|
||||||
view.setDefaultSource(source)
|
view.setDefaultSource(source)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user