mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
971ba5c26b
Summary:
# Problem
I removed the {eventName}: true entries from ViewConfigs validAttributes in D33303950 (https://github.com/facebook/react-native/commit/ca5aaa766329055f206e51b2eaefcba4f282b05a). These entries were iOS-only. I removed them to achieve platform-consistency in native ViewConfigs.
This change broke the onLayout event for all React Native components. So, I reverted D33303950 (https://github.com/facebook/react-native/commit/ca5aaa766329055f206e51b2eaefcba4f282b05a) for native ViewConfigs server-side. But I never got around to reverting D33303950 (https://github.com/facebook/react-native/commit/ca5aaa766329055f206e51b2eaefcba4f282b05a) for static ViewConfigs.
# Changes
This diff reverts D33303950 (https://github.com/facebook/react-native/commit/ca5aaa766329055f206e51b2eaefcba4f282b05a) for Static ViewConfigs, with server-side gating.
Now, these {eventName}: true ViewConfig validAttribute will be inserted into all view configs (static and native) **by default**.
Calling RCTDisableViewConfigEventValidAttributes(YES) on iOS will remove {eventName}: true ViewConfig ValidAttributes entries from Static ViewConfigs. (Previously, this method only removed the entries from native ViewConfigs).
https://www.internalfb.com/code/fbsource/[6615b0675bdf]/fbobjc/Apps/Wilde/FBReactModule2/FBReactModuleAPI/FBReactModuleAPI/Exported/FBReactModule.mm?lines=344
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D33933403
fbshipit-source-id: 17823ed99f97d7851f04e5cdab9c95667df13253
144 lines
4.0 KiB
JavaScript
144 lines
4.0 KiB
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow strict-local
|
|
* @format
|
|
*/
|
|
|
|
import type {ResolvedAssetSource} from './AssetSourceResolver';
|
|
import type {ImageProps} from './ImageProps';
|
|
import type {ViewProps} from '../Components/View/ViewPropTypes';
|
|
import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry';
|
|
import {ConditionallyIgnoredEventHandlers} from '../NativeComponent/ViewConfigIgnore';
|
|
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
import type {
|
|
ColorValue,
|
|
DangerouslyImpreciseStyle,
|
|
ImageStyleProp,
|
|
} from '../StyleSheet/StyleSheet';
|
|
import Platform from '../Utilities/Platform';
|
|
|
|
type Props = $ReadOnly<{
|
|
...ImageProps,
|
|
...ViewProps,
|
|
|
|
style?: ImageStyleProp | DangerouslyImpreciseStyle,
|
|
|
|
// iOS native props
|
|
tintColor?: ColorValue,
|
|
|
|
// Android native props
|
|
shouldNotifyLoadEvents?: boolean,
|
|
src?: ?ResolvedAssetSource | $ReadOnlyArray<{uri: string, ...}>,
|
|
headers?: ?{[string]: string},
|
|
defaultSrc?: ?string,
|
|
loadingIndicatorSrc?: ?string,
|
|
}>;
|
|
|
|
const ImageViewViewConfig =
|
|
Platform.OS === 'android'
|
|
? {
|
|
uiViewClassName: 'RCTImageView',
|
|
bubblingEventTypes: {},
|
|
directEventTypes: {
|
|
topLoadStart: {
|
|
registrationName: 'onLoadStart',
|
|
},
|
|
topProgress: {
|
|
registrationName: 'onProgress',
|
|
},
|
|
topError: {
|
|
registrationName: 'onError',
|
|
},
|
|
topLoad: {
|
|
registrationName: 'onLoad',
|
|
},
|
|
topLoadEnd: {
|
|
registrationName: 'onLoadEnd',
|
|
},
|
|
},
|
|
validAttributes: {
|
|
blurRadius: true,
|
|
internal_analyticTag: true,
|
|
resizeMode: true,
|
|
tintColor: {
|
|
process: require('../StyleSheet/processColor'),
|
|
},
|
|
borderBottomLeftRadius: true,
|
|
borderTopLeftRadius: true,
|
|
resizeMethod: true,
|
|
src: true,
|
|
borderRadius: true,
|
|
headers: true,
|
|
shouldNotifyLoadEvents: true,
|
|
defaultSrc: true,
|
|
overlayColor: {
|
|
process: require('../StyleSheet/processColor'),
|
|
},
|
|
borderColor: {
|
|
process: require('../StyleSheet/processColor'),
|
|
},
|
|
accessible: true,
|
|
progressiveRenderingEnabled: true,
|
|
fadeDuration: true,
|
|
borderBottomRightRadius: true,
|
|
borderTopRightRadius: true,
|
|
loadingIndicatorSrc: true,
|
|
},
|
|
}
|
|
: {
|
|
uiViewClassName: 'RCTImageView',
|
|
bubblingEventTypes: {},
|
|
directEventTypes: {
|
|
topLoadStart: {
|
|
registrationName: 'onLoadStart',
|
|
},
|
|
topProgress: {
|
|
registrationName: 'onProgress',
|
|
},
|
|
topError: {
|
|
registrationName: 'onError',
|
|
},
|
|
topPartialLoad: {
|
|
registrationName: 'onPartialLoad',
|
|
},
|
|
topLoad: {
|
|
registrationName: 'onLoad',
|
|
},
|
|
topLoadEnd: {
|
|
registrationName: 'onLoadEnd',
|
|
},
|
|
},
|
|
validAttributes: {
|
|
blurRadius: true,
|
|
capInsets: {
|
|
diff: require('../Utilities/differ/insetsDiffer'),
|
|
},
|
|
defaultSource: {
|
|
process: require('./resolveAssetSource'),
|
|
},
|
|
internal_analyticTag: true,
|
|
resizeMode: true,
|
|
source: true,
|
|
tintColor: {
|
|
process: require('../StyleSheet/processColor'),
|
|
},
|
|
...ConditionallyIgnoredEventHandlers({
|
|
onLoadStart: true,
|
|
onLoad: true,
|
|
onLoadEnd: true,
|
|
onProgress: true,
|
|
onError: true,
|
|
onPartialLoad: true,
|
|
}),
|
|
},
|
|
};
|
|
|
|
const ImageViewNativeComponent: HostComponent<Props> =
|
|
NativeComponentRegistry.get<Props>('RCTImageView', () => ImageViewViewConfig);
|
|
|
|
export default ImageViewNativeComponent;
|