react-native/Libraries/Components/View/ViewNativeComponentAndroidC...

288 lines
7.7 KiB
JavaScript

/**
* 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;