Skip to content

Commit 34efaab

Browse files
GijsWeteringsfacebook-github-bot
authored andcommitted
Back out "Fix Static View Config for RCTView"
Summary: Changelog: [internal] Reviewed By: arushikesarwani94 Differential Revision: D33042498 fbshipit-source-id: 42667f0fb17d502494139645a42dc54dea9904b7
1 parent 0c744de commit 34efaab

File tree

5 files changed

+145
-121
lines changed

5 files changed

+145
-121
lines changed

Libraries/Components/View/ReactNativeViewViewConfig.js

+54-86
Original file line numberDiff line numberDiff line change
@@ -9,54 +9,17 @@
99
*/
1010

1111
import type {ViewConfig} from '../../Renderer/shims/ReactNativeTypes';
12-
import {DynamicallyInjectedByGestureHandler} from '../../NativeComponent/ViewConfigIgnore';
12+
import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid';
1313
import {Platform} from 'react-native';
1414

15-
const ReactNativeViewViewConfigAndroid = {
16-
bubblingEventTypes: {},
17-
directEventTypes: {
18-
topAccessibilityAction: {
19-
registrationName: 'onAccessibilityAction',
20-
},
21-
topPointerEnter: {
22-
registrationName: 'pointerenter',
23-
},
24-
topPointerLeave: {
25-
registrationName: 'pointerleave',
26-
},
27-
topPointerMove: {
28-
registrationName: 'pointermove',
29-
},
30-
},
31-
validAttributes: {
32-
elevation: true,
33-
hasTVPreferredFocus: true,
34-
focusable: true,
35-
nativeBackgroundAndroid: true,
36-
nativeForegroundAndroid: true,
37-
nextFocusDown: true,
38-
nextFocusForward: true,
39-
nextFocusLeft: true,
40-
nextFocusRight: true,
41-
nextFocusUp: true,
42-
renderToHardwareTextureAndroid: true,
43-
translateX: true,
44-
scaleX: true,
45-
scaleY: true,
46-
importantForAccessibility: true,
47-
accessibilityLiveRegion: true,
48-
rotation: true,
49-
translateY: true,
50-
transform: true,
51-
hitSlop: true,
52-
pointerenter: true,
53-
pointerleave: true,
54-
pointermove: true,
55-
},
56-
};
57-
58-
const ReactNativeViewViewConfigIOS = {
15+
const ReactNativeViewConfig: ViewConfig = {
16+
uiViewClassName: 'RCTView',
17+
baseModuleName: null,
18+
Manager: 'ViewManager',
19+
Commands: {},
20+
Constants: {},
5921
bubblingEventTypes: {
22+
...ReactNativeViewViewConfigAndroid.bubblingEventTypes,
6023
topBlur: {
6124
phasedRegistrationNames: {
6225
bubbled: 'onBlur',
@@ -125,6 +88,7 @@ const ReactNativeViewViewConfigIOS = {
12588
},
12689
},
12790
directEventTypes: {
91+
...ReactNativeViewViewConfigAndroid.directEventTypes,
12892
topAccessibilityAction: {
12993
registrationName: 'onAccessibilityAction',
13094
},
@@ -140,56 +104,36 @@ const ReactNativeViewViewConfigIOS = {
140104
topMagicTap: {
141105
registrationName: 'onMagicTap',
142106
},
143-
},
144-
validAttributes: {
145-
accessibilityElementsHidden: true,
146-
accessibilityIgnoresInvertColors: true,
147-
accessibilityViewIsModal: true,
148-
direction: true,
149-
onAccessibilityAction: true,
150-
onAccessibilityEscape: true,
151-
onAccessibilityTap: true,
152-
onMagicTap: true,
153-
shadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')},
154-
shadowOpacity: true,
155-
shadowRadius: true,
156-
shouldRasterizeIOS: true,
157-
transform: {diff: require('../../Utilities/differ/matricesDiffer')},
158-
hitSlop: {diff: require('../../Utilities/differ/insetsDiffer')},
159-
},
160-
};
161-
162-
const PlatformSpecificViewConfig =
163-
Platform.OS === 'android'
164-
? ReactNativeViewViewConfigAndroid
165-
: ReactNativeViewViewConfigIOS;
166-
167-
const ReactNativeViewConfig: ViewConfig = {
168-
uiViewClassName: 'RCTView',
169-
baseModuleName: null,
170-
Manager: 'ViewManager',
171-
Commands: {},
172-
Constants: {},
173-
bubblingEventTypes: PlatformSpecificViewConfig.bubblingEventTypes,
174-
directEventTypes: {
175-
...PlatformSpecificViewConfig.directEventTypes,
107+
topPointerEnter: {
108+
registrationName: 'pointerenter',
109+
},
110+
topPointerLeave: {
111+
registrationName: 'pointerleave',
112+
},
113+
topPointerMove: {
114+
registrationName: 'pointermove',
115+
},
176116
// Events for react-native-gesture-handler (T45765076)
177117
// Remove once this library can handle JS View Configs
178-
onGestureHandlerEvent: DynamicallyInjectedByGestureHandler({
118+
onGestureHandlerEvent: {
179119
registrationName: 'onGestureHandlerEvent',
180-
}),
181-
onGestureHandlerStateChange: DynamicallyInjectedByGestureHandler({
120+
},
121+
onGestureHandlerStateChange: {
182122
registrationName: 'onGestureHandlerStateChange',
183-
}),
123+
},
184124
},
185125
validAttributes: {
186-
...PlatformSpecificViewConfig.validAttributes,
126+
...ReactNativeViewViewConfigAndroid.validAttributes,
187127
accessibilityActions: true,
128+
accessibilityElementsHidden: true,
188129
accessibilityHint: true,
130+
accessibilityIgnoresInvertColors: true,
189131
accessibilityLabel: true,
132+
accessibilityLiveRegion: true,
190133
accessibilityRole: true,
191134
accessibilityState: true,
192135
accessibilityValue: true,
136+
accessibilityViewIsModal: true,
193137
accessible: true,
194138
alignContent: true,
195139
alignItems: true,
@@ -222,8 +166,11 @@ const ReactNativeViewConfig: ViewConfig = {
222166
borderTopWidth: true,
223167
borderWidth: true,
224168
bottom: true,
169+
clickable: true,
225170
collapsable: true,
171+
direction: true,
226172
display: true,
173+
elevation: true,
227174
end: true,
228175
flex: true,
229176
flexBasis: true,
@@ -232,6 +179,8 @@ const ReactNativeViewConfig: ViewConfig = {
232179
flexShrink: true,
233180
flexWrap: true,
234181
height: true,
182+
hitSlop: {diff: require('../../Utilities/differ/insetsDiffer')},
183+
importantForAccessibility: true,
235184
justifyContent: true,
236185
left: true,
237186
margin: true,
@@ -252,7 +201,11 @@ const ReactNativeViewConfig: ViewConfig = {
252201
onAccessibilityAction: true,
253202
onAccessibilityEscape: true,
254203
onAccessibilityTap: true,
204+
pointerenter: true,
205+
pointerleave: true,
206+
pointermove: true,
255207
onLayout: true,
208+
onMagicTap: true,
256209
opacity: true,
257210
overflow: true,
258211
padding: true,
@@ -267,8 +220,16 @@ const ReactNativeViewConfig: ViewConfig = {
267220
pointerEvents: true,
268221
position: true,
269222
removeClippedSubviews: true,
223+
renderToHardwareTextureAndroid: true,
270224
right: true,
225+
rotation: true,
226+
scaleX: true,
227+
scaleY: true,
271228
shadowColor: {process: require('../../StyleSheet/processColor')},
229+
shadowOffset: {diff: require('../../Utilities/differ/sizesDiffer')},
230+
shadowOpacity: true,
231+
shadowRadius: true,
232+
shouldRasterizeIOS: true,
272233
start: true,
273234
style: {
274235
alignContent: true,
@@ -372,9 +333,10 @@ const ReactNativeViewConfig: ViewConfig = {
372333
textTransform: true,
373334
tintColor: {process: require('../../StyleSheet/processColor')},
374335
top: true,
375-
transform: {
376-
process: require('../../StyleSheet/processTransform'),
377-
},
336+
transform:
337+
Platform.OS === 'ios'
338+
? {diff: require('../../Utilities/differ/matricesDiffer')}
339+
: {process: require('../../StyleSheet/processTransform')},
378340
transformMatrix: true,
379341
translateX: true,
380342
translateY: true,
@@ -384,6 +346,12 @@ const ReactNativeViewConfig: ViewConfig = {
384346
},
385347
testID: true,
386348
top: true,
349+
transform:
350+
Platform.OS === 'ios'
351+
? {diff: require('../../Utilities/differ/matricesDiffer')}
352+
: {process: require('../../StyleSheet/processTransform')},
353+
translateX: true,
354+
translateY: true,
387355
width: true,
388356
zIndex: true,
389357
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*
7+
* @flow strict-local
8+
* @format
9+
*/
10+
11+
'use strict';
12+
13+
const ReactNativeViewViewConfigAndroid = {
14+
uiViewClassName: 'RCTView',
15+
bubblingEventTypes: {
16+
topSelect: {
17+
phasedRegistrationNames: {
18+
bubbled: 'onSelect',
19+
captured: 'onSelectCapture',
20+
},
21+
},
22+
topAssetDidLoad: {
23+
phasedRegistrationNames: {
24+
bubbled: 'onAssetDidLoad',
25+
captured: 'onAssetDidLoadCapture',
26+
},
27+
},
28+
},
29+
directEventTypes: {
30+
topClick: {
31+
registrationName: 'onClick',
32+
},
33+
topContentSizeChange: {
34+
registrationName: 'onContentSizeChange',
35+
},
36+
topLoadingError: {
37+
registrationName: 'onLoadingError',
38+
},
39+
topLoadingFinish: {
40+
registrationName: 'onLoadingFinish',
41+
},
42+
topLoadingStart: {
43+
registrationName: 'onLoadingStart',
44+
},
45+
topMessage: {
46+
registrationName: 'onMessage',
47+
},
48+
topMomentumScrollBegin: {
49+
registrationName: 'onMomentumScrollBegin',
50+
},
51+
topMomentumScrollEnd: {
52+
registrationName: 'onMomentumScrollEnd',
53+
},
54+
topScroll: {
55+
registrationName: 'onScroll',
56+
},
57+
topScrollBeginDrag: {
58+
registrationName: 'onScrollBeginDrag',
59+
},
60+
topScrollEndDrag: {
61+
registrationName: 'onScrollEndDrag',
62+
},
63+
topSelectionChange: {
64+
registrationName: 'onSelectionChange',
65+
},
66+
onAssetDidLoad: {
67+
registrationName: 'onAssetDidLoad',
68+
},
69+
},
70+
validAttributes: {
71+
hasTVPreferredFocus: true,
72+
focusable: true,
73+
nativeBackgroundAndroid: true,
74+
nativeForegroundAndroid: true,
75+
nextFocusDown: true,
76+
nextFocusForward: true,
77+
nextFocusLeft: true,
78+
nextFocusRight: true,
79+
nextFocusUp: true,
80+
},
81+
};
82+
83+
module.exports = ReactNativeViewViewConfigAndroid;

Libraries/Components/View/ViewNativeComponent.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@
1010

1111
import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry';
1212
import {type HostComponent} from '../../Renderer/shims/ReactNativeTypes';
13+
import Platform from '../../Utilities/Platform';
1314
import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
15+
import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid';
1416
import {type ViewProps as Props} from './ViewPropTypes';
1517
import * as React from 'react';
1618

1719
const ViewNativeComponent: HostComponent<Props> =
18-
NativeComponentRegistry.get<Props>('RCTView', () => ({
19-
uiViewClassName: 'RCTView',
20-
}));
20+
NativeComponentRegistry.get<Props>('RCTView', () =>
21+
Platform.OS === 'android'
22+
? ReactNativeViewViewConfigAndroid
23+
: {uiViewClassName: 'RCTView'},
24+
);
2125

2226
interface NativeCommands {
2327
+hotspotUpdate: (

Libraries/NativeComponent/StaticViewConfigValidator.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
*/
1010

1111
import {type ViewConfig} from '../Renderer/shims/ReactNativeTypes';
12-
import {isIgnored} from './ViewConfigIgnore';
1312

1413
type Difference =
1514
| {
@@ -145,10 +144,7 @@ function accumulateDifferences(
145144
}
146145

147146
for (const staticKey in staticObject) {
148-
if (
149-
!nativeObject.hasOwnProperty(staticKey) &&
150-
!isIgnored(staticObject[staticKey])
151-
) {
147+
if (!nativeObject.hasOwnProperty(staticKey)) {
152148
differences.push({
153149
path: [...path, staticKey],
154150
type: 'unexpected',

Libraries/NativeComponent/ViewConfigIgnore.js

-27
This file was deleted.

0 commit comments

Comments
 (0)