Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @format
|
|
|
|
* @flow strict-local
|
|
|
|
*/
|
|
|
|
|
|
|
|
import {Platform} from 'react-native';
|
|
|
|
import type {PartialViewConfig} from '../Renderer/shims/ReactNativeTypes';
|
|
|
|
import ReactNativeStyleAttributes from '../Components/View/ReactNativeStyleAttributes';
|
2022-02-09 06:09:19 +03:00
|
|
|
import {
|
|
|
|
DynamicallyInjectedByGestureHandler,
|
|
|
|
ConditionallyIgnoredEventHandlers,
|
|
|
|
} from './ViewConfigIgnore';
|
Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
|
|
|
|
type PartialViewConfigWithoutName = $Rest<
|
|
|
|
PartialViewConfig,
|
|
|
|
{uiViewClassName: string},
|
|
|
|
>;
|
|
|
|
|
|
|
|
const PlatformBaseViewConfig: PartialViewConfigWithoutName =
|
|
|
|
Platform.OS === 'android'
|
|
|
|
? /**
|
|
|
|
* On Android, Props are derived from a ViewManager and its ShadowNode.
|
|
|
|
*
|
|
|
|
* Where did we find these base platform props from?
|
|
|
|
* - Nearly all component ViewManagers descend from BaseViewManager.
|
|
|
|
* - BaseViewManagers' ShadowNodes descend from LayoutShadowNode.
|
|
|
|
*
|
|
|
|
* So, these ViewConfigs are generated from LayoutShadowNode and BaseViewManager.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
directEventTypes: {
|
|
|
|
topAccessibilityAction: {
|
|
|
|
registrationName: 'onAccessibilityAction',
|
|
|
|
},
|
|
|
|
topPointerEnter: {
|
2022-02-10 17:05:21 +03:00
|
|
|
registrationName: 'onPointerEnter',
|
Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
},
|
|
|
|
topPointerLeave: {
|
2022-02-10 17:05:21 +03:00
|
|
|
registrationName: 'onPointerLeave',
|
Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
},
|
|
|
|
topPointerMove: {
|
2022-02-10 17:05:21 +03:00
|
|
|
registrationName: 'onPointerMove',
|
Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
},
|
|
|
|
onGestureHandlerEvent: DynamicallyInjectedByGestureHandler({
|
|
|
|
registrationName: 'onGestureHandlerEvent',
|
|
|
|
}),
|
|
|
|
onGestureHandlerStateChange: DynamicallyInjectedByGestureHandler({
|
|
|
|
registrationName: 'onGestureHandlerStateChange',
|
|
|
|
}),
|
|
|
|
|
|
|
|
// Direct events from UIManagerModuleConstants.java
|
|
|
|
topContentSizeChange: {
|
|
|
|
registrationName: 'onContentSizeChange',
|
|
|
|
},
|
|
|
|
topScrollBeginDrag: {
|
|
|
|
registrationName: 'onScrollBeginDrag',
|
|
|
|
},
|
|
|
|
topMessage: {
|
|
|
|
registrationName: 'onMessage',
|
|
|
|
},
|
|
|
|
topSelectionChange: {
|
|
|
|
registrationName: 'onSelectionChange',
|
|
|
|
},
|
|
|
|
topLoadingFinish: {
|
|
|
|
registrationName: 'onLoadingFinish',
|
|
|
|
},
|
|
|
|
topMomentumScrollEnd: {
|
|
|
|
registrationName: 'onMomentumScrollEnd',
|
|
|
|
},
|
|
|
|
topClick: {
|
|
|
|
registrationName: 'onClick',
|
|
|
|
},
|
|
|
|
topLoadingStart: {
|
|
|
|
registrationName: 'onLoadingStart',
|
|
|
|
},
|
|
|
|
topLoadingError: {
|
|
|
|
registrationName: 'onLoadingError',
|
|
|
|
},
|
|
|
|
topMomentumScrollBegin: {
|
|
|
|
registrationName: 'onMomentumScrollBegin',
|
|
|
|
},
|
|
|
|
topScrollEndDrag: {
|
|
|
|
registrationName: 'onScrollEndDrag',
|
|
|
|
},
|
|
|
|
topScroll: {
|
|
|
|
registrationName: 'onScroll',
|
|
|
|
},
|
|
|
|
topLayout: {
|
|
|
|
registrationName: 'onLayout',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
bubblingEventTypes: {
|
|
|
|
// Bubbling events from UIManagerModuleConstants.java
|
|
|
|
topChange: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
captured: 'onChangeCapture',
|
|
|
|
bubbled: 'onChange',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topSelect: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
captured: 'onSelectCapture',
|
|
|
|
bubbled: 'onSelect',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchEnd: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
captured: 'onTouchEndCapture',
|
|
|
|
bubbled: 'onTouchEnd',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchCancel: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
captured: 'onTouchCancelCapture',
|
|
|
|
bubbled: 'onTouchCancel',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchStart: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
captured: 'onTouchStartCapture',
|
|
|
|
bubbled: 'onTouchStart',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchMove: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
captured: 'onTouchMoveCapture',
|
|
|
|
bubbled: 'onTouchMove',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
validAttributes: {
|
|
|
|
// @ReactProps from BaseViewManager
|
|
|
|
backgroundColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
transform: true,
|
|
|
|
opacity: true,
|
|
|
|
elevation: true,
|
|
|
|
shadowColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
zIndex: true,
|
|
|
|
renderToHardwareTextureAndroid: true,
|
|
|
|
testID: true,
|
|
|
|
nativeID: true,
|
|
|
|
accessibilityLabelledBy: true,
|
|
|
|
accessibilityLabel: true,
|
|
|
|
accessibilityHint: true,
|
|
|
|
accessibilityRole: true,
|
|
|
|
accessibilityState: true,
|
|
|
|
accessibilityActions: true,
|
|
|
|
accessibilityValue: true,
|
|
|
|
importantForAccessibility: true,
|
|
|
|
rotation: true,
|
|
|
|
scaleX: true,
|
|
|
|
scaleY: true,
|
|
|
|
translateX: true,
|
|
|
|
translateY: true,
|
|
|
|
accessibilityLiveRegion: true,
|
|
|
|
|
|
|
|
// @ReactProps from LayoutShadowNode
|
|
|
|
width: true,
|
|
|
|
minWidth: true,
|
|
|
|
collapsable: true,
|
|
|
|
maxWidth: true,
|
|
|
|
height: true,
|
|
|
|
minHeight: true,
|
|
|
|
maxHeight: true,
|
|
|
|
flex: true,
|
|
|
|
flexGrow: true,
|
|
|
|
flexShrink: true,
|
|
|
|
flexBasis: true,
|
|
|
|
aspectRatio: true,
|
|
|
|
flexDirection: true,
|
|
|
|
flexWrap: true,
|
|
|
|
alignSelf: true,
|
|
|
|
alignItems: true,
|
|
|
|
alignContent: true,
|
|
|
|
justifyContent: true,
|
|
|
|
overflow: true,
|
|
|
|
display: true,
|
|
|
|
|
|
|
|
margin: true,
|
|
|
|
marginVertical: true,
|
|
|
|
marginHorizontal: true,
|
|
|
|
marginStart: true,
|
|
|
|
marginEnd: true,
|
|
|
|
marginTop: true,
|
|
|
|
marginBottom: true,
|
|
|
|
marginLeft: true,
|
|
|
|
marginRight: true,
|
|
|
|
|
|
|
|
padding: true,
|
|
|
|
paddingVertical: true,
|
|
|
|
paddingHorizontal: true,
|
|
|
|
paddingStart: true,
|
|
|
|
paddingEnd: true,
|
|
|
|
paddingTop: true,
|
|
|
|
paddingBottom: true,
|
|
|
|
paddingLeft: true,
|
|
|
|
paddingRight: true,
|
|
|
|
|
|
|
|
borderWidth: true,
|
|
|
|
borderStartWidth: true,
|
|
|
|
borderEndWidth: true,
|
|
|
|
borderTopWidth: true,
|
|
|
|
borderBottomWidth: true,
|
|
|
|
borderLeftWidth: true,
|
|
|
|
borderRightWidth: true,
|
|
|
|
|
|
|
|
start: true,
|
|
|
|
end: true,
|
|
|
|
left: true,
|
|
|
|
right: true,
|
|
|
|
top: true,
|
|
|
|
bottom: true,
|
|
|
|
|
|
|
|
position: true,
|
|
|
|
onLayout: true,
|
|
|
|
|
2022-02-10 17:05:21 +03:00
|
|
|
// Pointer events
|
|
|
|
onPointerEnter: true,
|
|
|
|
onPointerLeave: true,
|
|
|
|
onPointerMove: true,
|
|
|
|
|
|
|
|
// PanResponder handlers
|
|
|
|
onMoveShouldSetResponder: true,
|
|
|
|
onMoveShouldSetResponderCapture: true,
|
|
|
|
onStartShouldSetResponder: true,
|
|
|
|
onStartShouldSetResponderCapture: true,
|
|
|
|
onResponderGrant: true,
|
|
|
|
onResponderReject: true,
|
|
|
|
onResponderStart: true,
|
|
|
|
onResponderEnd: true,
|
|
|
|
onResponderRelease: true,
|
|
|
|
onResponderMove: true,
|
|
|
|
onResponderTerminate: true,
|
|
|
|
onResponderTerminationRequest: true,
|
|
|
|
onShouldBlockNativeResponder: true,
|
|
|
|
|
|
|
|
// Touch events
|
|
|
|
onTouchStart: true,
|
|
|
|
onTouchMove: true,
|
|
|
|
onTouchEnd: true,
|
|
|
|
onTouchCancel: true,
|
Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
|
|
|
|
style: ReactNativeStyleAttributes,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
: /**
|
|
|
|
* On iOS, ViewManagers define all of a component's props.
|
|
|
|
* All ViewManagers extend RCTViewManager, and RCTViewManager declares
|
|
|
|
* these props.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
bubblingEventTypes: {
|
|
|
|
// Generic Events
|
|
|
|
topPress: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onPress',
|
|
|
|
captured: 'onPressCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topChange: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onChange',
|
|
|
|
captured: 'onChangeCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topFocus: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onFocus',
|
|
|
|
captured: 'onFocusCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topBlur: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onBlur',
|
|
|
|
captured: 'onBlurCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topSubmitEditing: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onSubmitEditing',
|
|
|
|
captured: 'onSubmitEditingCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topEndEditing: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onEndEditing',
|
|
|
|
captured: 'onEndEditingCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topKeyPress: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onKeyPress',
|
|
|
|
captured: 'onKeyPressCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// Touch Events
|
|
|
|
topTouchStart: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onTouchStart',
|
|
|
|
captured: 'onTouchStartCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchMove: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onTouchMove',
|
|
|
|
captured: 'onTouchMoveCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchCancel: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onTouchCancel',
|
|
|
|
captured: 'onTouchCancelCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
topTouchEnd: {
|
|
|
|
phasedRegistrationNames: {
|
|
|
|
bubbled: 'onTouchEnd',
|
|
|
|
captured: 'onTouchEndCapture',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
directEventTypes: {
|
|
|
|
topAccessibilityAction: {
|
|
|
|
registrationName: 'onAccessibilityAction',
|
|
|
|
},
|
|
|
|
topAccessibilityTap: {
|
|
|
|
registrationName: 'onAccessibilityTap',
|
|
|
|
},
|
|
|
|
topMagicTap: {
|
|
|
|
registrationName: 'onMagicTap',
|
|
|
|
},
|
|
|
|
topAccessibilityEscape: {
|
|
|
|
registrationName: 'onAccessibilityEscape',
|
|
|
|
},
|
|
|
|
topLayout: {
|
|
|
|
registrationName: 'onLayout',
|
|
|
|
},
|
|
|
|
onGestureHandlerEvent: DynamicallyInjectedByGestureHandler({
|
|
|
|
registrationName: 'onGestureHandlerEvent',
|
|
|
|
}),
|
|
|
|
onGestureHandlerStateChange: DynamicallyInjectedByGestureHandler({
|
|
|
|
registrationName: 'onGestureHandlerStateChange',
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
validAttributes: {
|
|
|
|
// View Props
|
|
|
|
accessible: true,
|
|
|
|
accessibilityActions: true,
|
|
|
|
accessibilityLabel: true,
|
|
|
|
accessibilityHint: true,
|
|
|
|
accessibilityValue: true,
|
|
|
|
accessibilityViewIsModal: true,
|
|
|
|
accessibilityElementsHidden: true,
|
|
|
|
accessibilityIgnoresInvertColors: true,
|
|
|
|
testID: true,
|
|
|
|
backgroundColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
backfaceVisibility: true,
|
|
|
|
opacity: true,
|
|
|
|
shadowColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
shadowOffset: {diff: require('../Utilities/differ/sizesDiffer')},
|
|
|
|
shadowOpacity: true,
|
|
|
|
shadowRadius: true,
|
|
|
|
needsOffscreenAlphaCompositing: true,
|
|
|
|
overflow: true,
|
|
|
|
shouldRasterizeIOS: true,
|
|
|
|
transform: {diff: require('../Utilities/differ/matricesDiffer')},
|
|
|
|
accessibilityRole: true,
|
|
|
|
accessibilityState: true,
|
|
|
|
nativeID: true,
|
|
|
|
pointerEvents: true,
|
|
|
|
removeClippedSubviews: true,
|
|
|
|
borderRadius: true,
|
|
|
|
borderColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
borderWidth: true,
|
|
|
|
borderStyle: true,
|
|
|
|
hitSlop: {diff: require('../Utilities/differ/insetsDiffer')},
|
|
|
|
collapsable: true,
|
|
|
|
|
|
|
|
borderTopWidth: true,
|
|
|
|
borderTopColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
borderRightWidth: true,
|
|
|
|
borderRightColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
borderBottomWidth: true,
|
|
|
|
borderBottomColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
borderLeftWidth: true,
|
|
|
|
borderLeftColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
borderStartWidth: true,
|
|
|
|
borderStartColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
borderEndWidth: true,
|
|
|
|
borderEndColor: {process: require('../StyleSheet/processColor')},
|
|
|
|
|
|
|
|
borderTopLeftRadius: true,
|
|
|
|
borderTopRightRadius: true,
|
|
|
|
borderTopStartRadius: true,
|
|
|
|
borderTopEndRadius: true,
|
|
|
|
borderBottomLeftRadius: true,
|
|
|
|
borderBottomRightRadius: true,
|
|
|
|
borderBottomStartRadius: true,
|
|
|
|
borderBottomEndRadius: true,
|
|
|
|
display: true,
|
|
|
|
zIndex: true,
|
|
|
|
|
|
|
|
// ShadowView properties
|
|
|
|
top: true,
|
|
|
|
right: true,
|
|
|
|
start: true,
|
|
|
|
end: true,
|
|
|
|
bottom: true,
|
|
|
|
left: true,
|
|
|
|
|
|
|
|
width: true,
|
|
|
|
height: true,
|
|
|
|
|
|
|
|
minWidth: true,
|
|
|
|
maxWidth: true,
|
|
|
|
minHeight: true,
|
|
|
|
maxHeight: true,
|
|
|
|
|
|
|
|
// Also declared as ViewProps
|
|
|
|
// borderTopWidth: true,
|
|
|
|
// borderRightWidth: true,
|
|
|
|
// borderBottomWidth: true,
|
|
|
|
// borderLeftWidth: true,
|
|
|
|
// borderStartWidth: true,
|
|
|
|
// borderEndWidth: true,
|
|
|
|
// borderWidth: true,
|
|
|
|
|
|
|
|
marginTop: true,
|
|
|
|
marginRight: true,
|
|
|
|
marginBottom: true,
|
|
|
|
marginLeft: true,
|
|
|
|
marginStart: true,
|
|
|
|
marginEnd: true,
|
|
|
|
marginVertical: true,
|
|
|
|
marginHorizontal: true,
|
|
|
|
margin: true,
|
|
|
|
|
|
|
|
paddingTop: true,
|
|
|
|
paddingRight: true,
|
|
|
|
paddingBottom: true,
|
|
|
|
paddingLeft: true,
|
|
|
|
paddingStart: true,
|
|
|
|
paddingEnd: true,
|
|
|
|
paddingVertical: true,
|
|
|
|
paddingHorizontal: true,
|
|
|
|
padding: true,
|
|
|
|
|
|
|
|
flex: true,
|
|
|
|
flexGrow: true,
|
|
|
|
flexShrink: true,
|
|
|
|
flexBasis: true,
|
|
|
|
flexDirection: true,
|
|
|
|
flexWrap: true,
|
|
|
|
justifyContent: true,
|
|
|
|
alignItems: true,
|
|
|
|
alignSelf: true,
|
|
|
|
alignContent: true,
|
|
|
|
position: true,
|
|
|
|
aspectRatio: true,
|
|
|
|
|
|
|
|
// Also declared as ViewProps
|
|
|
|
// overflow: true,
|
|
|
|
// display: true,
|
|
|
|
|
|
|
|
direction: true,
|
|
|
|
|
|
|
|
style: ReactNativeStyleAttributes,
|
2022-02-09 06:09:19 +03:00
|
|
|
|
|
|
|
...ConditionallyIgnoredEventHandlers({
|
|
|
|
onLayout: true,
|
|
|
|
onMagicTap: true,
|
|
|
|
onAccessibilityAction: true,
|
|
|
|
onAccessibilityEscape: true,
|
|
|
|
onAccessibilityTap: true,
|
2022-02-10 17:05:21 +03:00
|
|
|
|
|
|
|
// PanResponder handlers
|
|
|
|
onMoveShouldSetResponder: true,
|
|
|
|
onMoveShouldSetResponderCapture: true,
|
|
|
|
onStartShouldSetResponder: true,
|
|
|
|
onStartShouldSetResponderCapture: true,
|
|
|
|
onResponderGrant: true,
|
|
|
|
onResponderReject: true,
|
|
|
|
onResponderStart: true,
|
|
|
|
onResponderEnd: true,
|
|
|
|
onResponderRelease: true,
|
|
|
|
onResponderMove: true,
|
|
|
|
onResponderTerminate: true,
|
|
|
|
onResponderTerminationRequest: true,
|
|
|
|
onShouldBlockNativeResponder: true,
|
|
|
|
|
|
|
|
// Touch events
|
|
|
|
onTouchStart: true,
|
|
|
|
onTouchMove: true,
|
|
|
|
onTouchEnd: true,
|
|
|
|
onTouchCancel: true,
|
2022-02-09 06:09:19 +03:00
|
|
|
}),
|
Introduce PlatformBaseViewConfig and fix SVC for RCTView
Summary:
## Impact
Fix the Static ViewConfig for <View/>.
This diff fixes the base ViewConfig for all HostComponents on both platforms. Consequently, it simplifies SVC reconciliation efforts, by nearly eliminating the first of these classes of SVC errors:
1. Unexpected properties in SVC
2. Missing properties in SVC
3. Not matching properites in SVC
## What is the base ViewConfig on each iOS/Android?
**On iOS:**
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager
https://pxl.cl/1SxdF
Therefore, the base ViewConfig for all components should be <View/>'s static ViewConfig.
**On Android:**
The component model is a bit more complicated:
https://pxl.cl/1Vmp5
Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.
So, on Android, it's not safe for the base ViewConfig to be <View>'s ViewConfig:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.
So, what should the base ViewConfig be on Android?
- Nearly all components extend BaseViewManager. BaseViewManager must have a shadow node [that extends LayoutShadowNode](https://www.internalfb.com/code/fbsource/[47d68ebc06e64d97da9d069f1ab662b392f0df8a]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java?lines=40). Therefore, we'll make the base ViewConfig on Android be generated by BaseViewManager + LayoutShadowNode.
## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.
The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.
Changelog: [Internal]
Reviewed By: p-sun, yungsters
Differential Revision: D33135055
fbshipit-source-id: 7299f60ae45ed499ce47c0d0a6309a047bff90bb
2022-02-01 01:50:51 +03:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export default PlatformBaseViewConfig;
|