From 26cce3d7a889e0622636c4e4b6bd42e0abecb275 Mon Sep 17 00:00:00 2001 From: James Ide Date: Wed, 10 Apr 2019 10:15:13 -0700 Subject: [PATCH] Rewrite imports in RNTester to use standard paths (#24317) Summary: See https://github.com/facebook/react-native/issues/24316 for the motivation. This commit rewrites the imports in the RNTester project. [General] [Changed] - Replaced Haste-style imports with standard path-style imports for RNTester Pull Request resolved: https://github.com/facebook/react-native/pull/24317 Differential Revision: D14870504 Pulled By: cpojer fbshipit-source-id: b14f22e7ce559efc332ced032617ca581196d90f --- .../NativeScreenshotManager.js | 4 +-- .../RCTTest/RCTSnapshotNativeComponent.js | 10 +++---- RNTester/js/ARTExample.js | 3 +- .../js/AccessibilityAndroidExample.android.js | 5 +--- RNTester/js/AccessibilityExample.js | 9 ++++-- RNTester/js/AccessibilityIOSExample.js | 7 +++-- RNTester/js/ActionSheetIOSExample.js | 8 ++--- RNTester/js/AlertExample.js | 9 ++++-- RNTester/js/AlertIOSExample.js | 9 ++++-- RNTester/js/AnimatedExample.js | 3 +- RNTester/js/AnimatedGratuitousApp/AnExApp.js | 11 +++++-- .../js/AnimatedGratuitousApp/AnExBobble.js | 3 +- .../js/AnimatedGratuitousApp/AnExChained.js | 3 +- .../js/AnimatedGratuitousApp/AnExScroll.js | 10 +++++-- RNTester/js/AnimatedGratuitousApp/AnExSet.js | 9 ++++-- RNTester/js/AnimatedGratuitousApp/AnExTilt.js | 3 +- RNTester/js/AppStateExample.js | 3 +- RNTester/js/AssetScaledImageExample.js | 5 ++-- RNTester/js/AsyncStorageExample.js | 3 +- RNTester/js/BorderExample.js | 3 +- RNTester/js/BoxShadowExample.js | 3 +- RNTester/js/ButtonExample.js | 3 +- RNTester/js/CameraRollExample.js | 8 +++-- RNTester/js/CameraRollView.js | 9 +++--- RNTester/js/CheckBoxExample.js | 3 +- RNTester/js/ClipboardExample.js | 3 +- RNTester/js/DatePickerAndroidExample.js | 3 +- RNTester/js/DatePickerIOSExample.js | 3 +- RNTester/js/DimensionsExample.js | 3 +- RNTester/js/FlatListExample.js | 6 ++-- RNTester/js/ImageCapInsetsExample.js | 2 +- RNTester/js/ImageEditingExample.js | 3 +- RNTester/js/ImageExample.js | 3 +- RNTester/js/InputAccessoryViewExample.js | 5 ++-- RNTester/js/KeyboardAvoidingViewExample.js | 5 ++-- RNTester/js/LayoutAnimationExample.js | 9 ++++-- RNTester/js/LayoutEventsExample.js | 14 +++++++-- RNTester/js/LayoutExample.js | 3 +- RNTester/js/ListExampleShared.js | 3 +- RNTester/js/ModalExample.js | 3 +- RNTester/js/MultiColumnExample.js | 5 ++-- RNTester/js/NativeAnimationsExample.js | 27 +++++++++-------- RNTester/js/NetInfoExample.js | 3 +- RNTester/js/OrientationChangeExample.js | 5 ++-- RNTester/js/PanResponderExample.js | 10 ++++--- .../js/PermissionsExampleAndroid.android.js | 3 +- RNTester/js/PickerExample.js | 5 +--- RNTester/js/PickerIOSExample.js | 3 +- RNTester/js/PointerEventsExample.js | 3 +- .../js/ProgressBarAndroidExample.android.js | 10 +++---- RNTester/js/ProgressViewIOSExample.js | 3 +- RNTester/js/PushNotificationIOSExample.js | 8 ++--- RNTester/js/RCTRootViewIOSExample.js | 10 ++++--- RNTester/js/RNTesterApp.android.js | 26 +++++++++-------- RNTester/js/RNTesterApp.ios.js | 29 +++++++++---------- RNTester/js/RNTesterButton.js | 2 +- RNTester/js/RNTesterExampleFilter.js | 4 +-- RNTester/js/RNTesterExampleList.js | 18 +++++++----- RNTester/js/RNTesterList.android.js | 2 +- RNTester/js/RNTesterList.ios.js | 2 +- RNTester/js/RNTesterSettingSwitchRow.js | 7 ++--- RNTester/js/RNTesterStatePersister.js | 4 +-- RNTester/js/RNTesterTitle.js | 3 +- RNTester/js/RTLExample.js | 5 ++-- RNTester/js/RefreshControlExample.js | 3 +- .../js/RootViewSizeFlexibilityExampleApp.js | 3 +- RNTester/js/SafeAreaViewExample.js | 18 +++++++----- RNTester/js/ScrollViewExample.js | 8 ++--- RNTester/js/ScrollViewSimpleExample.js | 8 +++-- RNTester/js/SectionListExample.js | 12 ++++++-- RNTester/js/SegmentedControlIOSExample.js | 3 +- RNTester/js/SetPropertiesExampleApp.js | 3 +- RNTester/js/ShareExample.js | 9 ++++-- RNTester/js/Shared/RNTesterTypes.js | 2 +- RNTester/js/Shared/TextLegend.js | 2 +- RNTester/js/SliderExample.js | 3 +- RNTester/js/SnapshotExample.js | 10 +++++-- RNTester/js/SnapshotViewIOS.android.js | 2 +- RNTester/js/SnapshotViewIOS.ios.js | 14 ++++----- RNTester/js/StatusBarExample.js | 3 +- RNTester/js/TextExample.android.js | 3 +- RNTester/js/TextExample.ios.js | 11 +++++-- RNTester/js/TextInputExample.android.js | 10 +++++-- RNTester/js/TextInputExample.ios.js | 15 +++++++--- RNTester/js/TimePickerAndroidExample.js | 3 +- RNTester/js/TimerExample.js | 3 +- RNTester/js/ToastAndroidExample.android.js | 12 +++++--- RNTester/js/ToolbarAndroidExample.android.js | 15 ++++++---- RNTester/js/ToolbarAndroidExample.ios.js | 4 ++- RNTester/js/TouchableExample.js | 6 ++-- RNTester/js/TransformExample.js | 3 +- RNTester/js/TransparentHitTestExample.js | 3 +- RNTester/js/VibrationExample.js | 3 +- RNTester/js/ViewExample.js | 8 +++-- .../js/ViewPagerAndroidExample.android.js | 5 ++-- RNTester/js/WebSocketExample.js | 3 +- RNTester/js/XHRExampleBinaryUpload.js | 3 +- RNTester/js/XHRExampleDownload.js | 3 +- RNTester/js/XHRExampleFetch.js | 3 +- RNTester/js/XHRExampleFormData.js | 3 +- RNTester/js/XHRExampleHeaders.js | 3 +- RNTester/js/XHRExampleOnTimeOut.js | 3 +- RNTester/js/createExamplePage.js | 2 +- 103 files changed, 339 insertions(+), 302 deletions(-) diff --git a/RNTester/NativeModuleExample/NativeScreenshotManager.js b/RNTester/NativeModuleExample/NativeScreenshotManager.js index dfff40070fbad9..effd2a470e0093 100644 --- a/RNTester/NativeModuleExample/NativeScreenshotManager.js +++ b/RNTester/NativeModuleExample/NativeScreenshotManager.js @@ -10,8 +10,8 @@ 'use strict'; -import type {TurboModule} from 'RCTExport'; -import * as TurboModuleRegistry from 'TurboModuleRegistry'; +import type {TurboModule} from '../../Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from '../../Libraries/TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { +getConstants: () => {||}; diff --git a/RNTester/RCTTest/RCTSnapshotNativeComponent.js b/RNTester/RCTTest/RCTSnapshotNativeComponent.js index 041c9580b8c7f4..d39de655467e5d 100644 --- a/RNTester/RCTTest/RCTSnapshotNativeComponent.js +++ b/RNTester/RCTTest/RCTSnapshotNativeComponent.js @@ -10,9 +10,11 @@ 'use strict'; -import type {SyntheticEvent} from 'CoreEventTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'ReactNative'; +const {requireNativeComponent} = require('react-native'); + +import type {SyntheticEvent} from '../../Libraries/Types/CoreEventTypes'; +import type {ViewProps} from '../../Libraries/Components/View/ViewPropTypes'; +import type {NativeComponent} from '../../Libraries/Renderer/shims/ReactNative'; type SnapshotReadyEvent = SyntheticEvent< $ReadOnly<{ @@ -28,8 +30,6 @@ type NativeProps = $ReadOnly<{| type SnapshotViewNativeType = Class>; -const requireNativeComponent = require('requireNativeComponent'); - module.exports = ((requireNativeComponent( 'RCTSnapshot', ): any): SnapshotViewNativeType); diff --git a/RNTester/js/ARTExample.js b/RNTester/js/ARTExample.js index a57fc8eed0a3eb..a3e294c54d623a 100644 --- a/RNTester/js/ARTExample.js +++ b/RNTester/js/ARTExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {ART, Platform, View} = ReactNative; +const {ART, Platform, View} = require('react-native'); const {Surface, Path, Group, Shape} = ART; diff --git a/RNTester/js/AccessibilityAndroidExample.android.js b/RNTester/js/AccessibilityAndroidExample.android.js index b6e4c89bda0877..a2a0a6cd6a1ab0 100644 --- a/RNTester/js/AccessibilityAndroidExample.android.js +++ b/RNTester/js/AccessibilityAndroidExample.android.js @@ -10,15 +10,12 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { - AccessibilityInfo, StyleSheet, Text, View, - ToastAndroid, TouchableWithoutFeedback, -} = ReactNative; +} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); diff --git a/RNTester/js/AccessibilityExample.js b/RNTester/js/AccessibilityExample.js index 0a57a164e3cf10..1653ffec432cee 100644 --- a/RNTester/js/AccessibilityExample.js +++ b/RNTester/js/AccessibilityExample.js @@ -10,8 +10,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {AccessibilityInfo, Text, View, TouchableOpacity, Alert} = ReactNative; +const { + AccessibilityInfo, + Text, + View, + TouchableOpacity, + Alert, +} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); diff --git a/RNTester/js/AccessibilityIOSExample.js b/RNTester/js/AccessibilityIOSExample.js index bcd6bccd670f77..87a54070a95a93 100644 --- a/RNTester/js/AccessibilityIOSExample.js +++ b/RNTester/js/AccessibilityIOSExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {AccessibilityInfo, Text, View, TouchableOpacity, Alert} = ReactNative; +const {Text, View, Alert} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); @@ -34,7 +33,9 @@ class AccessibilityIOSExample extends React.Component { Accessibility magic tap example alert('onAccessibilityEscape success')} + onAccessibilityEscape={() => + Alert.alert('onAccessibilityEscape success') + } accessible={true}> Accessibility escape example diff --git a/RNTester/js/ActionSheetIOSExample.js b/RNTester/js/ActionSheetIOSExample.js index 1f7abc2e79713f..c1130357829df5 100644 --- a/RNTester/js/ActionSheetIOSExample.js +++ b/RNTester/js/ActionSheetIOSExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { ActionSheetIOS, StyleSheet, @@ -19,7 +18,8 @@ const { View, Alert, NativeModules, -} = ReactNative; + findNodeHandle, +} = require('react-native'); const ScreenshotManager = NativeModules.ScreenshotManager; const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel']; @@ -128,7 +128,7 @@ class ActionSheetAnchorExample extends React.Component< cancelButtonIndex: CANCEL_INDEX, destructiveButtonIndex: DESTRUCTIVE_INDEX, anchor: this.anchorRef.current - ? ReactNative.findNodeHandle(this.anchorRef.current) + ? findNodeHandle(this.anchorRef.current) : undefined, }, buttonIndex => { @@ -263,7 +263,7 @@ class ShareScreenshotAnchorExample extends React.Component< url: uri, excludedActivityTypes: ['com.apple.UIKit.activity.PostToTwitter'], anchor: this.anchorRef.current - ? ReactNative.findNodeHandle(this.anchorRef.current) + ? findNodeHandle(this.anchorRef.current) : undefined, }, error => Alert.alert('Error', error), diff --git a/RNTester/js/AlertExample.js b/RNTester/js/AlertExample.js index 1d783fb7084ced..123dac52ed1b6e 100644 --- a/RNTester/js/AlertExample.js +++ b/RNTester/js/AlertExample.js @@ -10,8 +10,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Alert, StyleSheet, Text, TouchableHighlight, View} = ReactNative; +const { + Alert, + StyleSheet, + Text, + TouchableHighlight, + View, +} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); diff --git a/RNTester/js/AlertIOSExample.js b/RNTester/js/AlertIOSExample.js index 390ebf431cd5ed..45c735523acb26 100644 --- a/RNTester/js/AlertIOSExample.js +++ b/RNTester/js/AlertIOSExample.js @@ -11,8 +11,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, View, Text, TouchableHighlight, Alert} = ReactNative; +const { + StyleSheet, + View, + Text, + TouchableHighlight, + Alert, +} = require('react-native'); const {SimpleAlertExampleBlock} = require('./AlertExample'); diff --git a/RNTester/js/AnimatedExample.js b/RNTester/js/AnimatedExample.js index 076692530ad1de..6513a346e535fb 100644 --- a/RNTester/js/AnimatedExample.js +++ b/RNTester/js/AnimatedExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, Easing, StyleSheet, Text, View} = ReactNative; +const {Animated, Easing, StyleSheet, Text, View} = require('react-native'); const RNTesterButton = require('./RNTesterButton'); const styles = StyleSheet.create({ diff --git a/RNTester/js/AnimatedGratuitousApp/AnExApp.js b/RNTester/js/AnimatedGratuitousApp/AnExApp.js index be1142bd4544f2..d01c1e95ff2362 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExApp.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExApp.js @@ -11,10 +11,15 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, LayoutAnimation, PanResponder, StyleSheet, View} = ReactNative; +const { + Animated, + LayoutAnimation, + PanResponder, + StyleSheet, + View, +} = require('react-native'); -const AnExSet = require('AnExSet'); +const AnExSet = require('./AnExSet'); const CIRCLE_SIZE = 80; const CIRCLE_MARGIN = 18; diff --git a/RNTester/js/AnimatedGratuitousApp/AnExBobble.js b/RNTester/js/AnimatedGratuitousApp/AnExBobble.js index 4be52c650f41b8..0654be84a4a179 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExBobble.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExBobble.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, PanResponder, StyleSheet, View} = ReactNative; +const {Animated, PanResponder, StyleSheet, View} = require('react-native'); const NUM_BOBBLES = 5; const RAD_EACH = Math.PI / 2 / (NUM_BOBBLES - 2); diff --git a/RNTester/js/AnimatedGratuitousApp/AnExChained.js b/RNTester/js/AnimatedGratuitousApp/AnExChained.js index 91e85e0b1714d6..0451e32d37c035 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExChained.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExChained.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, PanResponder, StyleSheet, View} = ReactNative; +const {Animated, PanResponder, StyleSheet, View} = require('react-native'); class AnExChained extends React.Component { constructor(props: Object) { diff --git a/RNTester/js/AnimatedGratuitousApp/AnExScroll.js b/RNTester/js/AnimatedGratuitousApp/AnExScroll.js index 1920bc245e9fd6..0bd79b9635f78d 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExScroll.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExScroll.js @@ -11,8 +11,14 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, Image, ScrollView, StyleSheet, Text, View} = ReactNative; +const { + Animated, + Image, + ScrollView, + StyleSheet, + Text, + View, +} = require('react-native'); class AnExScroll extends React.Component<$FlowFixMeProps, any> { state: any = {scrollX: new Animated.Value(0)}; diff --git a/RNTester/js/AnimatedGratuitousApp/AnExSet.js b/RNTester/js/AnimatedGratuitousApp/AnExSet.js index d3e56068f3d7b3..e5074165c52366 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExSet.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExSet.js @@ -11,8 +11,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, PanResponder, StyleSheet, Text, View} = ReactNative; +const { + Animated, + PanResponder, + StyleSheet, + Text, + View, +} = require('react-native'); const AnExBobble = require('./AnExBobble'); const AnExChained = require('./AnExChained'); diff --git a/RNTester/js/AnimatedGratuitousApp/AnExTilt.js b/RNTester/js/AnimatedGratuitousApp/AnExTilt.js index bcc389d8747a74..fea0a89cfbf037 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExTilt.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExTilt.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, PanResponder, StyleSheet} = ReactNative; +const {Animated, PanResponder, StyleSheet} = require('react-native'); class AnExTilt extends React.Component { constructor(props: Object) { diff --git a/RNTester/js/AppStateExample.js b/RNTester/js/AppStateExample.js index 4ea4949d5af275..24ecbcc27450de 100644 --- a/RNTester/js/AppStateExample.js +++ b/RNTester/js/AppStateExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {AppState, Text, View} = ReactNative; +const {AppState, Text, View} = require('react-native'); class AppStateSubscription extends React.Component< $FlowFixMeProps, diff --git a/RNTester/js/AssetScaledImageExample.js b/RNTester/js/AssetScaledImageExample.js index fb50653a1de54f..32620c05e35ce0 100644 --- a/RNTester/js/AssetScaledImageExample.js +++ b/RNTester/js/AssetScaledImageExample.js @@ -11,10 +11,9 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Image, StyleSheet, View, ScrollView} = ReactNative; +const {Image, StyleSheet, View, ScrollView} = require('react-native'); -import type {PhotoIdentifier} from 'CameraRoll'; +import type {PhotoIdentifier} from '../../Libraries/CameraRoll/CameraRoll'; type Props = $ReadOnly<{| asset: PhotoIdentifier, diff --git a/RNTester/js/AsyncStorageExample.js b/RNTester/js/AsyncStorageExample.js index a92c828619229d..dd20ff711f668f 100644 --- a/RNTester/js/AsyncStorageExample.js +++ b/RNTester/js/AsyncStorageExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {AsyncStorage, PickerIOS, Text, View} = ReactNative; +const {AsyncStorage, PickerIOS, Text, View} = require('react-native'); const PickerItemIOS = PickerIOS.Item; const STORAGE_KEY = '@AsyncStorageExample:key'; diff --git a/RNTester/js/BorderExample.js b/RNTester/js/BorderExample.js index 36c75a5a5d5005..f43016ef60ed45 100644 --- a/RNTester/js/BorderExample.js +++ b/RNTester/js/BorderExample.js @@ -10,8 +10,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, View} = ReactNative; +const {StyleSheet, View} = require('react-native'); const styles = StyleSheet.create({ box: { diff --git a/RNTester/js/BoxShadowExample.js b/RNTester/js/BoxShadowExample.js index 2996d063e73d5c..b383da6a97673a 100644 --- a/RNTester/js/BoxShadowExample.js +++ b/RNTester/js/BoxShadowExample.js @@ -10,8 +10,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Image, StyleSheet, View} = ReactNative; +const {Image, StyleSheet, View} = require('react-native'); const styles = StyleSheet.create({ box: { diff --git a/RNTester/js/ButtonExample.js b/RNTester/js/ButtonExample.js index ccabd4ae78628a..2dfad341b0c327 100644 --- a/RNTester/js/ButtonExample.js +++ b/RNTester/js/ButtonExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Alert, Button, View, StyleSheet} = ReactNative; +const {Alert, Button, View, StyleSheet} = require('react-native'); function onButtonPress(buttonName) { Alert.alert(`${buttonName} has been pressed!`); diff --git a/RNTester/js/CameraRollExample.js b/RNTester/js/CameraRollExample.js index c7a723c3ae7533..7f0660db8f29b7 100644 --- a/RNTester/js/CameraRollExample.js +++ b/RNTester/js/CameraRollExample.js @@ -10,7 +10,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { CameraRoll, Image, @@ -20,7 +19,7 @@ const { Text, View, TouchableOpacity, -} = ReactNative; +} = require('react-native'); const invariant = require('invariant'); @@ -28,7 +27,10 @@ const CameraRollView = require('./CameraRollView'); const AssetScaledImageExampleView = require('./AssetScaledImageExample'); -import type {PhotoIdentifier, GroupTypes} from 'CameraRoll'; +import type { + PhotoIdentifier, + GroupTypes, +} from '../../Libraries/CameraRoll/CameraRoll'; type Props = $ReadOnly<{| navigator?: ?Array< diff --git a/RNTester/js/CameraRollView.js b/RNTester/js/CameraRollView.js index 1b7276e0f4c507..8058f0aba3364b 100644 --- a/RNTester/js/CameraRollView.js +++ b/RNTester/js/CameraRollView.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { ActivityIndicator, Alert, @@ -22,16 +21,16 @@ const { Platform, StyleSheet, View, -} = ReactNative; +} = require('react-native'); -const groupByEveryN = require('groupByEveryN'); -const logError = require('logError'); +const groupByEveryN = require('../../Libraries/Utilities/groupByEveryN'); +const logError = require('../../Libraries/Utilities/logError'); import type { PhotoIdentifier, PhotoIdentifiersPage, GetPhotosParams, -} from 'CameraRoll'; +} from '../../Libraries/CameraRoll/CameraRoll'; type Props = $ReadOnly<{| /** diff --git a/RNTester/js/CheckBoxExample.js b/RNTester/js/CheckBoxExample.js index 32321737d97cc4..c9e795f638db07 100644 --- a/RNTester/js/CheckBoxExample.js +++ b/RNTester/js/CheckBoxExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {CheckBox, Text, View, StyleSheet} = ReactNative; +const {CheckBox, Text, View, StyleSheet} = require('react-native'); type BasicState = {| trueCheckBoxIsOn: boolean, diff --git a/RNTester/js/ClipboardExample.js b/RNTester/js/ClipboardExample.js index d093db9b0598e4..7bd7518b0f3c4d 100644 --- a/RNTester/js/ClipboardExample.js +++ b/RNTester/js/ClipboardExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Clipboard, View, Text, StyleSheet} = ReactNative; +const {Clipboard, View, Text, StyleSheet} = require('react-native'); type Props = $ReadOnly<{||}>; type State = {| diff --git a/RNTester/js/DatePickerAndroidExample.js b/RNTester/js/DatePickerAndroidExample.js index bd303dc2a3eb7d..23f16cb91be7f8 100644 --- a/RNTester/js/DatePickerAndroidExample.js +++ b/RNTester/js/DatePickerAndroidExample.js @@ -10,13 +10,12 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { DatePickerAndroid, StyleSheet, Text, TouchableWithoutFeedback, -} = ReactNative; +} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); diff --git a/RNTester/js/DatePickerIOSExample.js b/RNTester/js/DatePickerIOSExample.js index 7b006ae0fa308a..6aef85f215ff33 100644 --- a/RNTester/js/DatePickerIOSExample.js +++ b/RNTester/js/DatePickerIOSExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {DatePickerIOS, StyleSheet, Text, View} = ReactNative; +const {DatePickerIOS, StyleSheet, Text, View} = require('react-native'); type State = {| date: Date, diff --git a/RNTester/js/DimensionsExample.js b/RNTester/js/DimensionsExample.js index db90288656ae1b..c7c21063e15103 100644 --- a/RNTester/js/DimensionsExample.js +++ b/RNTester/js/DimensionsExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Dimensions, Text, View} = ReactNative; +const {Dimensions, Text, View} = require('react-native'); class DimensionsSubscription extends React.Component< {dim: string}, diff --git a/RNTester/js/FlatListExample.js b/RNTester/js/FlatListExample.js index 2277b1fa621c53..f85870405845d3 100644 --- a/RNTester/js/FlatListExample.js +++ b/RNTester/js/FlatListExample.js @@ -12,14 +12,12 @@ import type {Item} from './ListExampleShared'; -const Alert = require('Alert'); const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, StyleSheet, View} = ReactNative; +const {Alert, Animated, StyleSheet, View} = require('react-native'); const RNTesterPage = require('./RNTesterPage'); -const infoLog = require('infoLog'); +const infoLog = require('../../Libraries/Utilities/infoLog'); const { FooterComponent, diff --git a/RNTester/js/ImageCapInsetsExample.js b/RNTester/js/ImageCapInsetsExample.js index 4a7ac0028d1f9f..ca95d454e0e369 100644 --- a/RNTester/js/ImageCapInsetsExample.js +++ b/RNTester/js/ImageCapInsetsExample.js @@ -13,7 +13,7 @@ const React = require('react'); const ReactNative = require('react-native'); -const nativeImageSource = require('nativeImageSource'); +const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); const {Image, StyleSheet, Text, View} = ReactNative; type Props = $ReadOnly<{||}>; diff --git a/RNTester/js/ImageEditingExample.js b/RNTester/js/ImageEditingExample.js index bc4fdbb7a07097..fa6e124ef30b82 100644 --- a/RNTester/js/ImageEditingExample.js +++ b/RNTester/js/ImageEditingExample.js @@ -10,7 +10,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { CameraRoll, Image, @@ -21,7 +20,7 @@ const { Text, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); const PAGE_SIZE = 20; diff --git a/RNTester/js/ImageExample.js b/RNTester/js/ImageExample.js index 6f32a108426b47..82cfc8b5c21582 100644 --- a/RNTester/js/ImageExample.js +++ b/RNTester/js/ImageExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { ActivityIndicator, Image, @@ -19,7 +18,7 @@ const { Text, View, ImageBackground, -} = ReactNative; +} = require('react-native'); const base64Icon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEsAAABLCAQAAACSR7JhAAADtUlEQVR4Ac3YA2Bj6QLH0XPT1Fzbtm29tW3btm3bfLZtv7e2ObZnms7d8Uw098tuetPzrxv8wiISrtVudrG2JXQZ4VOv+qUfmqCGGl1mqLhoA52oZlb0mrjsnhKpgeUNEs91Z0pd1kvihA3ULGVHiQO2narKSHKkEMulm9VgUyE60s1aWoMQUbpZOWE+kaqs4eLEjdIlZTcFZB0ndc1+lhB1lZrIuk5P2aib1NBpZaL+JaOGIt0ls47SKzLC7CqrlGF6RZ09HGoNy1lYl2aRSWL5GuzqWU1KafRdoRp0iOQEiDzgZPnG6DbldcomadViflnl/cL93tOoVbsOLVM2jylvdWjXolWX1hmfZbGR/wjypDjFLSZIRov09BgYmtUqPQPlQrPapecLgTIy0jMgPKtTeob2zWtrGH3xvjUkPCtNg/tm1rjwrMa+mdUkPd3hWbH0jArPGiU9ufCsNNWFZ40wpwn+62/66R2RUtoso1OB34tnLOcy7YB1fUdc9e0q3yru8PGM773vXsuZ5YIZX+5xmHwHGVvlrGPN6ZSiP1smOsMMde40wKv2VmwPPVXNut4sVpUreZiLBHi0qln/VQeI/LTMYXpsJtFiclUN+5HVZazim+Ky+7sAvxWnvjXrJFneVtLWLyPJu9K3cXLWeOlbMTlrIelbMDlrLenrjEQOtIF+fuI9xRp9ZBFp6+b6WT8RrxEpdK64BuvHgDk+vUy+b5hYk6zfyfs051gRoNO1usU12WWRWL73/MMEy9pMi9qIrR4ZpV16Rrvduxazmy1FSvuFXRkqTnE7m2kdb5U8xGjLw/spRr1uTov4uOgQE+0N/DvFrG/Jt7i/FzwxbA9kDanhf2w+t4V97G8lrT7wc08aA2QNUkuTfW/KimT01wdlfK4yEw030VfT0RtZbzjeMprNq8m8tnSTASrTLti64oBNdpmMQm0eEwvfPwRbUBywG5TzjPCsdwk3IeAXjQblLCoXnDVeoAz6SfJNk5TTzytCNZk/POtTSV40NwOFWzw86wNJRpubpXsn60NJFlHeqlYRbslqZm2jnEZ3qcSKgm0kTli3zZVS7y/iivZTweYXJ26Y+RTbV1zh3hYkgyFGSTKPfRVbRqWWVReaxYeSLarYv1Qqsmh1s95S7G+eEWK0f3jYKTbV6bOwepjfhtafsvUsqrQvrGC8YhmnO9cSCk3yuY984F1vesdHYhWJ5FvASlacshUsajFt2mUM9pqzvKGcyNJW0arTKN1GGGzQlH0tXwLDgQTurS8eIQAAAABJRU5ErkJggg=='; diff --git a/RNTester/js/InputAccessoryViewExample.js b/RNTester/js/InputAccessoryViewExample.js index 7337e34170c0ab..daf29a911ca329 100644 --- a/RNTester/js/InputAccessoryViewExample.js +++ b/RNTester/js/InputAccessoryViewExample.js @@ -10,8 +10,7 @@ 'use strict'; -const React = require('React'); -const ReactNative = require('react-native'); +const React = require('react'); const { Alert, Button, @@ -21,7 +20,7 @@ const { Text, TextInput, View, -} = ReactNative; +} = require('react-native'); type MessageProps = $ReadOnly<{||}>; class Message extends React.PureComponent { diff --git a/RNTester/js/KeyboardAvoidingViewExample.js b/RNTester/js/KeyboardAvoidingViewExample.js index b3c84d18e3fc0b..caa5401dc3e1e5 100644 --- a/RNTester/js/KeyboardAvoidingViewExample.js +++ b/RNTester/js/KeyboardAvoidingViewExample.js @@ -9,8 +9,7 @@ 'use strict'; -const React = require('React'); -const ReactNative = require('react-native'); +const React = require('react'); const { KeyboardAvoidingView, Modal, @@ -20,7 +19,7 @@ const { TextInput, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); diff --git a/RNTester/js/LayoutAnimationExample.js b/RNTester/js/LayoutAnimationExample.js index fb8aac62264561..8c724166002ba3 100644 --- a/RNTester/js/LayoutAnimationExample.js +++ b/RNTester/js/LayoutAnimationExample.js @@ -11,8 +11,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {LayoutAnimation, StyleSheet, Text, View, TouchableOpacity} = ReactNative; +const { + LayoutAnimation, + StyleSheet, + Text, + View, + TouchableOpacity, +} = require('react-native'); class AddRemoveExample extends React.Component<{}, $FlowFixMeState> { state = { diff --git a/RNTester/js/LayoutEventsExample.js b/RNTester/js/LayoutEventsExample.js index 84f38fa48978ad..74a285e25d9a13 100644 --- a/RNTester/js/LayoutEventsExample.js +++ b/RNTester/js/LayoutEventsExample.js @@ -11,10 +11,18 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; +const { + Image, + LayoutAnimation, + StyleSheet, + Text, + View, +} = require('react-native'); -import type {ViewLayout, ViewLayoutEvent} from 'ViewPropTypes'; +import type { + ViewLayout, + ViewLayoutEvent, +} from '../../Libraries/Components/View/ViewPropTypes'; type Props = $ReadOnly<{||}>; type State = { diff --git a/RNTester/js/LayoutExample.js b/RNTester/js/LayoutExample.js index 7bdb48e799d413..4d5f085207bda9 100644 --- a/RNTester/js/LayoutExample.js +++ b/RNTester/js/LayoutExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, View} = ReactNative; +const {StyleSheet, Text, View} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); diff --git a/RNTester/js/ListExampleShared.js b/RNTester/js/ListExampleShared.js index b01d418de2fcfc..03d2f822276d85 100644 --- a/RNTester/js/ListExampleShared.js +++ b/RNTester/js/ListExampleShared.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Animated, Image, @@ -22,7 +21,7 @@ const { Text, TextInput, View, -} = ReactNative; +} = require('react-native'); export type Item = { title: string, diff --git a/RNTester/js/ModalExample.js b/RNTester/js/ModalExample.js index e8a306b17aba27..2defd129a267d6 100644 --- a/RNTester/js/ModalExample.js +++ b/RNTester/js/ModalExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Modal, Picker, @@ -21,7 +20,7 @@ const { Text, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); const Item = Picker.Item; diff --git a/RNTester/js/MultiColumnExample.js b/RNTester/js/MultiColumnExample.js index c7ae28a997efc9..435e2d465a925b 100644 --- a/RNTester/js/MultiColumnExample.js +++ b/RNTester/js/MultiColumnExample.js @@ -11,12 +11,11 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {FlatList, StyleSheet, Text, View, Alert} = ReactNative; +const {FlatList, StyleSheet, Text, View, Alert} = require('react-native'); const RNTesterPage = require('./RNTesterPage'); -const infoLog = require('infoLog'); +const infoLog = require('../../Libraries/Utilities/infoLog'); const { FooterComponent, diff --git a/RNTester/js/NativeAnimationsExample.js b/RNTester/js/NativeAnimationsExample.js index 1bb71002b8920d..41c229c15e0168 100644 --- a/RNTester/js/NativeAnimationsExample.js +++ b/RNTester/js/NativeAnimationsExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { View, Text, @@ -19,7 +18,7 @@ const { StyleSheet, TouchableWithoutFeedback, Slider, -} = ReactNative; +} = require('react-native'); const AnimatedSlider = Animated.createAnimatedComponent(Slider); @@ -155,7 +154,7 @@ class LoopExample extends React.Component<{}, $FlowFixMeState> { } } -const RNTesterSettingSwitchRow = require('RNTesterSettingSwitchRow'); +const RNTesterSettingSwitchRow = require('./RNTesterSettingSwitchRow'); class InternalSettings extends React.Component< {}, {busyTime: number | string, filteredStall: number}, @@ -188,16 +187,20 @@ class InternalSettings extends React.Component< initialValue={false} label="Track JS Stalls" onEnable={() => { - require('JSEventLoopWatchdog').install({thresholdMS: 25}); - this.setState({busyTime: ''}); - require('JSEventLoopWatchdog').addHandler({ - onStall: ({busyTime}) => - this.setState(state => ({ - busyTime, - filteredStall: - (state.filteredStall || 0) * 0.97 + busyTime * 0.03, - })), + require('../../Libraries/Interaction/JSEventLoopWatchdog').install({ + thresholdMS: 25, }); + this.setState({busyTime: ''}); + require('../../Libraries/Interaction/JSEventLoopWatchdog').addHandler( + { + onStall: ({busyTime}) => + this.setState(state => ({ + busyTime, + filteredStall: + (state.filteredStall || 0) * 0.97 + busyTime * 0.03, + })), + }, + ); }} onDisable={() => { console.warn('Cannot disable yet....'); diff --git a/RNTester/js/NetInfoExample.js b/RNTester/js/NetInfoExample.js index a0e22be390ae37..ad825b72c20d84 100644 --- a/RNTester/js/NetInfoExample.js +++ b/RNTester/js/NetInfoExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {NetInfo, Text, View, TouchableWithoutFeedback} = ReactNative; +const {NetInfo, Text, View, TouchableWithoutFeedback} = require('react-native'); class ConnectionInfoSubscription extends React.Component<{}, $FlowFixMeState> { state = { diff --git a/RNTester/js/OrientationChangeExample.js b/RNTester/js/OrientationChangeExample.js index 933745f060c512..ceb4fdc436a2ec 100644 --- a/RNTester/js/OrientationChangeExample.js +++ b/RNTester/js/OrientationChangeExample.js @@ -11,10 +11,9 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {DeviceEventEmitter, Text, View} = ReactNative; +const {DeviceEventEmitter, Text, View} = require('react-native'); -import type EmitterSubscription from 'EmitterSubscription'; +import type EmitterSubscription from '../../Libraries/vendor/emitter/EmitterSubscription'; class OrientationChangeExample extends React.Component<{}, $FlowFixMeState> { _orientationSubscription: EmitterSubscription; diff --git a/RNTester/js/PanResponderExample.js b/RNTester/js/PanResponderExample.js index 94735f5e583a4e..fddb5631e9e8f5 100644 --- a/RNTester/js/PanResponderExample.js +++ b/RNTester/js/PanResponderExample.js @@ -11,11 +11,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {PanResponder, StyleSheet, View} = ReactNative; +const {PanResponder, StyleSheet, View} = require('react-native'); -import type {PanResponderInstance, GestureState} from 'PanResponder'; -import type {PressEvent} from 'CoreEventTypes'; +import type { + PanResponderInstance, + GestureState, +} from '../../Libraries/Interaction/PanResponder'; +import type {PressEvent} from '../../Libraries/Types/CoreEventTypes'; type CircleStyles = { backgroundColor?: string, diff --git a/RNTester/js/PermissionsExampleAndroid.android.js b/RNTester/js/PermissionsExampleAndroid.android.js index a45efa9a544e71..afc065146ee703 100644 --- a/RNTester/js/PermissionsExampleAndroid.android.js +++ b/RNTester/js/PermissionsExampleAndroid.android.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { PermissionsAndroid, Picker, @@ -19,7 +18,7 @@ const { Text, TouchableWithoutFeedback, View, -} = ReactNative; +} = require('react-native'); const Item = Picker.Item; diff --git a/RNTester/js/PickerExample.js b/RNTester/js/PickerExample.js index 2d308c953549b2..417f9387cffc68 100644 --- a/RNTester/js/PickerExample.js +++ b/RNTester/js/PickerExample.js @@ -11,10 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const StyleSheet = require('StyleSheet'); - -const {Picker, Text} = ReactNative; +const {Picker, StyleSheet, Text} = require('react-native'); const Item = Picker.Item; diff --git a/RNTester/js/PickerIOSExample.js b/RNTester/js/PickerIOSExample.js index 4023834242e72f..e71e03539a6a7a 100644 --- a/RNTester/js/PickerIOSExample.js +++ b/RNTester/js/PickerIOSExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {PickerIOS, Text, View} = ReactNative; +const {PickerIOS, Text, View} = require('react-native'); const PickerItemIOS = PickerIOS.Item; diff --git a/RNTester/js/PointerEventsExample.js b/RNTester/js/PointerEventsExample.js index 2830c3e9cb6a89..f3726683890b3a 100644 --- a/RNTester/js/PointerEventsExample.js +++ b/RNTester/js/PointerEventsExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, View} = ReactNative; +const {StyleSheet, Text, View} = require('react-native'); class ExampleBox extends React.Component<$FlowFixMeProps, $FlowFixMeState> { state = { diff --git a/RNTester/js/ProgressBarAndroidExample.android.js b/RNTester/js/ProgressBarAndroidExample.android.js index f88567d8f006a4..29050e9f010507 100644 --- a/RNTester/js/ProgressBarAndroidExample.android.js +++ b/RNTester/js/ProgressBarAndroidExample.android.js @@ -10,12 +10,12 @@ 'use strict'; -const ProgressBar = require('ProgressBarAndroid'); -const React = require('React'); -const RNTesterBlock = require('RNTesterBlock'); -const RNTesterPage = require('RNTesterPage'); +const React = require('react'); +const {ProgressBarAndroid: ProgressBar} = require('react-native'); +const RNTesterBlock = require('./RNTesterBlock'); +const RNTesterPage = require('./RNTesterPage'); -import type {ProgressBarAndroidProps} from 'ProgressBarAndroid'; +import type {ProgressBarAndroidProps} from '../../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'; type MovingBarProps = $ReadOnly<{| ...$Diff< diff --git a/RNTester/js/ProgressViewIOSExample.js b/RNTester/js/ProgressViewIOSExample.js index 63bc82c0767559..c9968ba4c257e5 100644 --- a/RNTester/js/ProgressViewIOSExample.js +++ b/RNTester/js/ProgressViewIOSExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {ProgressViewIOS, StyleSheet, View} = ReactNative; +const {ProgressViewIOS, StyleSheet, View} = require('react-native'); type Props = {||}; type State = {| diff --git a/RNTester/js/PushNotificationIOSExample.js b/RNTester/js/PushNotificationIOSExample.js index 62066f1f09a11c..31eea14aed33d4 100644 --- a/RNTester/js/PushNotificationIOSExample.js +++ b/RNTester/js/PushNotificationIOSExample.js @@ -11,15 +11,15 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Alert, + DeviceEventEmitter, PushNotificationIOS, StyleSheet, Text, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); class Button extends React.Component<$FlowFixMeProps> { render() { @@ -86,7 +86,7 @@ class NotificationExample extends React.Component<{}> { } _sendNotification() { - require('RCTDeviceEventEmitter').emit('remoteNotificationReceived', { + DeviceEventEmitter.emit('remoteNotificationReceived', { remote: true, aps: { alert: 'Sample notification', @@ -99,7 +99,7 @@ class NotificationExample extends React.Component<{}> { } _sendLocalNotification() { - require('RCTDeviceEventEmitter').emit('localNotificationReceived', { + DeviceEventEmitter.emit('localNotificationReceived', { aps: { alert: 'Sample local notification', badge: '+1', diff --git a/RNTester/js/RCTRootViewIOSExample.js b/RNTester/js/RCTRootViewIOSExample.js index 397dfe22e5fedb..222df450960a41 100644 --- a/RNTester/js/RCTRootViewIOSExample.js +++ b/RNTester/js/RCTRootViewIOSExample.js @@ -11,10 +11,12 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, View} = ReactNative; - -const requireNativeComponent = require('requireNativeComponent'); +const { + StyleSheet, + Text, + View, + requireNativeComponent, +} = require('react-native'); class AppPropertiesUpdateExample extends React.Component<{}> { render() { diff --git a/RNTester/js/RNTesterApp.android.js b/RNTester/js/RNTesterApp.android.js index 16c6660e0742e9..d3b29152299ed0 100644 --- a/RNTester/js/RNTesterApp.android.js +++ b/RNTester/js/RNTesterApp.android.js @@ -10,16 +10,20 @@ 'use strict'; -const AppRegistry = require('AppRegistry'); -const AsyncStorage = require('AsyncStorage'); -const BackHandler = require('BackHandler'); -const Dimensions = require('Dimensions'); -const DrawerLayoutAndroid = require('DrawerLayoutAndroid'); -const Linking = require('Linking'); const React = require('react'); -const StatusBar = require('StatusBar'); -const StyleSheet = require('StyleSheet'); -const ToolbarAndroid = require('ToolbarAndroid'); +const { + AppRegistry, + AsyncStorage, + BackHandler, + Dimensions, + DrawerLayoutAndroid, + Linking, + StatusBar, + StyleSheet, + ToolbarAndroid, + UIManager, + View, +} = require('react-native'); const RNTesterActions = require('./RNTesterActions'); const RNTesterExampleContainer = require('./RNTesterExampleContainer'); const RNTesterExampleList = require('./RNTesterExampleList'); @@ -27,11 +31,9 @@ const RNTesterExampleList = require('./RNTesterExampleList'); * making Flow check .android.js files. */ const RNTesterList = require('./RNTesterList'); const RNTesterNavigationReducer = require('./RNTesterNavigationReducer'); -const UIManager = require('UIManager'); const URIActionMap = require('./URIActionMap'); -const View = require('View'); -const nativeImageSource = require('nativeImageSource'); +const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); import type {RNTesterNavigationState} from './RNTesterNavigationReducer'; diff --git a/RNTester/js/RNTesterApp.ios.js b/RNTester/js/RNTesterApp.ios.js index bf4ea6c2648e15..e13178d024e797 100644 --- a/RNTester/js/RNTesterApp.ios.js +++ b/RNTester/js/RNTesterApp.ios.js @@ -10,12 +10,19 @@ 'use strict'; -require('InitializeCore'); -const AsyncStorage = require('AsyncStorage'); -const BackHandler = require('BackHandler'); -const Linking = require('Linking'); const React = require('react'); -const ReactNative = require('react-native'); +const { + AppRegistry, + AsyncStorage, + BackHandler, + Button, + Linking, + SafeAreaView, + StyleSheet, + Text, + View, + YellowBox, +} = require('react-native'); const RNTesterActions = require('./RNTesterActions'); const RNTesterExampleContainer = require('./RNTesterExampleContainer'); const RNTesterExampleList = require('./RNTesterExampleList'); @@ -24,17 +31,7 @@ const RNTesterNavigationReducer = require('./RNTesterNavigationReducer'); const SnapshotViewIOS = require('./SnapshotViewIOS.ios'); const URIActionMap = require('./URIActionMap'); -const { - Button, - AppRegistry, - StyleSheet, - Text, - View, - SafeAreaView, - YellowBox, -} = ReactNative; - -import type {RNTesterExample} from 'RNTesterTypes'; +import type {RNTesterExample} from './Shared/RNTesterTypes'; import type {RNTesterAction} from './RNTesterActions'; import type {RNTesterNavigationState} from './RNTesterNavigationReducer'; diff --git a/RNTester/js/RNTesterButton.js b/RNTester/js/RNTesterButton.js index 0cc77abe6ae8cb..398861a0be0339 100644 --- a/RNTester/js/RNTesterButton.js +++ b/RNTester/js/RNTesterButton.js @@ -13,7 +13,7 @@ const React = require('react'); const {StyleSheet, Text, TouchableHighlight} = require('react-native'); -import type {PressEvent} from 'CoreEventTypes'; +import type {PressEvent} from '../../Libraries/Types/CoreEventTypes'; type Props = $ReadOnly<{| children?: React.Node, diff --git a/RNTester/js/RNTesterExampleFilter.js b/RNTester/js/RNTesterExampleFilter.js index 1714a48f2eaae1..ba6af79bae2ce8 100644 --- a/RNTester/js/RNTesterExampleFilter.js +++ b/RNTester/js/RNTesterExampleFilter.js @@ -11,9 +11,7 @@ 'use strict'; const React = require('react'); -const StyleSheet = require('StyleSheet'); -const TextInput = require('TextInput'); -const View = require('View'); +const {StyleSheet, TextInput, View} = require('react-native'); type Props = { filter: Function, diff --git a/RNTester/js/RNTesterExampleList.js b/RNTester/js/RNTesterExampleList.js index a52875a90e6094..9082b7a05c64ae 100644 --- a/RNTester/js/RNTesterExampleList.js +++ b/RNTester/js/RNTesterExampleList.js @@ -10,18 +10,20 @@ 'use strict'; -const Platform = require('Platform'); const React = require('react'); -const SectionList = require('SectionList'); -const StyleSheet = require('StyleSheet'); -const Text = require('Text'); -const TouchableHighlight = require('TouchableHighlight'); +const { + Platform, + SectionList, + StyleSheet, + Text, + TouchableHighlight, + View, +} = require('react-native'); const RNTesterActions = require('./RNTesterActions'); const RNTesterExampleFilter = require('./RNTesterExampleFilter'); -const View = require('View'); -import type {RNTesterExample} from 'RNTesterTypes'; -import type {ViewStyleProp} from 'StyleSheet'; +import type {RNTesterExample} from './Shared/RNTesterTypes'; +import type {ViewStyleProp} from '../../Libraries/StyleSheet/StyleSheet'; type Props = { onNavigate: Function, diff --git a/RNTester/js/RNTesterList.android.js b/RNTester/js/RNTesterList.android.js index 3eb3c8a5b26ff7..c982f2787848d9 100644 --- a/RNTester/js/RNTesterList.android.js +++ b/RNTester/js/RNTesterList.android.js @@ -10,7 +10,7 @@ 'use strict'; -import type {RNTesterExample} from 'RNTesterTypes'; +import type {RNTesterExample} from './Shared/RNTesterTypes'; const ComponentExamples: Array = [ { diff --git a/RNTester/js/RNTesterList.ios.js b/RNTester/js/RNTesterList.ios.js index e2922e4aa83dd9..55436071f145be 100644 --- a/RNTester/js/RNTesterList.ios.js +++ b/RNTester/js/RNTesterList.ios.js @@ -10,7 +10,7 @@ 'use strict'; -import type {RNTesterExample} from 'RNTesterTypes'; +import type {RNTesterExample} from './Shared/RNTesterTypes'; const ComponentExamples: Array = [ { diff --git a/RNTester/js/RNTesterSettingSwitchRow.js b/RNTester/js/RNTesterSettingSwitchRow.js index 383538b24706f4..4667ed18081e8c 100644 --- a/RNTester/js/RNTesterSettingSwitchRow.js +++ b/RNTester/js/RNTesterSettingSwitchRow.js @@ -10,12 +10,9 @@ 'use strict'; -const React = require('React'); -const StyleSheet = require('StyleSheet'); -const Switch = require('Switch'); -const Text = require('Text'); +const React = require('react'); +const {StyleSheet, Switch, Text, View} = require('react-native'); const RNTesterStatePersister = require('./RNTesterStatePersister'); -const View = require('View'); class RNTesterSettingSwitchRow extends React.Component< $FlowFixMeProps, diff --git a/RNTester/js/RNTesterStatePersister.js b/RNTester/js/RNTesterStatePersister.js index 720e2616f414d1..b42c521d550b7d 100644 --- a/RNTester/js/RNTesterStatePersister.js +++ b/RNTester/js/RNTesterStatePersister.js @@ -10,8 +10,8 @@ 'use strict'; -const AsyncStorage = require('AsyncStorage'); -const React = require('React'); +const React = require('react'); +const {AsyncStorage} = require('react-native'); export type PassProps = { state: State, diff --git a/RNTester/js/RNTesterTitle.js b/RNTester/js/RNTesterTitle.js index 0c9b8b69615f95..a50ac5066c395e 100644 --- a/RNTester/js/RNTesterTitle.js +++ b/RNTester/js/RNTesterTitle.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, View} = ReactNative; +const {StyleSheet, Text, View} = require('react-native'); class RNTesterTitle extends React.Component<$FlowFixMeProps> { render() { diff --git a/RNTester/js/RTLExample.js b/RNTester/js/RTLExample.js index a58b744709ab46..38462ee5bfabe7 100644 --- a/RNTester/js/RTLExample.js +++ b/RNTester/js/RTLExample.js @@ -10,21 +10,20 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Alert, Animated, I18nManager, Image, PixelRatio, + Platform, StyleSheet, Text, TouchableWithoutFeedback, Switch, View, Button, -} = ReactNative; -const Platform = require('Platform'); +} = require('react-native'); type State = { toggleStatus: any, diff --git a/RNTester/js/RefreshControlExample.js b/RNTester/js/RefreshControlExample.js index 515eeac33ae48a..bff7198e5abecc 100644 --- a/RNTester/js/RefreshControlExample.js +++ b/RNTester/js/RefreshControlExample.js @@ -10,7 +10,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { ScrollView, StyleSheet, @@ -18,7 +17,7 @@ const { Text, TouchableWithoutFeedback, View, -} = ReactNative; +} = require('react-native'); const styles = StyleSheet.create({ row: { diff --git a/RNTester/js/RootViewSizeFlexibilityExampleApp.js b/RNTester/js/RootViewSizeFlexibilityExampleApp.js index 42ec22a18dc4e4..0ae1066a4cd7e9 100644 --- a/RNTester/js/RootViewSizeFlexibilityExampleApp.js +++ b/RNTester/js/RootViewSizeFlexibilityExampleApp.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, TouchableHighlight, View} = ReactNative; +const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); class RootViewSizeFlexibilityExampleApp extends React.Component< {toggled: boolean}, diff --git a/RNTester/js/SafeAreaViewExample.js b/RNTester/js/SafeAreaViewExample.js index 0dbc79e0947601..287c19bbfdf604 100644 --- a/RNTester/js/SafeAreaViewExample.js +++ b/RNTester/js/SafeAreaViewExample.js @@ -9,15 +9,17 @@ */ 'use strict'; -const Button = require('Button'); -const DeviceInfo = require('DeviceInfo'); -const Modal = require('Modal'); const React = require('react'); -const SafeAreaView = require('SafeAreaView'); -const StyleSheet = require('StyleSheet'); -const Switch = require('Switch'); -const Text = require('Text'); -const View = require('View'); +const { + Button, + DeviceInfo, + Modal, + SafeAreaView, + StyleSheet, + Switch, + Text, + View, +} = require('react-native'); class SafeAreaViewExample extends React.Component< {}, diff --git a/RNTester/js/ScrollViewExample.js b/RNTester/js/ScrollViewExample.js index 32c2e4b1a92905..c6c28afb1e2b47 100644 --- a/RNTester/js/ScrollViewExample.js +++ b/RNTester/js/ScrollViewExample.js @@ -9,19 +9,17 @@ */ 'use strict'; -const Platform = require('Platform'); const React = require('react'); -const ReactNative = require('react-native'); const { + Platform, ScrollView, StyleSheet, Text, TouchableOpacity, View, - Image, -} = ReactNative; +} = require('react-native'); -import type {ViewStyleProp} from 'StyleSheet'; +import type {ViewStyleProp} from '../../Libraries/StyleSheet/StyleSheet'; exports.displayName = 'ScrollViewExample'; exports.title = ''; diff --git a/RNTester/js/ScrollViewSimpleExample.js b/RNTester/js/ScrollViewSimpleExample.js index bd814d5983bbcb..e29d990853e097 100644 --- a/RNTester/js/ScrollViewSimpleExample.js +++ b/RNTester/js/ScrollViewSimpleExample.js @@ -11,8 +11,12 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {ScrollView, StyleSheet, Text, TouchableOpacity} = ReactNative; +const { + ScrollView, + StyleSheet, + Text, + TouchableOpacity, +} = require('react-native'); const NUM_ITEMS = 20; diff --git a/RNTester/js/SectionListExample.js b/RNTester/js/SectionListExample.js index 455b1d36efcc0b..11c49aa8e4f0aa 100644 --- a/RNTester/js/SectionListExample.js +++ b/RNTester/js/SectionListExample.js @@ -11,12 +11,18 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Alert, Animated, Button, StyleSheet, Text, View} = ReactNative; +const { + Alert, + Animated, + Button, + StyleSheet, + Text, + View, +} = require('react-native'); const RNTesterPage = require('./RNTesterPage'); -const infoLog = require('infoLog'); +const infoLog = require('../../Libraries/Utilities/infoLog'); const { HeaderComponent, diff --git a/RNTester/js/SegmentedControlIOSExample.js b/RNTester/js/SegmentedControlIOSExample.js index 2b17f70cf5f415..64a277d727e6ab 100644 --- a/RNTester/js/SegmentedControlIOSExample.js +++ b/RNTester/js/SegmentedControlIOSExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {SegmentedControlIOS, Text, View, StyleSheet} = ReactNative; +const {SegmentedControlIOS, Text, View, StyleSheet} = require('react-native'); class BasicSegmentedControlExample extends React.Component<{}> { render() { diff --git a/RNTester/js/SetPropertiesExampleApp.js b/RNTester/js/SetPropertiesExampleApp.js index a7ea32204be7dd..7ec83f58bdfb9b 100644 --- a/RNTester/js/SetPropertiesExampleApp.js +++ b/RNTester/js/SetPropertiesExampleApp.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Text, View} = ReactNative; +const {Text, View} = require('react-native'); class SetPropertiesExampleApp extends React.Component<$FlowFixMeProps> { render() { diff --git a/RNTester/js/ShareExample.js b/RNTester/js/ShareExample.js index 97d30e6c1cb405..489031d2a2e5ea 100644 --- a/RNTester/js/ShareExample.js +++ b/RNTester/js/ShareExample.js @@ -11,8 +11,13 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, View, Text, TouchableHighlight, Share} = ReactNative; +const { + StyleSheet, + View, + Text, + TouchableHighlight, + Share, +} = require('react-native'); type Props = $ReadOnly<{||}>; type State = {|result: string|}; diff --git a/RNTester/js/Shared/RNTesterTypes.js b/RNTester/js/Shared/RNTesterTypes.js index a07b60d3796213..e451ccde35eae7 100644 --- a/RNTester/js/Shared/RNTesterTypes.js +++ b/RNTester/js/Shared/RNTesterTypes.js @@ -10,7 +10,7 @@ 'use strict'; -import type {ComponentType} from 'React'; +import type {ComponentType} from 'react'; import * as React from 'react'; export type RNTesterProps = $ReadOnly<{| diff --git a/RNTester/js/Shared/TextLegend.js b/RNTester/js/Shared/TextLegend.js index 56cf17607c6b64..5021b8d867b874 100644 --- a/RNTester/js/Shared/TextLegend.js +++ b/RNTester/js/Shared/TextLegend.js @@ -10,7 +10,7 @@ 'use strict'; -const React = require('React'); +const React = require('react'); const {Picker, Text, View} = require('react-native'); class TextLegend extends React.Component<*, *> { diff --git a/RNTester/js/SliderExample.js b/RNTester/js/SliderExample.js index d324e60719039a..5ca17c2baff4a4 100644 --- a/RNTester/js/SliderExample.js +++ b/RNTester/js/SliderExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Slider, Text, StyleSheet, View} = ReactNative; +const {Slider, Text, StyleSheet, View} = require('react-native'); class SliderExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> { static defaultProps = { diff --git a/RNTester/js/SnapshotExample.js b/RNTester/js/SnapshotExample.js index a9a01963fcac24..ee6252e45b1a5c 100644 --- a/RNTester/js/SnapshotExample.js +++ b/RNTester/js/SnapshotExample.js @@ -10,8 +10,14 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Alert, Image, NativeModules, StyleSheet, Text, View} = ReactNative; +const { + Alert, + Image, + NativeModules, + StyleSheet, + Text, + View, +} = require('react-native'); const ScreenshotManager = NativeModules.ScreenshotManager; class ScreenshotExample extends React.Component<{}, $FlowFixMeState> { diff --git a/RNTester/js/SnapshotViewIOS.android.js b/RNTester/js/SnapshotViewIOS.android.js index 7a00b6636cf664..bbcaacae4db100 100644 --- a/RNTester/js/SnapshotViewIOS.android.js +++ b/RNTester/js/SnapshotViewIOS.android.js @@ -9,4 +9,4 @@ 'use strict'; -module.exports = require('UnimplementedView'); +module.exports = require('../../Libraries/Components/UnimplementedViews/UnimplementedView'); diff --git a/RNTester/js/SnapshotViewIOS.ios.js b/RNTester/js/SnapshotViewIOS.ios.js index 9ed3b53d91374c..330cb4bb755061 100644 --- a/RNTester/js/SnapshotViewIOS.ios.js +++ b/RNTester/js/SnapshotViewIOS.ios.js @@ -10,21 +10,19 @@ 'use strict'; -const React = require('React'); -const StyleSheet = require('StyleSheet'); -const UIManager = require('UIManager'); -const View = require('View'); +const React = require('react'); +const {NativeModules, StyleSheet, UIManager, View} = require('react-native'); -const {TestModule} = require('NativeModules'); +const {TestModule} = NativeModules; -import type {SyntheticEvent} from 'CoreEventTypes'; -import type {ViewProps} from 'ViewPropTypes'; +import type {SyntheticEvent} from '../../Libraries/Types/CoreEventTypes'; +import type {ViewProps} from '../../Libraries/Components/View/ViewPropTypes'; // 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 const RCTSnapshot = UIManager.getViewManagerConfig('RCTSnapshot') - ? require('RCTSnapshotNativeComponent') + ? require('../RCTTest/RCTSnapshotNativeComponent') : View; type SnapshotReadyEvent = SyntheticEvent< diff --git a/RNTester/js/StatusBarExample.js b/RNTester/js/StatusBarExample.js index 0e3b06f3447d1a..09972b3c92d9ca 100644 --- a/RNTester/js/StatusBarExample.js +++ b/RNTester/js/StatusBarExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { StatusBar, StyleSheet, @@ -19,7 +18,7 @@ const { TouchableHighlight, View, Modal, -} = ReactNative; +} = require('react-native'); const colors = ['#ff0000', '#00ff00', '#0000ff', 'rgba(0, 0, 0, 0.4)']; diff --git a/RNTester/js/TextExample.android.js b/RNTester/js/TextExample.android.js index 131e5343759937..a29fc01cb88543 100644 --- a/RNTester/js/TextExample.android.js +++ b/RNTester/js/TextExample.android.js @@ -13,8 +13,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Image, StyleSheet, Text, View} = ReactNative; +const {Image, StyleSheet, Text, View} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); const TextLegend = require('./Shared/TextLegend'); diff --git a/RNTester/js/TextExample.ios.js b/RNTester/js/TextExample.ios.js index 0764589897f65c..ee60a003f6e479 100644 --- a/RNTester/js/TextExample.ios.js +++ b/RNTester/js/TextExample.ios.js @@ -10,10 +10,15 @@ 'use strict'; -const Platform = require('Platform'); const React = require('react'); -const ReactNative = require('react-native'); -const {Text, TextInput, View, LayoutAnimation, Button} = ReactNative; +const { + Button, + LayoutAnimation, + Platform, + Text, + TextInput, + View, +} = require('react-native'); const TextLegend = require('./Shared/TextLegend'); type TextAlignExampleRTLState = {| diff --git a/RNTester/js/TextInputExample.android.js b/RNTester/js/TextInputExample.android.js index aaee6d9fba836c..edeb83eb6092f5 100644 --- a/RNTester/js/TextInputExample.android.js +++ b/RNTester/js/TextInputExample.android.js @@ -11,8 +11,14 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Text, TextInput, View, StyleSheet, Slider, Switch} = ReactNative; +const { + Text, + TextInput, + View, + StyleSheet, + Slider, + Switch, +} = require('react-native'); class TextEventsExample extends React.Component<{}, $FlowFixMeState> { state = { diff --git a/RNTester/js/TextInputExample.ios.js b/RNTester/js/TextInputExample.ios.js index 0a342cce868250..a3aea1a754f578 100644 --- a/RNTester/js/TextInputExample.ios.js +++ b/RNTester/js/TextInputExample.ios.js @@ -10,11 +10,18 @@ 'use strict'; -const Button = require('Button'); -const InputAccessoryView = require('InputAccessoryView'); const React = require('react'); -const ReactNative = require('react-native'); -const {Text, TextInput, View, StyleSheet, Slider, Switch, Alert} = ReactNative; +const { + Button, + InputAccessoryView, + Text, + TextInput, + View, + StyleSheet, + Slider, + Switch, + Alert, +} = require('react-native'); class WithLabel extends React.Component<$FlowFixMeProps> { render() { diff --git a/RNTester/js/TimePickerAndroidExample.js b/RNTester/js/TimePickerAndroidExample.js index c14329e10eb001..28c25582b046dd 100644 --- a/RNTester/js/TimePickerAndroidExample.js +++ b/RNTester/js/TimePickerAndroidExample.js @@ -10,13 +10,12 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { TimePickerAndroid, StyleSheet, Text, TouchableWithoutFeedback, -} = ReactNative; +} = require('react-native'); const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); diff --git a/RNTester/js/TimerExample.js b/RNTester/js/TimerExample.js index aaa5268afc3a9c..a67397771a06af 100644 --- a/RNTester/js/TimerExample.js +++ b/RNTester/js/TimerExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Alert, Platform, ToastAndroid, Text, View} = ReactNative; +const {Alert, Platform, ToastAndroid, Text, View} = require('react-native'); const RNTesterButton = require('./RNTesterButton'); const performanceNow = require('fbjs/lib/performanceNow'); diff --git a/RNTester/js/ToastAndroidExample.android.js b/RNTester/js/ToastAndroidExample.android.js index f7e654104cbdac..e2e2208da205b7 100644 --- a/RNTester/js/ToastAndroidExample.android.js +++ b/RNTester/js/ToastAndroidExample.android.js @@ -11,11 +11,15 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, ToastAndroid, TouchableWithoutFeedback} = ReactNative; +const { + StyleSheet, + Text, + ToastAndroid, + TouchableWithoutFeedback, +} = require('react-native'); -const RNTesterBlock = require('RNTesterBlock'); -const RNTesterPage = require('RNTesterPage'); +const RNTesterBlock = require('./RNTesterBlock'); +const RNTesterPage = require('./RNTesterPage'); type Props = $ReadOnly<{||}>; class ToastExample extends React.Component { diff --git a/RNTester/js/ToolbarAndroidExample.android.js b/RNTester/js/ToolbarAndroidExample.android.js index 3abb48a36c017e..86d0e976c04cf6 100644 --- a/RNTester/js/ToolbarAndroidExample.android.js +++ b/RNTester/js/ToolbarAndroidExample.android.js @@ -11,16 +11,19 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); +const { + StyleSheet, + Switch, + Text, + ToolbarAndroid, + View, +} = require('react-native'); + +const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); -const nativeImageSource = require('nativeImageSource'); -const {StyleSheet, Text, View} = ReactNative; const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); -const Switch = require('Switch'); -const ToolbarAndroid = require('ToolbarAndroid'); - class ToolbarAndroidExample extends React.Component<{}, $FlowFixMeState> { state = { actionText: 'Example app with toolbar component', diff --git a/RNTester/js/ToolbarAndroidExample.ios.js b/RNTester/js/ToolbarAndroidExample.ios.js index 0162198954717e..6d1eff69dc8b28 100644 --- a/RNTester/js/ToolbarAndroidExample.ios.js +++ b/RNTester/js/ToolbarAndroidExample.ios.js @@ -10,5 +10,7 @@ 'use strict'; +const {View} = require('react-native'); + // Not applicable to iOS. -module.exports = require('View'); +module.exports = View; diff --git a/RNTester/js/TouchableExample.js b/RNTester/js/TouchableExample.js index 4eaa52f6277b2b..7e4e348cb3a2b8 100644 --- a/RNTester/js/TouchableExample.js +++ b/RNTester/js/TouchableExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Animated, Image, @@ -19,13 +18,12 @@ const { Text, TouchableHighlight, TouchableOpacity, + NativeModules, Platform, TouchableNativeFeedback, TouchableWithoutFeedback, View, -} = ReactNative; - -const NativeModules = require('NativeModules'); +} = require('react-native'); const forceTouchAvailable = (NativeModules.PlatformConstants && diff --git a/RNTester/js/TransformExample.js b/RNTester/js/TransformExample.js index 32a1c7f9fe749e..256a4b385e2e54 100644 --- a/RNTester/js/TransformExample.js +++ b/RNTester/js/TransformExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Animated, StyleSheet, Text, View} = ReactNative; +const {Animated, StyleSheet, Text, View} = require('react-native'); class Flip extends React.Component<{}, $FlowFixMeState> { state = { diff --git a/RNTester/js/TransparentHitTestExample.js b/RNTester/js/TransparentHitTestExample.js index 908183bf56fdae..e4cdee4d784a2b 100644 --- a/RNTester/js/TransparentHitTestExample.js +++ b/RNTester/js/TransparentHitTestExample.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {Text, View, TouchableOpacity, Alert} = ReactNative; +const {Text, View, TouchableOpacity, Alert} = require('react-native'); class TransparentHitTestExample extends React.Component<{}> { render() { diff --git a/RNTester/js/VibrationExample.js b/RNTester/js/VibrationExample.js index 32f2b2f5f1c7c6..a40b3de9e2f152 100644 --- a/RNTester/js/VibrationExample.js +++ b/RNTester/js/VibrationExample.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { StyleSheet, View, @@ -19,7 +18,7 @@ const { TouchableHighlight, Vibration, Platform, -} = ReactNative; +} = require('react-native'); exports.framework = 'React'; exports.title = 'Vibration'; diff --git a/RNTester/js/ViewExample.js b/RNTester/js/ViewExample.js index 832be7f51be8c8..25dc2641f72657 100644 --- a/RNTester/js/ViewExample.js +++ b/RNTester/js/ViewExample.js @@ -13,8 +13,12 @@ /* eslint-disable react-native/no-inline-styles */ const React = require('react'); -const {StyleSheet, Text, View} = require('react-native'); -const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); +const { + StyleSheet, + Text, + TouchableWithoutFeedback, + View, +} = require('react-native'); exports.title = ''; exports.description = diff --git a/RNTester/js/ViewPagerAndroidExample.android.js b/RNTester/js/ViewPagerAndroidExample.android.js index ebd01df8be854c..0be94e6a6719a3 100644 --- a/RNTester/js/ViewPagerAndroidExample.android.js +++ b/RNTester/js/ViewPagerAndroidExample.android.js @@ -10,7 +10,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Image, StyleSheet, @@ -19,9 +18,9 @@ const { TouchableOpacity, View, ViewPagerAndroid, -} = ReactNative; +} = require('react-native'); -import type {ViewPagerScrollState} from 'ViewPagerAndroid'; +import type {ViewPagerScrollState} from '../../Libraries/Components/ViewPager/ViewPagerAndroid'; const PAGES = 5; const BGCOLOR = ['#fdc08e', '#fff6b9', '#99d1b7', '#dde5fe', '#f79273']; diff --git a/RNTester/js/WebSocketExample.js b/RNTester/js/WebSocketExample.js index 82ee4dbc53a916..bd42e595e3534e 100644 --- a/RNTester/js/WebSocketExample.js +++ b/RNTester/js/WebSocketExample.js @@ -11,7 +11,6 @@ /* eslint-env browser */ const React = require('react'); -const ReactNative = require('react-native'); const { Image, PixelRatio, @@ -21,7 +20,7 @@ const { TextInput, TouchableOpacity, View, -} = ReactNative; +} = require('react-native'); const DEFAULT_WS_URL = 'ws://localhost:5555/'; const DEFAULT_HTTP_URL = 'http://localhost:5556/'; diff --git a/RNTester/js/XHRExampleBinaryUpload.js b/RNTester/js/XHRExampleBinaryUpload.js index dd896b5750e2ed..59efcc192db182 100644 --- a/RNTester/js/XHRExampleBinaryUpload.js +++ b/RNTester/js/XHRExampleBinaryUpload.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Alert, Linking, @@ -20,7 +19,7 @@ const { Text, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); const BINARY_TYPES = { String, diff --git a/RNTester/js/XHRExampleDownload.js b/RNTester/js/XHRExampleDownload.js index 5555bd900538a4..530e552b737d6c 100644 --- a/RNTester/js/XHRExampleDownload.js +++ b/RNTester/js/XHRExampleDownload.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { Alert, Platform, @@ -22,7 +21,7 @@ const { Text, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); /** * Convert number of bytes to MB and round to the nearest 0.1 MB. diff --git a/RNTester/js/XHRExampleFetch.js b/RNTester/js/XHRExampleFetch.js index 1377f18c34a58d..d81275c775e52e 100644 --- a/RNTester/js/XHRExampleFetch.js +++ b/RNTester/js/XHRExampleFetch.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, TextInput, View, Platform} = ReactNative; +const {StyleSheet, Text, TextInput, View, Platform} = require('react-native'); class XHRExampleFetch extends React.Component { responseURL: ?string; diff --git a/RNTester/js/XHRExampleFormData.js b/RNTester/js/XHRExampleFormData.js index 9c2874f59f5daf..5097b6a35c6be8 100644 --- a/RNTester/js/XHRExampleFormData.js +++ b/RNTester/js/XHRExampleFormData.js @@ -11,7 +11,6 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); const { CameraRoll, Image, @@ -22,7 +21,7 @@ const { TextInput, TouchableHighlight, View, -} = ReactNative; +} = require('react-native'); const XHRExampleBinaryUpload = require('./XHRExampleBinaryUpload'); diff --git a/RNTester/js/XHRExampleHeaders.js b/RNTester/js/XHRExampleHeaders.js index 074df010b00d42..6d26ff71b33e61 100644 --- a/RNTester/js/XHRExampleHeaders.js +++ b/RNTester/js/XHRExampleHeaders.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, TouchableHighlight, View} = ReactNative; +const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); class XHRExampleHeaders extends React.Component { xhr: XMLHttpRequest; diff --git a/RNTester/js/XHRExampleOnTimeOut.js b/RNTester/js/XHRExampleOnTimeOut.js index 095dd3631356b4..dc25d4ef113c3a 100644 --- a/RNTester/js/XHRExampleOnTimeOut.js +++ b/RNTester/js/XHRExampleOnTimeOut.js @@ -11,8 +11,7 @@ 'use strict'; const React = require('react'); -const ReactNative = require('react-native'); -const {StyleSheet, Text, TouchableHighlight, View} = ReactNative; +const {StyleSheet, Text, TouchableHighlight, View} = require('react-native'); class XHRExampleOnTimeOut extends React.Component { xhr: XMLHttpRequest; diff --git a/RNTester/js/createExamplePage.js b/RNTester/js/createExamplePage.js index 57037cde057aec..1b70fe5a91e9be 100644 --- a/RNTester/js/createExamplePage.js +++ b/RNTester/js/createExamplePage.js @@ -13,7 +13,7 @@ const React = require('react'); const RNTesterExampleContainer = require('./RNTesterExampleContainer'); -import type {RNTesterExample} from 'RNTesterTypes'; +import type {RNTesterExample} from './Shared/RNTesterTypes'; const createExamplePage = function( title: ?string,