From 392fb667949fa4bcacdab03e3f1cf733e573372f Mon Sep 17 00:00:00 2001 From: James Ide Date: Thu, 4 Apr 2019 16:16:22 -0700 Subject: [PATCH] [standards] Rewrite imports in RNTester to use standard paths See https://github.com/facebook/react-native/issues/24316 for the motivation. This commit rewrites the imports in the RNTester project. Test Plan: Run RNTester and verify that it loads without any issues. Tap through each screen to ensure the JS modules load (that is, were bundled) correctly. --- .flowconfig | 4 ++ .../NativeScreenshotManager.js | 4 +- .../RCTTest/RCTSnapshotNativeComponent.js | 8 ++-- RNTester/js/AnimatedGratuitousApp/AnExApp.js | 2 +- RNTester/js/AssetScaledImageExample.js | 2 +- RNTester/js/CameraRollExample.js | 5 ++- RNTester/js/CameraRollView.js | 6 +-- RNTester/js/FlatListExample.js | 4 +- RNTester/js/ImageCapInsetsExample.js | 2 +- RNTester/js/InputAccessoryViewExample.js | 2 +- RNTester/js/KeyboardAvoidingViewExample.js | 2 +- RNTester/js/LayoutEventsExample.js | 5 ++- RNTester/js/MultiColumnExample.js | 2 +- RNTester/js/NativeAnimationsExample.js | 24 +++++++----- RNTester/js/OrientationChangeExample.js | 2 +- RNTester/js/PanResponderExample.js | 7 +++- RNTester/js/PickerExample.js | 2 +- .../js/ProgressBarAndroidExample.android.js | 10 ++--- RNTester/js/PushNotificationIOSExample.js | 38 +++++++++++-------- RNTester/js/RCTRootViewIOSExample.js | 2 +- RNTester/js/RNTesterApp.android.js | 24 ++++++------ RNTester/js/RNTesterApp.ios.js | 10 ++--- RNTester/js/RNTesterButton.js | 2 +- RNTester/js/RNTesterExampleFilter.js | 6 +-- RNTester/js/RNTesterExampleList.js | 16 ++++---- RNTester/js/RNTesterList.android.js | 2 +- RNTester/js/RNTesterList.ios.js | 2 +- RNTester/js/RNTesterSettingSwitchRow.js | 10 ++--- RNTester/js/RNTesterStatePersister.js | 4 +- RNTester/js/RTLExample.js | 2 +- RNTester/js/SafeAreaViewExample.js | 16 ++++---- RNTester/js/ScrollViewExample.js | 4 +- RNTester/js/SectionListExample.js | 2 +- RNTester/js/Shared/RNTesterTypes.js | 2 +- RNTester/js/Shared/TextLegend.js | 2 +- RNTester/js/SnapshotViewIOS.android.js | 2 +- RNTester/js/SnapshotViewIOS.ios.js | 16 ++++---- RNTester/js/TextExample.ios.js | 2 +- RNTester/js/TextInputExample.ios.js | 4 +- RNTester/js/ToastAndroidExample.android.js | 4 +- RNTester/js/ToolbarAndroidExample.android.js | 6 +-- RNTester/js/ToolbarAndroidExample.ios.js | 2 +- RNTester/js/TouchableExample.js | 2 +- RNTester/js/ViewExample.js | 2 +- .../js/ViewPagerAndroidExample.android.js | 2 +- RNTester/js/createExamplePage.js | 2 +- 46 files changed, 152 insertions(+), 129 deletions(-) diff --git a/.flowconfig b/.flowconfig index 797e4cb47f3262..c7e417fd273982 100644 --- a/.flowconfig +++ b/.flowconfig @@ -67,6 +67,10 @@ module.system.haste.paths.whitelist=/IntegrationTests/.* module.system.haste.paths.blacklist=/Libraries/react-native/react-native-implementation.js module.system.haste.paths.blacklist=/Libraries/Animated/src/polyfills/.* +module.file_ext=.js +module.file_ext=.json +module.file_ext=.ios.js + munge_underscores=true module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 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..d719d9e91666ff 100644 --- a/RNTester/RCTTest/RCTSnapshotNativeComponent.js +++ b/RNTester/RCTTest/RCTSnapshotNativeComponent.js @@ -10,9 +10,9 @@ 'use strict'; -import type {SyntheticEvent} from 'CoreEventTypes'; -import type {ViewProps} from 'ViewPropTypes'; -import type {NativeComponent} from 'ReactNative'; +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,7 +28,7 @@ type NativeProps = $ReadOnly<{| type SnapshotViewNativeType = Class>; -const requireNativeComponent = require('requireNativeComponent'); +const requireNativeComponent = require('../../Libraries/ReactNative/requireNativeComponent'); module.exports = ((requireNativeComponent( 'RCTSnapshot', diff --git a/RNTester/js/AnimatedGratuitousApp/AnExApp.js b/RNTester/js/AnimatedGratuitousApp/AnExApp.js index be1142bd4544f2..0f506c499a0a75 100644 --- a/RNTester/js/AnimatedGratuitousApp/AnExApp.js +++ b/RNTester/js/AnimatedGratuitousApp/AnExApp.js @@ -14,7 +14,7 @@ const React = require('react'); const ReactNative = require('react-native'); const {Animated, LayoutAnimation, PanResponder, StyleSheet, View} = ReactNative; -const AnExSet = require('AnExSet'); +const AnExSet = require('./AnExSet'); const CIRCLE_SIZE = 80; const CIRCLE_MARGIN = 18; diff --git a/RNTester/js/AssetScaledImageExample.js b/RNTester/js/AssetScaledImageExample.js index fb50653a1de54f..b3603b817b502b 100644 --- a/RNTester/js/AssetScaledImageExample.js +++ b/RNTester/js/AssetScaledImageExample.js @@ -14,7 +14,7 @@ const React = require('react'); const ReactNative = require('react-native'); const {Image, StyleSheet, View, ScrollView} = ReactNative; -import type {PhotoIdentifier} from 'CameraRoll'; +import type {PhotoIdentifier} from '../../Libraries/CameraRoll/CameraRoll'; type Props = $ReadOnly<{| asset: PhotoIdentifier, diff --git a/RNTester/js/CameraRollExample.js b/RNTester/js/CameraRollExample.js index c7a723c3ae7533..aa949bd51d675d 100644 --- a/RNTester/js/CameraRollExample.js +++ b/RNTester/js/CameraRollExample.js @@ -28,7 +28,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..2a92e0186ee280 100644 --- a/RNTester/js/CameraRollView.js +++ b/RNTester/js/CameraRollView.js @@ -24,14 +24,14 @@ const { View, } = ReactNative; -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/FlatListExample.js b/RNTester/js/FlatListExample.js index 2277b1fa621c53..71645c325f98df 100644 --- a/RNTester/js/FlatListExample.js +++ b/RNTester/js/FlatListExample.js @@ -12,14 +12,14 @@ import type {Item} from './ListExampleShared'; -const Alert = require('Alert'); +const Alert = require('../../Libraries/Alert/Alert'); const React = require('react'); const ReactNative = require('react-native'); const {Animated, StyleSheet, View} = ReactNative; 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/InputAccessoryViewExample.js b/RNTester/js/InputAccessoryViewExample.js index 7337e34170c0ab..72df5c18239dd7 100644 --- a/RNTester/js/InputAccessoryViewExample.js +++ b/RNTester/js/InputAccessoryViewExample.js @@ -10,7 +10,7 @@ 'use strict'; -const React = require('React'); +const React = require('react'); const ReactNative = require('react-native'); const { Alert, diff --git a/RNTester/js/KeyboardAvoidingViewExample.js b/RNTester/js/KeyboardAvoidingViewExample.js index b3c84d18e3fc0b..0374e8bb4726f9 100644 --- a/RNTester/js/KeyboardAvoidingViewExample.js +++ b/RNTester/js/KeyboardAvoidingViewExample.js @@ -9,7 +9,7 @@ 'use strict'; -const React = require('React'); +const React = require('react'); const ReactNative = require('react-native'); const { KeyboardAvoidingView, diff --git a/RNTester/js/LayoutEventsExample.js b/RNTester/js/LayoutEventsExample.js index 84f38fa48978ad..55c3ce4aa6b361 100644 --- a/RNTester/js/LayoutEventsExample.js +++ b/RNTester/js/LayoutEventsExample.js @@ -14,7 +14,10 @@ const React = require('react'); const ReactNative = require('react-native'); const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; -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/MultiColumnExample.js b/RNTester/js/MultiColumnExample.js index c7ae28a997efc9..12b162649c5606 100644 --- a/RNTester/js/MultiColumnExample.js +++ b/RNTester/js/MultiColumnExample.js @@ -16,7 +16,7 @@ const {FlatList, StyleSheet, Text, View, Alert} = ReactNative; 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..3a1eab9d945883 100644 --- a/RNTester/js/NativeAnimationsExample.js +++ b/RNTester/js/NativeAnimationsExample.js @@ -155,7 +155,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 +188,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/OrientationChangeExample.js b/RNTester/js/OrientationChangeExample.js index 933745f060c512..5c6f232995a1ce 100644 --- a/RNTester/js/OrientationChangeExample.js +++ b/RNTester/js/OrientationChangeExample.js @@ -14,7 +14,7 @@ const React = require('react'); const ReactNative = require('react-native'); const {DeviceEventEmitter, Text, View} = ReactNative; -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..e07d55bbfb7847 100644 --- a/RNTester/js/PanResponderExample.js +++ b/RNTester/js/PanResponderExample.js @@ -14,8 +14,11 @@ const React = require('react'); const ReactNative = require('react-native'); const {PanResponder, StyleSheet, View} = ReactNative; -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/PickerExample.js b/RNTester/js/PickerExample.js index 2d308c953549b2..ea0d6c2b094c2c 100644 --- a/RNTester/js/PickerExample.js +++ b/RNTester/js/PickerExample.js @@ -12,7 +12,7 @@ const React = require('react'); const ReactNative = require('react-native'); -const StyleSheet = require('StyleSheet'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); const {Picker, Text} = ReactNative; diff --git a/RNTester/js/ProgressBarAndroidExample.android.js b/RNTester/js/ProgressBarAndroidExample.android.js index f88567d8f006a4..c98a9b7d6468c4 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 ProgressBar = require('../../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid'); +const React = require('react'); +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/PushNotificationIOSExample.js b/RNTester/js/PushNotificationIOSExample.js index 62066f1f09a11c..ff63d531266d86 100644 --- a/RNTester/js/PushNotificationIOSExample.js +++ b/RNTester/js/PushNotificationIOSExample.js @@ -86,27 +86,33 @@ class NotificationExample extends React.Component<{}> { } _sendNotification() { - require('RCTDeviceEventEmitter').emit('remoteNotificationReceived', { - remote: true, - aps: { - alert: 'Sample notification', - badge: '+1', - sound: 'default', - category: 'REACT_NATIVE', - 'content-available': 1, + require('../../Libraries/EventEmitter/RCTDeviceEventEmitter').emit( + 'remoteNotificationReceived', + { + remote: true, + aps: { + alert: 'Sample notification', + badge: '+1', + sound: 'default', + category: 'REACT_NATIVE', + 'content-available': 1, + }, }, - }); + ); } _sendLocalNotification() { - require('RCTDeviceEventEmitter').emit('localNotificationReceived', { - aps: { - alert: 'Sample local notification', - badge: '+1', - sound: 'default', - category: 'REACT_NATIVE', + require('../../Libraries/EventEmitter/RCTDeviceEventEmitter').emit( + 'localNotificationReceived', + { + aps: { + alert: 'Sample local notification', + badge: '+1', + sound: 'default', + category: 'REACT_NATIVE', + }, }, - }); + ); } _onRegistered(deviceToken) { diff --git a/RNTester/js/RCTRootViewIOSExample.js b/RNTester/js/RCTRootViewIOSExample.js index 397dfe22e5fedb..5c385c30fbe7b4 100644 --- a/RNTester/js/RCTRootViewIOSExample.js +++ b/RNTester/js/RCTRootViewIOSExample.js @@ -14,7 +14,7 @@ const React = require('react'); const ReactNative = require('react-native'); const {StyleSheet, Text, View} = ReactNative; -const requireNativeComponent = require('requireNativeComponent'); +const requireNativeComponent = require('../../Libraries/ReactNative/requireNativeComponent'); class AppPropertiesUpdateExample extends React.Component<{}> { render() { diff --git a/RNTester/js/RNTesterApp.android.js b/RNTester/js/RNTesterApp.android.js index 16c6660e0742e9..ef3a8326040378 100644 --- a/RNTester/js/RNTesterApp.android.js +++ b/RNTester/js/RNTesterApp.android.js @@ -10,16 +10,16 @@ '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 AppRegistry = require('../../Libraries/ReactNative/AppRegistry'); +const AsyncStorage = require('../../Libraries/Storage/AsyncStorage'); +const BackHandler = require('../../Libraries/Utilities/BackHandler'); +const Dimensions = require('../../Libraries/Utilities/Dimensions'); +const DrawerLayoutAndroid = require('../../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid'); +const Linking = require('../../Libraries/Linking/Linking'); const React = require('react'); -const StatusBar = require('StatusBar'); -const StyleSheet = require('StyleSheet'); -const ToolbarAndroid = require('ToolbarAndroid'); +const StatusBar = require('../../Libraries/Components/StatusBar/StatusBar'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); +const ToolbarAndroid = require('../../Libraries/Components/ToolbarAndroid/ToolbarAndroid'); const RNTesterActions = require('./RNTesterActions'); const RNTesterExampleContainer = require('./RNTesterExampleContainer'); const RNTesterExampleList = require('./RNTesterExampleList'); @@ -27,11 +27,11 @@ const RNTesterExampleList = require('./RNTesterExampleList'); * making Flow check .android.js files. */ const RNTesterList = require('./RNTesterList'); const RNTesterNavigationReducer = require('./RNTesterNavigationReducer'); -const UIManager = require('UIManager'); +const UIManager = require('../../Libraries/ReactNative/UIManager'); const URIActionMap = require('./URIActionMap'); -const View = require('View'); +const View = require('../../Libraries/Components/View/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..2612437c66f5fa 100644 --- a/RNTester/js/RNTesterApp.ios.js +++ b/RNTester/js/RNTesterApp.ios.js @@ -10,10 +10,10 @@ 'use strict'; -require('InitializeCore'); -const AsyncStorage = require('AsyncStorage'); -const BackHandler = require('BackHandler'); -const Linking = require('Linking'); +require('../../Libraries/Core/InitializeCore'); +const AsyncStorage = require('../../Libraries/Storage/AsyncStorage'); +const BackHandler = require('../../Libraries/Utilities/BackHandler'); +const Linking = require('../../Libraries/Linking/Linking'); const React = require('react'); const ReactNative = require('react-native'); const RNTesterActions = require('./RNTesterActions'); @@ -34,7 +34,7 @@ const { 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..a3143a8deb16a3 100644 --- a/RNTester/js/RNTesterExampleFilter.js +++ b/RNTester/js/RNTesterExampleFilter.js @@ -11,9 +11,9 @@ 'use strict'; const React = require('react'); -const StyleSheet = require('StyleSheet'); -const TextInput = require('TextInput'); -const View = require('View'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); +const TextInput = require('../../Libraries/Components/TextInput/TextInput'); +const View = require('../../Libraries/Components/View/View'); type Props = { filter: Function, diff --git a/RNTester/js/RNTesterExampleList.js b/RNTester/js/RNTesterExampleList.js index a52875a90e6094..6fbf1bda00a8e6 100644 --- a/RNTester/js/RNTesterExampleList.js +++ b/RNTester/js/RNTesterExampleList.js @@ -10,18 +10,18 @@ 'use strict'; -const Platform = require('Platform'); +const Platform = require('../../Libraries/Utilities/Platform'); const React = require('react'); -const SectionList = require('SectionList'); -const StyleSheet = require('StyleSheet'); -const Text = require('Text'); -const TouchableHighlight = require('TouchableHighlight'); +const SectionList = require('../../Libraries/Lists/SectionList'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); +const Text = require('../../Libraries/Text/Text'); +const TouchableHighlight = require('../../Libraries/Components/Touchable/TouchableHighlight'); const RNTesterActions = require('./RNTesterActions'); const RNTesterExampleFilter = require('./RNTesterExampleFilter'); -const View = require('View'); +const View = require('../../Libraries/Components/View/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..d8032ccb6d531e 100644 --- a/RNTester/js/RNTesterSettingSwitchRow.js +++ b/RNTester/js/RNTesterSettingSwitchRow.js @@ -10,12 +10,12 @@ 'use strict'; -const React = require('React'); -const StyleSheet = require('StyleSheet'); -const Switch = require('Switch'); -const Text = require('Text'); +const React = require('react'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); +const Switch = require('../../Libraries/Components/Switch/Switch'); +const Text = require('../../Libraries/Text/Text'); const RNTesterStatePersister = require('./RNTesterStatePersister'); -const View = require('View'); +const View = require('../../Libraries/Components/View/View'); class RNTesterSettingSwitchRow extends React.Component< $FlowFixMeProps, diff --git a/RNTester/js/RNTesterStatePersister.js b/RNTester/js/RNTesterStatePersister.js index 720e2616f414d1..063d9f0b693140 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 AsyncStorage = require('../../Libraries/Storage/AsyncStorage'); +const React = require('react'); export type PassProps = { state: State, diff --git a/RNTester/js/RTLExample.js b/RNTester/js/RTLExample.js index a58b744709ab46..780fd462b5440d 100644 --- a/RNTester/js/RTLExample.js +++ b/RNTester/js/RTLExample.js @@ -24,7 +24,7 @@ const { View, Button, } = ReactNative; -const Platform = require('Platform'); +const Platform = require('../../Libraries/Utilities/Platform'); type State = { toggleStatus: any, diff --git a/RNTester/js/SafeAreaViewExample.js b/RNTester/js/SafeAreaViewExample.js index 0dbc79e0947601..b25f8ae212180e 100644 --- a/RNTester/js/SafeAreaViewExample.js +++ b/RNTester/js/SafeAreaViewExample.js @@ -9,15 +9,15 @@ */ 'use strict'; -const Button = require('Button'); -const DeviceInfo = require('DeviceInfo'); -const Modal = require('Modal'); +const Button = require('../../Libraries/Components/Button'); +const DeviceInfo = require('../../Libraries/Utilities/DeviceInfo'); +const Modal = require('../../Libraries/Modal/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 SafeAreaView = require('../../Libraries/Components/SafeAreaView/SafeAreaView'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); +const Switch = require('../../Libraries/Components/Switch/Switch'); +const Text = require('../../Libraries/Text/Text'); +const View = require('../../Libraries/Components/View/View'); class SafeAreaViewExample extends React.Component< {}, diff --git a/RNTester/js/ScrollViewExample.js b/RNTester/js/ScrollViewExample.js index 32c2e4b1a92905..6b4180100741e9 100644 --- a/RNTester/js/ScrollViewExample.js +++ b/RNTester/js/ScrollViewExample.js @@ -9,7 +9,7 @@ */ 'use strict'; -const Platform = require('Platform'); +const Platform = require('../../Libraries/Utilities/Platform'); const React = require('react'); const ReactNative = require('react-native'); const { @@ -21,7 +21,7 @@ const { Image, } = ReactNative; -import type {ViewStyleProp} from 'StyleSheet'; +import type {ViewStyleProp} from '../../Libraries/StyleSheet/StyleSheet'; exports.displayName = 'ScrollViewExample'; exports.title = ''; diff --git a/RNTester/js/SectionListExample.js b/RNTester/js/SectionListExample.js index 455b1d36efcc0b..59d8076db45b4b 100644 --- a/RNTester/js/SectionListExample.js +++ b/RNTester/js/SectionListExample.js @@ -16,7 +16,7 @@ const {Alert, Animated, Button, StyleSheet, Text, View} = ReactNative; const RNTesterPage = require('./RNTesterPage'); -const infoLog = require('infoLog'); +const infoLog = require('../../Libraries/Utilities/infoLog'); const { HeaderComponent, 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/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..f215897bb0e4e9 100644 --- a/RNTester/js/SnapshotViewIOS.ios.js +++ b/RNTester/js/SnapshotViewIOS.ios.js @@ -10,21 +10,21 @@ 'use strict'; -const React = require('React'); -const StyleSheet = require('StyleSheet'); -const UIManager = require('UIManager'); -const View = require('View'); +const React = require('react'); +const StyleSheet = require('../../Libraries/StyleSheet/StyleSheet'); +const UIManager = require('../../Libraries/ReactNative/UIManager'); +const View = require('../../Libraries/Components/View/View'); -const {TestModule} = require('NativeModules'); +const {TestModule} = require('../../Libraries/BatchedBridge/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/TextExample.ios.js b/RNTester/js/TextExample.ios.js index 0764589897f65c..52f624ffaade37 100644 --- a/RNTester/js/TextExample.ios.js +++ b/RNTester/js/TextExample.ios.js @@ -10,7 +10,7 @@ 'use strict'; -const Platform = require('Platform'); +const Platform = require('../../Libraries/Utilities/Platform'); const React = require('react'); const ReactNative = require('react-native'); const {Text, TextInput, View, LayoutAnimation, Button} = ReactNative; diff --git a/RNTester/js/TextInputExample.ios.js b/RNTester/js/TextInputExample.ios.js index 0a342cce868250..09370d03b6824a 100644 --- a/RNTester/js/TextInputExample.ios.js +++ b/RNTester/js/TextInputExample.ios.js @@ -10,8 +10,8 @@ 'use strict'; -const Button = require('Button'); -const InputAccessoryView = require('InputAccessoryView'); +const Button = require('../../Libraries/Components/Button'); +const InputAccessoryView = require('../../Libraries/Components/TextInput/InputAccessoryView'); const React = require('react'); const ReactNative = require('react-native'); const {Text, TextInput, View, StyleSheet, Slider, Switch, Alert} = ReactNative; diff --git a/RNTester/js/ToastAndroidExample.android.js b/RNTester/js/ToastAndroidExample.android.js index f7e654104cbdac..2744bd0ee7ddd4 100644 --- a/RNTester/js/ToastAndroidExample.android.js +++ b/RNTester/js/ToastAndroidExample.android.js @@ -14,8 +14,8 @@ const React = require('react'); const ReactNative = require('react-native'); const {StyleSheet, Text, ToastAndroid, TouchableWithoutFeedback} = ReactNative; -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..f8e8e711b33a33 100644 --- a/RNTester/js/ToolbarAndroidExample.android.js +++ b/RNTester/js/ToolbarAndroidExample.android.js @@ -13,13 +13,13 @@ const React = require('react'); const ReactNative = require('react-native'); -const nativeImageSource = require('nativeImageSource'); +const nativeImageSource = require('../../Libraries/Image/nativeImageSource'); const {StyleSheet, Text, View} = ReactNative; const RNTesterBlock = require('./RNTesterBlock'); const RNTesterPage = require('./RNTesterPage'); -const Switch = require('Switch'); -const ToolbarAndroid = require('ToolbarAndroid'); +const Switch = require('../../Libraries/Components/Switch/Switch'); +const ToolbarAndroid = require('../../Libraries/Components/ToolbarAndroid/ToolbarAndroid'); class ToolbarAndroidExample extends React.Component<{}, $FlowFixMeState> { state = { diff --git a/RNTester/js/ToolbarAndroidExample.ios.js b/RNTester/js/ToolbarAndroidExample.ios.js index 0162198954717e..95299687f24980 100644 --- a/RNTester/js/ToolbarAndroidExample.ios.js +++ b/RNTester/js/ToolbarAndroidExample.ios.js @@ -11,4 +11,4 @@ 'use strict'; // Not applicable to iOS. -module.exports = require('View'); +module.exports = require('../../Libraries/Components/View/View'); diff --git a/RNTester/js/TouchableExample.js b/RNTester/js/TouchableExample.js index 4eaa52f6277b2b..1eb06627c9c47f 100644 --- a/RNTester/js/TouchableExample.js +++ b/RNTester/js/TouchableExample.js @@ -25,7 +25,7 @@ const { View, } = ReactNative; -const NativeModules = require('NativeModules'); +const NativeModules = require('../../Libraries/BatchedBridge/NativeModules'); const forceTouchAvailable = (NativeModules.PlatformConstants && diff --git a/RNTester/js/ViewExample.js b/RNTester/js/ViewExample.js index 832be7f51be8c8..7cafa9b51793bb 100644 --- a/RNTester/js/ViewExample.js +++ b/RNTester/js/ViewExample.js @@ -14,7 +14,7 @@ const React = require('react'); const {StyleSheet, Text, View} = require('react-native'); -const TouchableWithoutFeedback = require('TouchableWithoutFeedback'); +const TouchableWithoutFeedback = require('../../Libraries/Components/Touchable/TouchableWithoutFeedback'); exports.title = ''; exports.description = diff --git a/RNTester/js/ViewPagerAndroidExample.android.js b/RNTester/js/ViewPagerAndroidExample.android.js index ebd01df8be854c..e82caa3d828d80 100644 --- a/RNTester/js/ViewPagerAndroidExample.android.js +++ b/RNTester/js/ViewPagerAndroidExample.android.js @@ -21,7 +21,7 @@ const { ViewPagerAndroid, } = ReactNative; -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/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,