Skip to content

Commit fcf01b8

Browse files
RSNarafacebook-github-bot
authored andcommitted
Fix SVC for RCTImageView
Summary: Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D33341778 fbshipit-source-id: fb51664706febce570808b6018e98637d5f0d42a
1 parent 067bcb5 commit fcf01b8

File tree

1 file changed

+93
-56
lines changed

1 file changed

+93
-56
lines changed

Libraries/Image/ImageViewNativeComponent.js

Lines changed: 93 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import type {
1818
DangerouslyImpreciseStyle,
1919
ImageStyleProp,
2020
} from '../StyleSheet/StyleSheet';
21+
import Platform from '../Utilities/Platform';
2122

2223
type Props = $ReadOnly<{
2324
...ImageProps,
@@ -36,62 +37,98 @@ type Props = $ReadOnly<{
3637
loadingIndicatorSrc?: ?string,
3738
}>;
3839

40+
const ImageViewViewConfig =
41+
Platform.OS === 'android'
42+
? {
43+
uiViewClassName: 'RCTImageView',
44+
bubblingEventTypes: {},
45+
directEventTypes: {
46+
topLoadStart: {
47+
registrationName: 'onLoadStart',
48+
},
49+
topProgress: {
50+
registrationName: 'onProgress',
51+
},
52+
topError: {
53+
registrationName: 'onError',
54+
},
55+
topLoad: {
56+
registrationName: 'onLoad',
57+
},
58+
topLoadEnd: {
59+
registrationName: 'onLoadEnd',
60+
},
61+
},
62+
validAttributes: {
63+
blurRadius: true,
64+
internal_analyticTag: true,
65+
resizeMode: true,
66+
tintColor: {
67+
process: require('../StyleSheet/processColor'),
68+
},
69+
borderBottomLeftRadius: true,
70+
borderTopLeftRadius: true,
71+
resizeMethod: true,
72+
src: true,
73+
borderRadius: true,
74+
headers: true,
75+
shouldNotifyLoadEvents: true,
76+
defaultSrc: true,
77+
overlayColor: {
78+
process: require('../StyleSheet/processColor'),
79+
},
80+
borderColor: {
81+
process: require('../StyleSheet/processColor'),
82+
},
83+
accessible: true,
84+
progressiveRenderingEnabled: true,
85+
fadeDuration: true,
86+
borderBottomRightRadius: true,
87+
borderTopRightRadius: true,
88+
loadingIndicatorSrc: true,
89+
},
90+
}
91+
: {
92+
uiViewClassName: 'RCTImageView',
93+
bubblingEventTypes: {},
94+
directEventTypes: {
95+
topLoadStart: {
96+
registrationName: 'onLoadStart',
97+
},
98+
topProgress: {
99+
registrationName: 'onProgress',
100+
},
101+
topError: {
102+
registrationName: 'onError',
103+
},
104+
topPartialLoad: {
105+
registrationName: 'onPartialLoad',
106+
},
107+
topLoad: {
108+
registrationName: 'onLoad',
109+
},
110+
topLoadEnd: {
111+
registrationName: 'onLoadEnd',
112+
},
113+
},
114+
validAttributes: {
115+
blurRadius: true,
116+
capInsets: {
117+
diff: require('../Utilities/differ/insetsDiffer'),
118+
},
119+
defaultSource: {
120+
process: require('./resolveAssetSource'),
121+
},
122+
internal_analyticTag: true,
123+
resizeMode: true,
124+
source: true,
125+
tintColor: {
126+
process: require('../StyleSheet/processColor'),
127+
},
128+
},
129+
};
130+
39131
const ImageViewNativeComponent: HostComponent<Props> =
40-
NativeComponentRegistry.get<Props>('RCTImageView', () => ({
41-
uiViewClassName: 'RCTImageView',
42-
bubblingEventTypes: {},
43-
directEventTypes: {
44-
topLoadStart: {
45-
registrationName: 'onLoadStart',
46-
},
47-
topProgress: {
48-
registrationName: 'onProgress',
49-
},
50-
topError: {
51-
registrationName: 'onError',
52-
},
53-
topPartialLoad: {
54-
registrationName: 'onPartialLoad',
55-
},
56-
topLoad: {
57-
registrationName: 'onLoad',
58-
},
59-
topLoadEnd: {
60-
registrationName: 'onLoadEnd',
61-
},
62-
},
63-
validAttributes: {
64-
blurRadius: true,
65-
capInsets: {
66-
diff: require('../Utilities/differ/insetsDiffer'),
67-
},
68-
defaultSource: {
69-
process: require('./resolveAssetSource'),
70-
},
71-
defaultSrc: true,
72-
fadeDuration: true,
73-
headers: true,
74-
internal_analyticTag: true,
75-
loadingIndicatorSrc: true,
76-
onError: true,
77-
onLoad: true,
78-
onLoadEnd: true,
79-
onLoadStart: true,
80-
onPartialLoad: true,
81-
onProgress: true,
82-
overlayColor: {
83-
process: require('../StyleSheet/processColor'),
84-
},
85-
progressiveRenderingEnabled: true,
86-
resizeMethod: true,
87-
resizeMode: true,
88-
shouldNotifyLoadEvents: true,
89-
source: true,
90-
src: true,
91-
tintColor: {
92-
process: require('../StyleSheet/processColor'),
93-
},
94-
},
95-
}));
132+
NativeComponentRegistry.get<Props>('RCTImageView', () => ImageViewViewConfig);
96133

97134
export default ImageViewNativeComponent;

0 commit comments

Comments
 (0)