mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 23:05:00 +08:00
Remove view configs from JS
Summary: Apparently different apps have different implementations of view managers that support different props. This is a problem that we will need to address. Unfortunately, this means we can't have a static config defined in JS. We will need to find another approach to this problem. Reviewed By: sahrens Differential Revision: D9500178 fbshipit-source-id: b591559164fcf29f5fd43e13a0f2da15011491c6
This commit is contained in:
committed by
Facebook Github Bot
parent
035597566f
commit
d2c27f5bff
@@ -10,29 +10,14 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const AndroidConfig = require('ViewNativeComponentAndroidConfig');
|
||||
const Platform = require('Platform');
|
||||
const ReactNative = require('ReactNative');
|
||||
|
||||
const verifyComponentAttributeEquivalence = require('verifyComponentAttributeEquivalence');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
const ReactNativeViewConfigRegistry = require('ReactNativeViewConfigRegistry');
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
type ViewNativeComponentType = Class<ReactNative.NativeComponent<ViewProps>>;
|
||||
|
||||
let NativeViewComponent;
|
||||
if (Platform.OS === 'android') {
|
||||
if (__DEV__) {
|
||||
verifyComponentAttributeEquivalence('RCTView', AndroidConfig);
|
||||
}
|
||||
|
||||
NativeViewComponent = ReactNativeViewConfigRegistry.register('RCTView', () =>
|
||||
require('ViewNativeComponentAndroidConfig'),
|
||||
);
|
||||
} else {
|
||||
NativeViewComponent = requireNativeComponent('RCTView');
|
||||
}
|
||||
const NativeViewComponent = requireNativeComponent('RCTView');
|
||||
|
||||
module.exports = ((NativeViewComponent: any): ViewNativeComponentType);
|
||||
|
||||
@@ -1,287 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||
|
||||
const processColor = require('processColor');
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type {____ViewStyle_Internal} from 'StyleSheetTypes';
|
||||
import type {ReactNativeBaseComponentViewConfig} from 'ReactNativeTypes';
|
||||
|
||||
const colorHandler = {diff: null, process: processColor};
|
||||
|
||||
type Config = ReactNativeBaseComponentViewConfig<
|
||||
$Keys<ViewProps> | $Keys<____ViewStyle_Internal>,
|
||||
$Keys<____ViewStyle_Internal>,
|
||||
>;
|
||||
|
||||
const ViewNativeComponentAndroidConfig: Config = {
|
||||
bubblingEventTypes: {
|
||||
topChange: {
|
||||
phasedRegistrationNames: {
|
||||
captured: 'onChangeCapture',
|
||||
bubbled: 'onChange',
|
||||
},
|
||||
},
|
||||
topTouchCancel: {
|
||||
phasedRegistrationNames: {
|
||||
captured: 'onTouchCancelCapture',
|
||||
bubbled: 'onTouchCancel',
|
||||
},
|
||||
},
|
||||
topTouchMove: {
|
||||
phasedRegistrationNames: {
|
||||
captured: 'onTouchMoveCapture',
|
||||
bubbled: 'onTouchMove',
|
||||
},
|
||||
},
|
||||
topTouchStart: {
|
||||
phasedRegistrationNames: {
|
||||
captured: 'onTouchStartCapture',
|
||||
bubbled: 'onTouchStart',
|
||||
},
|
||||
},
|
||||
topTouchEnd: {
|
||||
phasedRegistrationNames: {
|
||||
captured: 'onTouchEndCapture',
|
||||
bubbled: 'onTouchEnd',
|
||||
},
|
||||
},
|
||||
topSelect: {
|
||||
phasedRegistrationNames: {
|
||||
captured: 'onSelectCapture',
|
||||
bubbled: 'onSelect',
|
||||
},
|
||||
},
|
||||
},
|
||||
Commands: {setPressed: 2, hotspotUpdate: 1},
|
||||
directEventTypes: {
|
||||
topLoadingError: {registrationName: 'onLoadingError'},
|
||||
topLayout: {registrationName: 'onLayout'},
|
||||
topScrollBeginDrag: {registrationName: 'onScrollBeginDrag'},
|
||||
topContentSizeChange: {registrationName: 'onContentSizeChange'},
|
||||
topMomentumScrollBegin: {registrationName: 'onMomentumScrollBegin'},
|
||||
topScrollEndDrag: {registrationName: 'onScrollEndDrag'},
|
||||
topMomentumScrollEnd: {registrationName: 'onMomentumScrollEnd'},
|
||||
topLoadingStart: {registrationName: 'onLoadingStart'},
|
||||
topSelectionChange: {registrationName: 'onSelectionChange'},
|
||||
topLoadingFinish: {registrationName: 'onLoadingFinish'},
|
||||
topMessage: {registrationName: 'onMessage'},
|
||||
topScroll: {registrationName: 'onScroll'},
|
||||
},
|
||||
NativeProps: {
|
||||
accessibilityComponentType: 'String',
|
||||
accessibilityHint: 'String',
|
||||
accessibilityLabel: 'String',
|
||||
accessibilityLiveRegion: 'String',
|
||||
accessibilityRole: 'String',
|
||||
accessibilityStates: 'Array',
|
||||
accessible: 'boolean',
|
||||
alignContent: 'String',
|
||||
alignItems: 'String',
|
||||
alignSelf: 'String',
|
||||
aspectRatio: 'number',
|
||||
backgroundColor: 'Color',
|
||||
borderBottomColor: 'Color',
|
||||
borderBottomEndRadius: 'number',
|
||||
borderBottomLeftRadius: 'number',
|
||||
borderBottomRightRadius: 'number',
|
||||
borderBottomStartRadius: 'number',
|
||||
borderBottomWidth: 'number',
|
||||
borderColor: 'Color',
|
||||
borderEndColor: 'Color',
|
||||
borderEndWidth: 'number',
|
||||
borderLeftColor: 'Color',
|
||||
borderLeftWidth: 'number',
|
||||
borderRadius: 'number',
|
||||
borderRightColor: 'Color',
|
||||
borderRightWidth: 'number',
|
||||
borderStartColor: 'Color',
|
||||
borderStartWidth: 'number',
|
||||
borderStyle: 'String',
|
||||
borderTopColor: 'Color',
|
||||
borderTopEndRadius: 'number',
|
||||
borderTopLeftRadius: 'number',
|
||||
borderTopRightRadius: 'number',
|
||||
borderTopStartRadius: 'number',
|
||||
borderTopWidth: 'number',
|
||||
borderWidth: 'number',
|
||||
bottom: 'Dynamic',
|
||||
collapsable: 'boolean',
|
||||
display: 'String',
|
||||
elevation: 'number',
|
||||
end: 'Dynamic',
|
||||
flex: 'number',
|
||||
flexBasis: 'Dynamic',
|
||||
flexDirection: 'String',
|
||||
flexGrow: 'number',
|
||||
flexShrink: 'number',
|
||||
flexWrap: 'String',
|
||||
hasTVPreferredFocus: 'boolean',
|
||||
height: 'Dynamic',
|
||||
hitSlop: 'Map',
|
||||
importantForAccessibility: 'String',
|
||||
justifyContent: 'String',
|
||||
left: 'Dynamic',
|
||||
margin: 'Dynamic',
|
||||
marginBottom: 'Dynamic',
|
||||
marginEnd: 'Dynamic',
|
||||
marginHorizontal: 'Dynamic',
|
||||
marginLeft: 'Dynamic',
|
||||
marginRight: 'Dynamic',
|
||||
marginStart: 'Dynamic',
|
||||
marginTop: 'Dynamic',
|
||||
marginVertical: 'Dynamic',
|
||||
maxHeight: 'Dynamic',
|
||||
maxWidth: 'Dynamic',
|
||||
minHeight: 'Dynamic',
|
||||
minWidth: 'Dynamic',
|
||||
nativeBackgroundAndroid: 'Map',
|
||||
nativeForegroundAndroid: 'Map',
|
||||
nativeID: 'String',
|
||||
needsOffscreenAlphaCompositing: 'boolean',
|
||||
onLayout: 'boolean',
|
||||
opacity: 'number',
|
||||
overflow: 'String',
|
||||
padding: 'Dynamic',
|
||||
paddingBottom: 'Dynamic',
|
||||
paddingEnd: 'Dynamic',
|
||||
paddingHorizontal: 'Dynamic',
|
||||
paddingLeft: 'Dynamic',
|
||||
paddingRight: 'Dynamic',
|
||||
paddingStart: 'Dynamic',
|
||||
paddingTop: 'Dynamic',
|
||||
paddingVertical: 'Dynamic',
|
||||
pointerEvents: 'String',
|
||||
position: 'String',
|
||||
removeClippedSubviews: 'boolean',
|
||||
renderToHardwareTextureAndroid: 'boolean',
|
||||
right: 'Dynamic',
|
||||
rotation: 'number',
|
||||
scaleX: 'number',
|
||||
scaleY: 'number',
|
||||
start: 'Dynamic',
|
||||
testID: 'String',
|
||||
top: 'Dynamic',
|
||||
transform: 'Array',
|
||||
translateX: 'number',
|
||||
translateY: 'number',
|
||||
width: 'Dynamic',
|
||||
zIndex: 'number',
|
||||
},
|
||||
|
||||
uiViewClassName: 'RCTView',
|
||||
validAttributes: {
|
||||
accessibilityComponentType: true,
|
||||
accessibilityHint: true,
|
||||
accessibilityLabel: true,
|
||||
accessibilityLiveRegion: true,
|
||||
accessibilityRole: true,
|
||||
accessibilityStates: true,
|
||||
accessible: true,
|
||||
alignContent: true,
|
||||
alignItems: true,
|
||||
alignSelf: true,
|
||||
aspectRatio: true,
|
||||
backgroundColor: colorHandler,
|
||||
borderBottomColor: colorHandler,
|
||||
borderBottomEndRadius: true,
|
||||
borderBottomLeftRadius: true,
|
||||
borderBottomRightRadius: true,
|
||||
borderBottomStartRadius: true,
|
||||
borderBottomWidth: true,
|
||||
borderColor: colorHandler,
|
||||
borderEndColor: colorHandler,
|
||||
borderEndWidth: true,
|
||||
borderLeftColor: colorHandler,
|
||||
borderLeftWidth: true,
|
||||
borderRadius: true,
|
||||
borderRightColor: colorHandler,
|
||||
borderRightWidth: true,
|
||||
borderStartColor: colorHandler,
|
||||
borderStartWidth: true,
|
||||
borderStyle: true,
|
||||
borderTopColor: colorHandler,
|
||||
borderTopEndRadius: true,
|
||||
borderTopLeftRadius: true,
|
||||
borderTopRightRadius: true,
|
||||
borderTopStartRadius: true,
|
||||
borderTopWidth: true,
|
||||
borderWidth: true,
|
||||
bottom: true,
|
||||
collapsable: true,
|
||||
display: true,
|
||||
elevation: true,
|
||||
end: true,
|
||||
flex: true,
|
||||
flexBasis: true,
|
||||
flexDirection: true,
|
||||
flexGrow: true,
|
||||
flexShrink: true,
|
||||
flexWrap: true,
|
||||
hasTVPreferredFocus: true,
|
||||
height: true,
|
||||
hitSlop: true,
|
||||
importantForAccessibility: true,
|
||||
justifyContent: true,
|
||||
left: true,
|
||||
margin: true,
|
||||
marginBottom: true,
|
||||
marginEnd: true,
|
||||
marginHorizontal: true,
|
||||
marginLeft: true,
|
||||
marginRight: true,
|
||||
marginStart: true,
|
||||
marginTop: true,
|
||||
marginVertical: true,
|
||||
maxHeight: true,
|
||||
maxWidth: true,
|
||||
minHeight: true,
|
||||
minWidth: true,
|
||||
nativeBackgroundAndroid: true,
|
||||
nativeForegroundAndroid: true,
|
||||
nativeID: true,
|
||||
needsOffscreenAlphaCompositing: true,
|
||||
onLayout: true,
|
||||
opacity: true,
|
||||
overflow: true,
|
||||
padding: true,
|
||||
paddingBottom: true,
|
||||
paddingEnd: true,
|
||||
paddingHorizontal: true,
|
||||
paddingLeft: true,
|
||||
paddingRight: true,
|
||||
paddingStart: true,
|
||||
paddingTop: true,
|
||||
paddingVertical: true,
|
||||
pointerEvents: true,
|
||||
position: true,
|
||||
removeClippedSubviews: true,
|
||||
renderToHardwareTextureAndroid: true,
|
||||
right: true,
|
||||
rotation: true,
|
||||
scaleX: true,
|
||||
scaleY: true,
|
||||
start: true,
|
||||
testID: true,
|
||||
top: true,
|
||||
transform: true,
|
||||
translateX: true,
|
||||
translateY: true,
|
||||
width: true,
|
||||
zIndex: true,
|
||||
style: ReactNativeStyleAttributes,
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = ViewNativeComponentAndroidConfig;
|
||||
Reference in New Issue
Block a user