From 34427897f33b113536135913abd3576f440b1e5a Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Thu, 7 Mar 2019 10:50:34 -0800 Subject: [PATCH] [add] Support for Schema prop types View and Text forward Schema prop types to host DOM node. https://schema.org/docs/gs.html Fix #1247 --- .../src/exports/Text/TextPropTypes.js | 8 +++-- .../src/exports/View/ViewPropTypes.js | 36 ++++++++++++------- .../src/exports/View/filterSupportedProps.js | 3 ++ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/packages/react-native-web/src/exports/Text/TextPropTypes.js b/packages/react-native-web/src/exports/Text/TextPropTypes.js index 31d752ce..5c4df2f8 100644 --- a/packages/react-native-web/src/exports/Text/TextPropTypes.js +++ b/packages/react-native-web/src/exports/Text/TextPropTypes.js @@ -24,13 +24,17 @@ const TextPropTypes = { nativeID: string, numberOfLines: number, onBlur: func, - onContextMenu: func, onFocus: func, onLayout: func, onPress: func, selectable: bool, style: StyleSheetPropType(TextStylePropTypes), - testID: string + testID: string, + // web extensions + onContextMenu: func, + itemprop: string, + itemscope: string, + itemtype: string }; export default TextPropTypes; diff --git a/packages/react-native-web/src/exports/View/ViewPropTypes.js b/packages/react-native-web/src/exports/View/ViewPropTypes.js index 5683360b..fed0016b 100644 --- a/packages/react-native-web/src/exports/View/ViewPropTypes.js +++ b/packages/react-native-web/src/exports/View/ViewPropTypes.js @@ -43,7 +43,6 @@ export type ViewProps = { onBlur?: Function, onClick?: Function, onClickCapture?: Function, - onContextMenu?: Function, onFocus?: Function, onLayout?: (event: ViewLayoutEvent) => void, onResponderGrant?: Function, @@ -67,6 +66,11 @@ export type ViewProps = { pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto', style?: stylePropType, testID?: string, + // web extensions + onContextMenu?: Function, + itemprop?: string, + itemscope?: string, + itemtype?: string, // compatibility with React Native accessibilityViewIsModal?: boolean, collapsable?: boolean, @@ -84,17 +88,19 @@ const ViewPropTypes = { accessibilityLabel: string, accessibilityLiveRegion: oneOf(['assertive', 'none', 'polite']), accessibilityRole: string, - accessibilityStates: arrayOf(oneOf([ - 'disabled', - 'selected', - /* web-only */ - 'busy', - 'checked', - 'expanded', - 'grabbed', - 'invalid', - 'pressed' - ])), + accessibilityStates: arrayOf( + oneOf([ + 'disabled', + 'selected', + /* web-only */ + 'busy', + 'checked', + 'expanded', + 'grabbed', + 'invalid', + 'pressed' + ]) + ), accessibilityTraits: oneOfType([array, string]), accessible: bool, children: any, @@ -104,7 +110,6 @@ const ViewPropTypes = { onBlur: func, onClick: func, onClickCapture: func, - onContextMenu: func, onFocus: func, onLayout: func, onMoveShouldSetResponder: func, @@ -128,6 +133,11 @@ const ViewPropTypes = { pointerEvents: oneOf(['auto', 'box-none', 'box-only', 'none']), style: stylePropType, testID: string, + // web extensions + onContextMenu: func, + itemprop: string, + itemscope: string, + itemtype: string, // compatibility with React Native accessibilityViewIsModal: bool, collapsable: bool, diff --git a/packages/react-native-web/src/exports/View/filterSupportedProps.js b/packages/react-native-web/src/exports/View/filterSupportedProps.js index 5f5a763c..264658e2 100644 --- a/packages/react-native-web/src/exports/View/filterSupportedProps.js +++ b/packages/react-native-web/src/exports/View/filterSupportedProps.js @@ -58,6 +58,9 @@ const supportedProps = { // unstable escape-hatches for web className: true, href: true, + itemprop: true, + itemscope: true, + itemtype: true, onClick: true, onClickCapture: true, rel: true,