From b620ccab49215ad85e3faada7d4a7fcd2570a0bc Mon Sep 17 00:00:00 2001 From: Eli White Date: Wed, 22 Aug 2018 18:22:00 -0700 Subject: [PATCH] Deprecate View prop-type definitions Summary: This diff moves the prop-type definitions for View out into it's own file. We will be able to do this with a bunch of the prop-type definitions and then move them out into a deprecated npm package. Reviewed By: yungsters Differential Revision: D9444394 fbshipit-source-id: 4fd0a78533211b598ba2da4eb5015ffcc20bb675 --- .../Components/CheckBox/CheckBox.android.js | 4 +- .../DrawerLayoutAndroid.android.js | 6 +- .../MaskedView/MaskedViewIOS.ios.js | 5 +- .../Components/Navigation/NavigatorIOS.ios.js | 6 +- Libraries/Components/Picker/Picker.js | 8 +- .../Picker/PickerAndroid.android.js | 4 +- .../ProgressViewIOS/ProgressViewIOS.ios.js | 6 +- .../SafeAreaView/SafeAreaView.ios.js | 5 +- .../SegmentedControlIOS.ios.js | 6 +- .../Components/TabBarIOS/TabBarIOS.ios.js | 8 +- .../Components/TabBarIOS/TabBarItemIOS.ios.js | 9 +- .../TextInput/InputAccessoryView.js | 4 +- Libraries/Components/TextInput/TextInput.js | 10 +- .../ToolbarAndroid/ToolbarAndroid.android.js | 8 +- .../Components/Touchable/TouchableBounce.js | 11 +- .../Touchable/TouchableHighlight.js | 8 +- .../View/DeprecatedViewPropTypes.js | 403 ++++++++++++++++++ Libraries/Components/View/ViewPropTypes.js | 399 +---------------- .../ViewPager/ViewPagerAndroid.android.js | 6 +- .../Components/WebView/WebView.android.js | 10 +- Libraries/Components/WebView/WebView.ios.js | 6 +- .../Experimental/IncrementalPresenter.js | 7 +- .../SwipeableQuickActionButton.js | 8 +- .../SwipeableRow/SwipeableQuickActions.js | 5 +- Libraries/Image/Image.android.js | 6 +- Libraries/RCTTest/SnapshotViewIOS.ios.js | 10 +- .../react-native-implementation.js | 2 +- 27 files changed, 491 insertions(+), 479 deletions(-) create mode 100644 Libraries/Components/View/DeprecatedViewPropTypes.js diff --git a/Libraries/Components/CheckBox/CheckBox.android.js b/Libraries/Components/CheckBox/CheckBox.android.js index 45a3e6f08..0f676252e 100644 --- a/Libraries/Components/CheckBox/CheckBox.android.js +++ b/Libraries/Components/CheckBox/CheckBox.android.js @@ -9,11 +9,11 @@ */ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const NativeMethodsMixin = require('NativeMethodsMixin'); const PropTypes = require('prop-types'); const React = require('React'); const StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); const createReactClass = require('create-react-class'); const requireNativeComponent = require('requireNativeComponent'); @@ -83,7 +83,7 @@ type DefaultProps = { let CheckBox = createReactClass({ displayName: 'CheckBox', propTypes: { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * The value of the checkbox. If true the checkbox will be turned on. * Default value is false. diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index d4b3fa9f7..6d3aed8c1 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -10,16 +10,16 @@ 'use strict'; const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); -const React = require('React'); const PropTypes = require('prop-types'); +const React = require('React'); const ReactNative = require('ReactNative'); const StatusBar = require('StatusBar'); const StyleSheet = require('StyleSheet'); const UIManager = require('UIManager'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); const DrawerConsts = UIManager.AndroidDrawerLayout.Constants; @@ -70,7 +70,7 @@ const DrawerLayoutAndroid = createReactClass({ }, propTypes: { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * Determines whether the keyboard gets dismissed in response to a drag. * - 'none' (the default), drags do not dismiss the keyboard. diff --git a/Libraries/Components/MaskedView/MaskedViewIOS.ios.js b/Libraries/Components/MaskedView/MaskedViewIOS.ios.js index c65822a64..42ff14678 100644 --- a/Libraries/Components/MaskedView/MaskedViewIOS.ios.js +++ b/Libraries/Components/MaskedView/MaskedViewIOS.ios.js @@ -8,11 +8,12 @@ * @flow */ +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const PropTypes = require('prop-types'); const React = require('React'); const StyleSheet = require('StyleSheet'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); + const requireNativeComponent = require('requireNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; @@ -68,7 +69,7 @@ type Props = { */ class MaskedViewIOS extends React.Component { static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, maskElement: PropTypes.element.isRequired, }; diff --git a/Libraries/Components/Navigation/NavigatorIOS.ios.js b/Libraries/Components/Navigation/NavigatorIOS.ios.js index 8f28d7914..539b41d4b 100644 --- a/Libraries/Components/Navigation/NavigatorIOS.ios.js +++ b/Libraries/Components/Navigation/NavigatorIOS.ios.js @@ -20,7 +20,7 @@ const StaticContainer = require('StaticContainer.react'); const StyleSheet = require('StyleSheet'); const TVEventHandler = require('TVEventHandler'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const createReactClass = require('create-react-class'); const invariant = require('fbjs/lib/invariant'); @@ -405,7 +405,7 @@ const NavigatorIOS = createReactClass({ /** * Styles for the navigation item containing the component. */ - wrapperStyle: ViewPropTypes.style, + wrapperStyle: DeprecatedViewPropTypes.style, /** * Boolean value that indicates whether the navigation bar is hidden. @@ -463,7 +463,7 @@ const NavigatorIOS = createReactClass({ * The default wrapper style for components in the navigator. * A common use case is to set the `backgroundColor` for every scene. */ - itemWrapperStyle: ViewPropTypes.style, + itemWrapperStyle: DeprecatedViewPropTypes.style, /** * The default color used for the buttons in the navigation bar. diff --git a/Libraries/Components/Picker/Picker.js b/Libraries/Components/Picker/Picker.js index 1e3e96579..215a33418 100644 --- a/Libraries/Components/Picker/Picker.js +++ b/Libraries/Components/Picker/Picker.js @@ -11,15 +11,15 @@ 'use strict'; const ColorPropType = require('ColorPropType'); -const PickerIOS = require('PickerIOS'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const PickerAndroid = require('PickerAndroid'); +const PickerIOS = require('PickerIOS'); const Platform = require('Platform'); -const React = require('React'); const PropTypes = require('prop-types'); +const React = require('React'); const StyleSheetPropType = require('StyleSheetPropType'); const TextStylePropTypes = require('TextStylePropTypes'); const UnimplementedView = require('UnimplementedView'); -const ViewPropTypes = require('ViewPropTypes'); const ViewStylePropTypes = require('ViewStylePropTypes'); const itemStylePropType = StyleSheetPropType(TextStylePropTypes); @@ -106,7 +106,7 @@ class Picker extends React.Component<{ // $FlowFixMe(>=0.41.0) static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, style: pickerStyleType, /** * Value matching value of one of the items. Can be a string or an integer. diff --git a/Libraries/Components/Picker/PickerAndroid.android.js b/Libraries/Components/Picker/PickerAndroid.android.js index 7066b942a..45819bd12 100644 --- a/Libraries/Components/Picker/PickerAndroid.android.js +++ b/Libraries/Components/Picker/PickerAndroid.android.js @@ -11,11 +11,11 @@ 'use strict'; const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const React = require('React'); const ReactPropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const StyleSheetPropType = require('StyleSheetPropType'); -const ViewPropTypes = require('ViewPropTypes'); const ViewStylePropTypes = require('ViewStylePropTypes'); const processColor = require('processColor'); @@ -52,7 +52,7 @@ class PickerAndroid extends React.Component< /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, style: pickerStyleType, selectedValue: ReactPropTypes.any, enabled: ReactPropTypes.bool, diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js index ea92fccb9..b87860d79 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js @@ -10,13 +10,13 @@ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const Image = require('Image'); const NativeMethodsMixin = require('NativeMethodsMixin'); +const PropTypes = require('prop-types'); const React = require('React'); const ReactNative = require('ReactNative'); -const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); const createReactClass = require('create-react-class'); const requireNativeComponent = require('requireNativeComponent'); @@ -45,7 +45,7 @@ const ProgressViewIOS = createReactClass({ mixins: [NativeMethodsMixin], propTypes: { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * The progress bar style. */ diff --git a/Libraries/Components/SafeAreaView/SafeAreaView.ios.js b/Libraries/Components/SafeAreaView/SafeAreaView.ios.js index 5fb0406b8..ccbd8b1db 100644 --- a/Libraries/Components/SafeAreaView/SafeAreaView.ios.js +++ b/Libraries/Components/SafeAreaView/SafeAreaView.ios.js @@ -8,8 +8,9 @@ * @format */ +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const React = require('React'); -const ViewPropTypes = require('ViewPropTypes'); + const requireNativeComponent = require('requireNativeComponent'); import type {ViewProps} from 'ViewPropTypes'; @@ -28,7 +29,7 @@ type Props = ViewProps & { */ class SafeAreaView extends React.Component { static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, }; render() { diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js index b4635f13f..5697b2f8e 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js @@ -10,12 +10,12 @@ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const NativeMethodsMixin = require('NativeMethodsMixin'); +const PropTypes = require('prop-types'); const React = require('React'); const ReactNative = require('ReactNative'); -const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); const createReactClass = require('create-react-class'); const requireNativeComponent = require('requireNativeComponent'); @@ -69,7 +69,7 @@ const SegmentedControlIOS = createReactClass({ mixins: [NativeMethodsMixin], propTypes: { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * The labels for the control's segment buttons, in order. */ diff --git a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js index 6cbe213f7..f86451c22 100644 --- a/Libraries/Components/TabBarIOS/TabBarIOS.ios.js +++ b/Libraries/Components/TabBarIOS/TabBarIOS.ios.js @@ -11,11 +11,11 @@ 'use strict'; const ColorPropType = require('ColorPropType'); -const React = require('React'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const PropTypes = require('prop-types'); +const React = require('React'); const StyleSheet = require('StyleSheet'); const TabBarItemIOS = require('TabBarItemIOS'); -const ViewPropTypes = require('ViewPropTypes'); const requireNativeComponent = require('requireNativeComponent'); @@ -41,8 +41,8 @@ class TabBarIOS extends React.Component { static Item = TabBarItemIOS; static propTypes = { - ...ViewPropTypes, - style: ViewPropTypes.style, + ...DeprecatedViewPropTypes, + style: DeprecatedViewPropTypes.style, /** * Color of text on unselected tabs */ diff --git a/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js b/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js index b8825977a..da5c5ac9f 100644 --- a/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js +++ b/Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js @@ -11,20 +11,19 @@ 'use strict'; const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const Image = require('Image'); -const React = require('React'); const PropTypes = require('prop-types'); +const React = require('React'); const StaticContainer = require('StaticContainer.react'); const StyleSheet = require('StyleSheet'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); - const requireNativeComponent = require('requireNativeComponent'); class TabBarItemIOS extends React.Component { static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * Little red bubble that sits at the top right of the icon. */ @@ -79,7 +78,7 @@ class TabBarItemIOS extends React.Component { /** * React style object. */ - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, /** * Text that appears under the icon. It is ignored when a system icon * is defined. diff --git a/Libraries/Components/TextInput/InputAccessoryView.js b/Libraries/Components/TextInput/InputAccessoryView.js index 731476bc7..177a8287a 100644 --- a/Libraries/Components/TextInput/InputAccessoryView.js +++ b/Libraries/Components/TextInput/InputAccessoryView.js @@ -10,9 +10,9 @@ 'use strict'; const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const React = require('React'); const StyleSheet = require('StyleSheet'); -const ViewPropTypes = require('ViewPropTypes'); const requireNativeComponent = require('requireNativeComponent'); @@ -83,7 +83,7 @@ type Props = { * specified TextInput(s). */ nativeID?: string, - style?: ViewPropTypes.style, + style?: DeprecatedViewPropTypes.style, backgroundColor?: ColorPropType, }; diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index c1ddc8b3e..1257467c3 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -10,13 +10,13 @@ 'use strict'; const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const DocumentSelectionState = require('DocumentSelectionState'); const EventEmitter = require('EventEmitter'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); -const React = require('React'); -const createReactClass = require('create-react-class'); const PropTypes = require('prop-types'); +const React = require('React'); const ReactNative = require('ReactNative'); const StyleSheet = require('StyleSheet'); const Text = require('Text'); @@ -25,15 +25,15 @@ const TextInputState = require('TextInputState'); const TimerMixin = require('react-timer-mixin'); const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); const UIManager = require('UIManager'); -const ViewPropTypes = require('ViewPropTypes'); +const createReactClass = require('create-react-class'); const emptyFunction = require('fbjs/lib/emptyFunction'); const invariant = require('fbjs/lib/invariant'); const requireNativeComponent = require('requireNativeComponent'); const warning = require('fbjs/lib/warning'); -import type {ColorValue} from 'StyleSheetTypes'; import type {TextStyleProp, ViewStyleProp} from 'StyleSheet'; +import type {ColorValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; let AndroidTextInput; @@ -332,7 +332,7 @@ const TextInput = createReactClass({ }, }, propTypes: { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * Can tell `TextInput` to automatically capitalize certain characters. * diff --git a/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js b/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js index 44bcfc03d..32b5701d3 100644 --- a/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js +++ b/Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js @@ -9,13 +9,13 @@ 'use strict'; +const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const Image = require('Image'); const NativeMethodsMixin = require('NativeMethodsMixin'); -const React = require('React'); const PropTypes = require('prop-types'); +const React = require('React'); const UIManager = require('UIManager'); -const ViewPropTypes = require('ViewPropTypes'); -const ColorPropType = require('ColorPropType'); const createReactClass = require('create-react-class'); const requireNativeComponent = require('requireNativeComponent'); @@ -68,7 +68,7 @@ const ToolbarAndroid = createReactClass({ mixins: [NativeMethodsMixin], propTypes: { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * Sets possible actions on the toolbar as part of the action menu. These are displayed as icons * or text on the right side of the widget. If they don't fit they are placed in an 'overflow' diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index ce47db20c..9a313edc1 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -10,18 +10,19 @@ 'use strict'; const Animated = require('Animated'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const EdgeInsetsPropType = require('EdgeInsetsPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); -const React = require('React'); -const createReactClass = require('create-react-class'); const PropTypes = require('prop-types'); +const React = require('React'); const Touchable = require('Touchable'); const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); -const ViewPropTypes = require('ViewPropTypes'); + +const createReactClass = require('create-react-class'); import type {EdgeInsetsProp} from 'EdgeInsetsPropType'; -import type {Props as TouchableWithoutFeedbackProps} from 'TouchableWithoutFeedback'; import type {ViewStyleProp} from 'StyleSheet'; +import type {Props as TouchableWithoutFeedbackProps} from 'TouchableWithoutFeedback'; type Event = Object; @@ -76,7 +77,7 @@ const TouchableBounce = ((createReactClass({ * Style to apply to the container/underlay. Most commonly used to make sure * rounded corners match the wrapped component. */ - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, }, getDefaultProps: function() { diff --git a/Libraries/Components/Touchable/TouchableHighlight.js b/Libraries/Components/Touchable/TouchableHighlight.js index fd178341a..aaeedea20 100644 --- a/Libraries/Components/Touchable/TouchableHighlight.js +++ b/Libraries/Components/Touchable/TouchableHighlight.js @@ -10,24 +10,24 @@ 'use strict'; const ColorPropType = require('ColorPropType'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const NativeMethodsMixin = require('NativeMethodsMixin'); -const PropTypes = require('prop-types'); const Platform = require('Platform'); +const PropTypes = require('prop-types'); const React = require('React'); const ReactNativeViewAttributes = require('ReactNativeViewAttributes'); const StyleSheet = require('StyleSheet'); const Touchable = require('Touchable'); const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); const createReactClass = require('create-react-class'); const ensurePositiveDelayProps = require('ensurePositiveDelayProps'); import type {PressEvent} from 'CoreEventTypes'; -import type {Props as TouchableWithoutFeedbackProps} from 'TouchableWithoutFeedback'; import type {ViewStyleProp} from 'StyleSheet'; import type {ColorValue} from 'StyleSheetTypes'; +import type {Props as TouchableWithoutFeedbackProps} from 'TouchableWithoutFeedback'; const DEFAULT_PROPS = { activeOpacity: 0.85, @@ -169,7 +169,7 @@ const TouchableHighlight = ((createReactClass({ * Style to apply to the container/underlay. Most commonly used to make sure * rounded corners match the wrapped component. */ - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, /** * Called immediately after the underlay is shown */ diff --git a/Libraries/Components/View/DeprecatedViewPropTypes.js b/Libraries/Components/View/DeprecatedViewPropTypes.js new file mode 100644 index 000000000..cd7060821 --- /dev/null +++ b/Libraries/Components/View/DeprecatedViewPropTypes.js @@ -0,0 +1,403 @@ +/** + * 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 EdgeInsetsPropType = require('EdgeInsetsPropType'); +const PlatformViewPropTypes = require('PlatformViewPropTypes'); +const PropTypes = require('prop-types'); +const StyleSheetPropType = require('StyleSheetPropType'); +const ViewStylePropTypes = require('ViewStylePropTypes'); + +const { + AccessibilityComponentTypes, + AccessibilityTraits, + AccessibilityRoles, + AccessibilityStates, +} = require('ViewAccessibility'); + +const stylePropType = StyleSheetPropType(ViewStylePropTypes); + +module.exports = { + /** + * When `true`, indicates that the view is an accessibility element. + * By default, all the touchable elements are accessible. + * + * See http://facebook.github.io/react-native/docs/view.html#accessible + */ + accessible: PropTypes.bool, + + /** + * Overrides the text that's read by the screen reader when the user interacts + * with the element. By default, the label is constructed by traversing all + * the children and accumulating all the `Text` nodes separated by space. + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilitylabel + */ + accessibilityLabel: PropTypes.node, + + /** + * An accessibility hint helps users understand what will happen when they perform + * an action on the accessibility element when that result is not obvious from the + * accessibility label. + * + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilityHint + */ + accessibilityHint: PropTypes.string, + + /** + * Provides an array of custom actions available for accessibility. + * + * @platform ios + */ + accessibilityActions: PropTypes.arrayOf(PropTypes.string), + + /** + * Prevents view from being inverted if set to true and color inversion is turned on. + * + * @platform ios + */ + accessibilityIgnoresInvertColors: PropTypes.bool, + + /** + * Indicates to accessibility services to treat UI component like a + * native one. Works for Android only. + * + * @platform android + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilitycomponenttype + */ + accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentTypes), + + /** + * Indicates to accessibility services to treat UI component like a specific role. + */ + accessibilityRole: PropTypes.oneOf(AccessibilityRoles), + + /** + * Indicates to accessibility services that UI Component is in a specific State. + */ + accessibilityStates: PropTypes.arrayOf(PropTypes.oneOf(AccessibilityStates)), + /** + * Indicates to accessibility services whether the user should be notified + * when this view changes. Works for Android API >= 19 only. + * + * @platform android + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilityliveregion + */ + accessibilityLiveRegion: PropTypes.oneOf(['none', 'polite', 'assertive']), + + /** + * Controls how view is important for accessibility which is if it + * fires accessibility events and if it is reported to accessibility services + * that query the screen. Works for Android only. + * + * @platform android + * + * See http://facebook.github.io/react-native/docs/view.html#importantforaccessibility + */ + importantForAccessibility: PropTypes.oneOf([ + 'auto', + 'yes', + 'no', + 'no-hide-descendants', + ]), + + /** + * Provides additional traits to screen reader. By default no traits are + * provided unless specified otherwise in element. + * + * You can provide one trait or an array of many traits. + * + * @platform ios + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilitytraits + */ + accessibilityTraits: PropTypes.oneOfType([ + PropTypes.oneOf(AccessibilityTraits), + PropTypes.arrayOf(PropTypes.oneOf(AccessibilityTraits)), + ]), + + /** + * A value indicating whether VoiceOver should ignore the elements + * within views that are siblings of the receiver. + * Default is `false`. + * + * @platform ios + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilityviewismodal + */ + accessibilityViewIsModal: PropTypes.bool, + + /** + * A value indicating whether the accessibility elements contained within + * this accessibility element are hidden. + * + * @platform ios + * + * See http://facebook.github.io/react-native/docs/view.html#accessibilityElementsHidden + */ + accessibilityElementsHidden: PropTypes.bool, + + /** + * When `accessible` is true, the system will try to invoke this function + * when the user performs an accessibility custom action. + * + * @platform ios + */ + onAccessibilityAction: PropTypes.func, + + /** + * When `accessible` is true, the system will try to invoke this function + * when the user performs accessibility tap gesture. + * + * See http://facebook.github.io/react-native/docs/view.html#onaccessibilitytap + */ + onAccessibilityTap: PropTypes.func, + + /** + * When `accessible` is `true`, the system will invoke this function when the + * user performs the magic tap gesture. + * + * See http://facebook.github.io/react-native/docs/view.html#onmagictap + */ + onMagicTap: PropTypes.func, + + /** + * Used to locate this view in end-to-end tests. + * + * > This disables the 'layout-only view removal' optimization for this view! + * + * See http://facebook.github.io/react-native/docs/view.html#testid + */ + testID: PropTypes.string, + + /** + * Used to locate this view from native classes. + * + * > This disables the 'layout-only view removal' optimization for this view! + * + * See http://facebook.github.io/react-native/docs/view.html#nativeid + */ + nativeID: PropTypes.string, + + /** + * For most touch interactions, you'll simply want to wrap your component in + * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, + * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. + */ + + /** + * The View is now responding for touch events. This is the time to highlight + * and show the user what is happening. + * + * `View.props.onResponderGrant: (event) => {}`, where `event` is a synthetic + * touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onrespondergrant + */ + onResponderGrant: PropTypes.func, + + /** + * The user is moving their finger. + * + * `View.props.onResponderMove: (event) => {}`, where `event` is a synthetic + * touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onrespondermove + */ + onResponderMove: PropTypes.func, + + /** + * Another responder is already active and will not release it to that `View` + * asking to be the responder. + * + * `View.props.onResponderReject: (event) => {}`, where `event` is a + * synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onresponderreject + */ + onResponderReject: PropTypes.func, + + /** + * Fired at the end of the touch. + * + * `View.props.onResponderRelease: (event) => {}`, where `event` is a + * synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onresponderrelease + */ + onResponderRelease: PropTypes.func, + + /** + * The responder has been taken from the `View`. Might be taken by other + * views after a call to `onResponderTerminationRequest`, or might be taken + * by the OS without asking (e.g., happens with control center/ notification + * center on iOS) + * + * `View.props.onResponderTerminate: (event) => {}`, where `event` is a + * synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onresponderterminate + */ + onResponderTerminate: PropTypes.func, + + /** + * Some other `View` wants to become responder and is asking this `View` to + * release its responder. Returning `true` allows its release. + * + * `View.props.onResponderTerminationRequest: (event) => {}`, where `event` + * is a synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onresponderterminationrequest + */ + onResponderTerminationRequest: PropTypes.func, + + /** + * Does this view want to become responder on the start of a touch? + * + * `View.props.onStartShouldSetResponder: (event) => [true | false]`, where + * `event` is a synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onstartshouldsetresponder + */ + onStartShouldSetResponder: PropTypes.func, + + /** + * If a parent `View` wants to prevent a child `View` from becoming responder + * on a touch start, it should have this handler which returns `true`. + * + * `View.props.onStartShouldSetResponderCapture: (event) => [true | false]`, + * where `event` is a synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onstartshouldsetrespondercapture + */ + onStartShouldSetResponderCapture: PropTypes.func, + + /** + * Does this view want to "claim" touch responsiveness? This is called for + * every touch move on the `View` when it is not the responder. + * + * `View.props.onMoveShouldSetResponder: (event) => [true | false]`, where + * `event` is a synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onmoveshouldsetresponder + */ + onMoveShouldSetResponder: PropTypes.func, + + /** + * If a parent `View` wants to prevent a child `View` from becoming responder + * on a move, it should have this handler which returns `true`. + * + * `View.props.onMoveShouldSetResponderCapture: (event) => [true | false]`, + * where `event` is a synthetic touch event as described above. + * + * See http://facebook.github.io/react-native/docs/view.html#onMoveShouldsetrespondercapture + */ + onMoveShouldSetResponderCapture: PropTypes.func, + + /** + * This defines how far a touch event can start away from the view. + * Typical interface guidelines recommend touch targets that are at least + * 30 - 40 points/density-independent pixels. + * + * > The touch area never extends past the parent view bounds and the Z-index + * > of sibling views always takes precedence if a touch hits two overlapping + * > views. + * + * See http://facebook.github.io/react-native/docs/view.html#hitslop + */ + hitSlop: EdgeInsetsPropType, + + /** + * Invoked on mount and layout changes with: + * + * `{nativeEvent: { layout: {x, y, width, height}}}` + * + * This event is fired immediately once the layout has been calculated, but + * the new layout may not yet be reflected on the screen at the time the + * event is received, especially if a layout animation is in progress. + * + * See http://facebook.github.io/react-native/docs/view.html#onlayout + */ + onLayout: PropTypes.func, + + /** + * Controls whether the `View` can be the target of touch events. + * + * See http://facebook.github.io/react-native/docs/view.html#pointerevents + */ + pointerEvents: PropTypes.oneOf(['box-none', 'none', 'box-only', 'auto']), + + /** + * See http://facebook.github.io/react-native/docs/style.html + */ + style: stylePropType, + + /** + * This is a special performance property exposed by `RCTView` and is useful + * for scrolling content when there are many subviews, most of which are + * offscreen. For this property to be effective, it must be applied to a + * view that contains many subviews that extend outside its bound. The + * subviews must also have `overflow: hidden`, as should the containing view + * (or one of its superviews). + * + * See http://facebook.github.io/react-native/docs/view.html#removeclippedsubviews + */ + removeClippedSubviews: PropTypes.bool, + + /** + * Whether this `View` should render itself (and all of its children) into a + * single hardware texture on the GPU. + * + * @platform android + * + * See http://facebook.github.io/react-native/docs/view.html#rendertohardwaretextureandroid + */ + renderToHardwareTextureAndroid: PropTypes.bool, + + /** + * Whether this `View` should be rendered as a bitmap before compositing. + * + * @platform ios + * + * See http://facebook.github.io/react-native/docs/view.html#shouldrasterizeios + */ + shouldRasterizeIOS: PropTypes.bool, + + /** + * Views that are only used to layout their children or otherwise don't draw + * anything may be automatically removed from the native hierarchy as an + * optimization. Set this property to `false` to disable this optimization and + * ensure that this `View` exists in the native view hierarchy. + * + * @platform android + * + * See http://facebook.github.io/react-native/docs/view.html#collapsable + */ + collapsable: PropTypes.bool, + + /** + * Whether this `View` needs to rendered offscreen and composited with an + * alpha in order to preserve 100% correct colors and blending behavior. + * + * @platform android + * + * See http://facebook.github.io/react-native/docs/view.html#needsoffscreenalphacompositing + */ + needsOffscreenAlphaCompositing: PropTypes.bool, + + /** + * Any additional platform-specific view prop types, or prop type overrides. + */ + ...PlatformViewPropTypes, +}; diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 4b901d9fc..7afcee505 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -11,31 +11,17 @@ 'use strict'; const React = require('React'); -const EdgeInsetsPropType = require('EdgeInsetsPropType'); -const PlatformViewPropTypes = require('PlatformViewPropTypes'); -const PropTypes = require('prop-types'); -const StyleSheetPropType = require('StyleSheetPropType'); -const ViewStylePropTypes = require('ViewStylePropTypes'); - -const { - AccessibilityComponentTypes, - AccessibilityTraits, - AccessibilityRoles, - AccessibilityStates, -} = require('ViewAccessibility'); +import type {Layout, LayoutEvent} from 'CoreEventTypes'; +import type {EdgeInsetsProp} from 'EdgeInsetsPropType'; +import type {ViewStyleProp} from 'StyleSheet'; +import type {TVViewProps} from 'TVViewPropTypes'; import type { AccessibilityComponentType, AccessibilityTrait, AccessibilityRole, AccessibilityState, } from 'ViewAccessibility'; -import type {EdgeInsetsProp} from 'EdgeInsetsPropType'; -import type {TVViewProps} from 'TVViewPropTypes'; -import type {Layout, LayoutEvent} from 'CoreEventTypes'; -import type {ViewStyleProp} from 'StyleSheet'; - -const stylePropType = StyleSheetPropType(ViewStylePropTypes); export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; @@ -128,380 +114,3 @@ export type ViewProps = $ReadOnly<{| collapsable?: boolean, needsOffscreenAlphaCompositing?: boolean, |}>; - -module.exports = { - /** - * When `true`, indicates that the view is an accessibility element. - * By default, all the touchable elements are accessible. - * - * See http://facebook.github.io/react-native/docs/view.html#accessible - */ - accessible: PropTypes.bool, - - /** - * Overrides the text that's read by the screen reader when the user interacts - * with the element. By default, the label is constructed by traversing all - * the children and accumulating all the `Text` nodes separated by space. - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilitylabel - */ - accessibilityLabel: PropTypes.node, - - /** - * An accessibility hint helps users understand what will happen when they perform - * an action on the accessibility element when that result is not obvious from the - * accessibility label. - * - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilityHint - */ - accessibilityHint: PropTypes.string, - - /** - * Provides an array of custom actions available for accessibility. - * - * @platform ios - */ - accessibilityActions: PropTypes.arrayOf(PropTypes.string), - - /** - * Prevents view from being inverted if set to true and color inversion is turned on. - * - * @platform ios - */ - accessibilityIgnoresInvertColors: PropTypes.bool, - - /** - * Indicates to accessibility services to treat UI component like a - * native one. Works for Android only. - * - * @platform android - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilitycomponenttype - */ - accessibilityComponentType: PropTypes.oneOf(AccessibilityComponentTypes), - - /** - * Indicates to accessibility services to treat UI component like a specific role. - */ - accessibilityRole: PropTypes.oneOf(AccessibilityRoles), - - /** - * Indicates to accessibility services that UI Component is in a specific State. - */ - accessibilityStates: PropTypes.arrayOf(PropTypes.oneOf(AccessibilityStates)), - /** - * Indicates to accessibility services whether the user should be notified - * when this view changes. Works for Android API >= 19 only. - * - * @platform android - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilityliveregion - */ - accessibilityLiveRegion: PropTypes.oneOf(['none', 'polite', 'assertive']), - - /** - * Controls how view is important for accessibility which is if it - * fires accessibility events and if it is reported to accessibility services - * that query the screen. Works for Android only. - * - * @platform android - * - * See http://facebook.github.io/react-native/docs/view.html#importantforaccessibility - */ - importantForAccessibility: PropTypes.oneOf([ - 'auto', - 'yes', - 'no', - 'no-hide-descendants', - ]), - - /** - * Provides additional traits to screen reader. By default no traits are - * provided unless specified otherwise in element. - * - * You can provide one trait or an array of many traits. - * - * @platform ios - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilitytraits - */ - accessibilityTraits: PropTypes.oneOfType([ - PropTypes.oneOf(AccessibilityTraits), - PropTypes.arrayOf(PropTypes.oneOf(AccessibilityTraits)), - ]), - - /** - * A value indicating whether VoiceOver should ignore the elements - * within views that are siblings of the receiver. - * Default is `false`. - * - * @platform ios - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilityviewismodal - */ - accessibilityViewIsModal: PropTypes.bool, - - /** - * A value indicating whether the accessibility elements contained within - * this accessibility element are hidden. - * - * @platform ios - * - * See http://facebook.github.io/react-native/docs/view.html#accessibilityElementsHidden - */ - accessibilityElementsHidden: PropTypes.bool, - - /** - * When `accessible` is true, the system will try to invoke this function - * when the user performs an accessibility custom action. - * - * @platform ios - */ - onAccessibilityAction: PropTypes.func, - - /** - * When `accessible` is true, the system will try to invoke this function - * when the user performs accessibility tap gesture. - * - * See http://facebook.github.io/react-native/docs/view.html#onaccessibilitytap - */ - onAccessibilityTap: PropTypes.func, - - /** - * When `accessible` is `true`, the system will invoke this function when the - * user performs the magic tap gesture. - * - * See http://facebook.github.io/react-native/docs/view.html#onmagictap - */ - onMagicTap: PropTypes.func, - - /** - * Used to locate this view in end-to-end tests. - * - * > This disables the 'layout-only view removal' optimization for this view! - * - * See http://facebook.github.io/react-native/docs/view.html#testid - */ - testID: PropTypes.string, - - /** - * Used to locate this view from native classes. - * - * > This disables the 'layout-only view removal' optimization for this view! - * - * See http://facebook.github.io/react-native/docs/view.html#nativeid - */ - nativeID: PropTypes.string, - - /** - * For most touch interactions, you'll simply want to wrap your component in - * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, - * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. - */ - - /** - * The View is now responding for touch events. This is the time to highlight - * and show the user what is happening. - * - * `View.props.onResponderGrant: (event) => {}`, where `event` is a synthetic - * touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onrespondergrant - */ - onResponderGrant: PropTypes.func, - - /** - * The user is moving their finger. - * - * `View.props.onResponderMove: (event) => {}`, where `event` is a synthetic - * touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onrespondermove - */ - onResponderMove: PropTypes.func, - - /** - * Another responder is already active and will not release it to that `View` - * asking to be the responder. - * - * `View.props.onResponderReject: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onresponderreject - */ - onResponderReject: PropTypes.func, - - /** - * Fired at the end of the touch. - * - * `View.props.onResponderRelease: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onresponderrelease - */ - onResponderRelease: PropTypes.func, - - /** - * The responder has been taken from the `View`. Might be taken by other - * views after a call to `onResponderTerminationRequest`, or might be taken - * by the OS without asking (e.g., happens with control center/ notification - * center on iOS) - * - * `View.props.onResponderTerminate: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onresponderterminate - */ - onResponderTerminate: PropTypes.func, - - /** - * Some other `View` wants to become responder and is asking this `View` to - * release its responder. Returning `true` allows its release. - * - * `View.props.onResponderTerminationRequest: (event) => {}`, where `event` - * is a synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onresponderterminationrequest - */ - onResponderTerminationRequest: PropTypes.func, - - /** - * Does this view want to become responder on the start of a touch? - * - * `View.props.onStartShouldSetResponder: (event) => [true | false]`, where - * `event` is a synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onstartshouldsetresponder - */ - onStartShouldSetResponder: PropTypes.func, - - /** - * If a parent `View` wants to prevent a child `View` from becoming responder - * on a touch start, it should have this handler which returns `true`. - * - * `View.props.onStartShouldSetResponderCapture: (event) => [true | false]`, - * where `event` is a synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onstartshouldsetrespondercapture - */ - onStartShouldSetResponderCapture: PropTypes.func, - - /** - * Does this view want to "claim" touch responsiveness? This is called for - * every touch move on the `View` when it is not the responder. - * - * `View.props.onMoveShouldSetResponder: (event) => [true | false]`, where - * `event` is a synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onmoveshouldsetresponder - */ - onMoveShouldSetResponder: PropTypes.func, - - /** - * If a parent `View` wants to prevent a child `View` from becoming responder - * on a move, it should have this handler which returns `true`. - * - * `View.props.onMoveShouldSetResponderCapture: (event) => [true | false]`, - * where `event` is a synthetic touch event as described above. - * - * See http://facebook.github.io/react-native/docs/view.html#onMoveShouldsetrespondercapture - */ - onMoveShouldSetResponderCapture: PropTypes.func, - - /** - * This defines how far a touch event can start away from the view. - * Typical interface guidelines recommend touch targets that are at least - * 30 - 40 points/density-independent pixels. - * - * > The touch area never extends past the parent view bounds and the Z-index - * > of sibling views always takes precedence if a touch hits two overlapping - * > views. - * - * See http://facebook.github.io/react-native/docs/view.html#hitslop - */ - hitSlop: EdgeInsetsPropType, - - /** - * Invoked on mount and layout changes with: - * - * `{nativeEvent: { layout: {x, y, width, height}}}` - * - * This event is fired immediately once the layout has been calculated, but - * the new layout may not yet be reflected on the screen at the time the - * event is received, especially if a layout animation is in progress. - * - * See http://facebook.github.io/react-native/docs/view.html#onlayout - */ - onLayout: PropTypes.func, - - /** - * Controls whether the `View` can be the target of touch events. - * - * See http://facebook.github.io/react-native/docs/view.html#pointerevents - */ - pointerEvents: PropTypes.oneOf(['box-none', 'none', 'box-only', 'auto']), - - /** - * See http://facebook.github.io/react-native/docs/style.html - */ - style: stylePropType, - - /** - * This is a special performance property exposed by `RCTView` and is useful - * for scrolling content when there are many subviews, most of which are - * offscreen. For this property to be effective, it must be applied to a - * view that contains many subviews that extend outside its bound. The - * subviews must also have `overflow: hidden`, as should the containing view - * (or one of its superviews). - * - * See http://facebook.github.io/react-native/docs/view.html#removeclippedsubviews - */ - removeClippedSubviews: PropTypes.bool, - - /** - * Whether this `View` should render itself (and all of its children) into a - * single hardware texture on the GPU. - * - * @platform android - * - * See http://facebook.github.io/react-native/docs/view.html#rendertohardwaretextureandroid - */ - renderToHardwareTextureAndroid: PropTypes.bool, - - /** - * Whether this `View` should be rendered as a bitmap before compositing. - * - * @platform ios - * - * See http://facebook.github.io/react-native/docs/view.html#shouldrasterizeios - */ - shouldRasterizeIOS: PropTypes.bool, - - /** - * Views that are only used to layout their children or otherwise don't draw - * anything may be automatically removed from the native hierarchy as an - * optimization. Set this property to `false` to disable this optimization and - * ensure that this `View` exists in the native view hierarchy. - * - * @platform android - * - * See http://facebook.github.io/react-native/docs/view.html#collapsable - */ - collapsable: PropTypes.bool, - - /** - * Whether this `View` needs to rendered offscreen and composited with an - * alpha in order to preserve 100% correct colors and blending behavior. - * - * @platform android - * - * See http://facebook.github.io/react-native/docs/view.html#needsoffscreenalphacompositing - */ - needsOffscreenAlphaCompositing: PropTypes.bool, - - /** - * Any additional platform-specific view prop types, or prop type overrides. - */ - ...PlatformViewPropTypes, -}; diff --git a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js index 2b69a2777..38acd378b 100644 --- a/Libraries/Components/ViewPager/ViewPagerAndroid.android.js +++ b/Libraries/Components/ViewPager/ViewPagerAndroid.android.js @@ -10,11 +10,11 @@ 'use strict'; -const React = require('React'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const PropTypes = require('prop-types'); +const React = require('React'); const ReactNative = require('ReactNative'); const UIManager = require('UIManager'); -const ViewPropTypes = require('ViewPropTypes'); const dismissKeyboard = require('dismissKeyboard'); const requireNativeComponent = require('requireNativeComponent'); @@ -85,7 +85,7 @@ class ViewPagerAndroid extends React.Component<{ /* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found * when making Flow check .android.js files. */ static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, /** * Index of initial page that should be selected. Use `setPage` method to * update the page, and `onPageSelected` to monitor page changes diff --git a/Libraries/Components/WebView/WebView.android.js b/Libraries/Components/WebView/WebView.android.js index bed217973..d67e7973f 100644 --- a/Libraries/Components/WebView/WebView.android.js +++ b/Libraries/Components/WebView/WebView.android.js @@ -9,15 +9,15 @@ 'use strict'; -const EdgeInsetsPropType = require('EdgeInsetsPropType'); const ActivityIndicator = require('ActivityIndicator'); -const React = require('React'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); +const EdgeInsetsPropType = require('EdgeInsetsPropType'); const PropTypes = require('prop-types'); +const React = require('React'); const ReactNative = require('ReactNative'); const StyleSheet = require('StyleSheet'); const UIManager = require('UIManager'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); const WebViewShared = require('WebViewShared'); const deprecatedPropType = require('deprecatedPropType'); @@ -44,7 +44,7 @@ const defaultRenderLoading = () => ( */ class WebView extends React.Component { static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, renderError: PropTypes.func, renderLoading: PropTypes.func, onLoad: PropTypes.func, @@ -57,7 +57,7 @@ class WebView extends React.Component { onMessage: PropTypes.func, onContentSizeChange: PropTypes.func, startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, html: deprecatedPropType( PropTypes.string, diff --git a/Libraries/Components/WebView/WebView.ios.js b/Libraries/Components/WebView/WebView.ios.js index 329dd2027..0ff52176f 100644 --- a/Libraries/Components/WebView/WebView.ios.js +++ b/Libraries/Components/WebView/WebView.ios.js @@ -11,6 +11,7 @@ 'use strict'; const ActivityIndicator = require('ActivityIndicator'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const EdgeInsetsPropType = require('EdgeInsetsPropType'); const Linking = require('Linking'); const PropTypes = require('prop-types'); @@ -21,7 +22,6 @@ const StyleSheet = require('StyleSheet'); const Text = require('Text'); const UIManager = require('UIManager'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); const WebViewShared = require('WebViewShared'); const deprecatedPropType = require('deprecatedPropType'); @@ -114,7 +114,7 @@ class WebView extends React.Component { static JSNavigationScheme = JSNavigationScheme; static NavigationType = NavigationType; static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, html: deprecatedPropType( PropTypes.string, @@ -257,7 +257,7 @@ class WebView extends React.Component { /** * The style to apply to the `WebView`. */ - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, /** * Determines the types of data converted to clickable URLs in the web view's content. diff --git a/Libraries/Experimental/IncrementalPresenter.js b/Libraries/Experimental/IncrementalPresenter.js index 9f2c9a511..999adbf01 100644 --- a/Libraries/Experimental/IncrementalPresenter.js +++ b/Libraries/Experimental/IncrementalPresenter.js @@ -10,13 +10,12 @@ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const IncrementalGroup = require('IncrementalGroup'); -const React = require('React'); const PropTypes = require('prop-types'); +const React = require('React'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); - import type {Context} from 'Incremental'; import type {ViewStyleProp} from 'StyleSheet'; @@ -49,7 +48,7 @@ class IncrementalPresenter extends React.Component { disabled: PropTypes.bool, onDone: PropTypes.func, onLayout: PropTypes.func, - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, }; static contextTypes = { incrementalGroup: PropTypes.object, diff --git a/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js b/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js index e0ea2ce8c..c8690c6d9 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableQuickActionButton.js @@ -10,12 +10,12 @@ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const Image = require('Image'); const React = require('React'); const Text = require('Text'); const TouchableHighlight = require('TouchableHighlight'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); import type {ImageSource} from 'ImageSource'; @@ -27,13 +27,13 @@ import type {ImageSource} from 'ImageSource'; class SwipeableQuickActionButton extends React.Component<{ accessibilityLabel?: string, imageSource?: ?(ImageSource | number), - imageStyle?: ?ViewPropTypes.style, + imageStyle?: ?DeprecatedViewPropTypes.style, mainView?: ?React.Node, onPress?: Function, - style?: ?ViewPropTypes.style, + style?: ?DeprecatedViewPropTypes.style, testID?: string, text?: ?(string | Object | Array), - textStyle?: ?ViewPropTypes.style, + textStyle?: ?DeprecatedViewPropTypes.style, }> { render(): React.Node { if (!this.props.imageSource && !this.props.text && !this.props.mainView) { diff --git a/Libraries/Experimental/SwipeableRow/SwipeableQuickActions.js b/Libraries/Experimental/SwipeableRow/SwipeableQuickActions.js index 8178770c8..55c19f53a 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableQuickActions.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableQuickActions.js @@ -10,12 +10,11 @@ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const React = require('React'); const StyleSheet = require('StyleSheet'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); - /** * A thin wrapper around standard quick action buttons that can, if the user * chooses, be used with SwipeableListView. Sample usage is as follows, in the @@ -28,7 +27,7 @@ const ViewPropTypes = require('ViewPropTypes'); */ class SwipeableQuickActions extends React.Component<{style?: $FlowFixMe}> { static propTypes = { - style: ViewPropTypes.style, + style: DeprecatedViewPropTypes.style, }; render(): React.Node { diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index 0058b210d..a97a28836 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -10,15 +10,15 @@ 'use strict'; +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const ImageStylePropTypes = require('ImageStylePropTypes'); const NativeModules = require('NativeModules'); +const PropTypes = require('prop-types'); const React = require('React'); const ReactNative = require('ReactNative'); -const PropTypes = require('prop-types'); const StyleSheet = require('StyleSheet'); const StyleSheetPropType = require('StyleSheetPropType'); const TextAncestor = require('TextAncestor'); -const ViewPropTypes = require('ViewPropTypes'); const flattenStyle = require('flattenStyle'); const merge = require('merge'); @@ -38,7 +38,7 @@ function generateRequestId() { } const ImageProps = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, style: StyleSheetPropType(ImageStylePropTypes), /** * See https://facebook.github.io/react-native/docs/image.html#source diff --git a/Libraries/RCTTest/SnapshotViewIOS.ios.js b/Libraries/RCTTest/SnapshotViewIOS.ios.js index 9fbc70302..07426e87f 100644 --- a/Libraries/RCTTest/SnapshotViewIOS.ios.js +++ b/Libraries/RCTTest/SnapshotViewIOS.ios.js @@ -10,17 +10,17 @@ 'use strict'; -const React = require('React'); +const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes'); const PropTypes = require('prop-types'); +const React = require('React'); const StyleSheet = require('StyleSheet'); -const {TestModule} = require('NativeModules'); const UIManager = require('UIManager'); const View = require('View'); -const ViewPropTypes = require('ViewPropTypes'); - const requireNativeComponent = require('requireNativeComponent'); +const {TestModule} = require('NativeModules'); + // Verify that RCTSnapshot is part of the UIManager since it is only loaded // if you have linked against RCTTest like in tests, otherwise we will have // a warning printed out @@ -34,7 +34,7 @@ class SnapshotViewIOS extends React.Component<{ }> { // $FlowFixMe(>=0.41.0) static propTypes = { - ...ViewPropTypes, + ...DeprecatedViewPropTypes, // A callback when the Snapshot view is ready to be compared onSnapshotReady: PropTypes.func, // A name to identify the individual instance to the SnapshotView diff --git a/Libraries/react-native/react-native-implementation.js b/Libraries/react-native/react-native-implementation.js index 3ff7b9ed3..03d25f0fc 100644 --- a/Libraries/react-native/react-native-implementation.js +++ b/Libraries/react-native/react-native-implementation.js @@ -313,7 +313,7 @@ const ReactNative = { return require('PointPropType'); }, get ViewPropTypes() { - return require('ViewPropTypes'); + return require('DeprecatedViewPropTypes'); }, // Deprecated