Skip to content

Commit 7244c35

Browse files
committed
[standards] Rewrite imports in RNTester to use standard paths
See #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.
1 parent 0f909e3 commit 7244c35

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+156
-129
lines changed

.flowconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ module.system.haste.paths.whitelist=<PROJECT_ROOT>/IntegrationTests/.*
6363
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/react-native/react-native-implementation.js
6464
module.system.haste.paths.blacklist=<PROJECT_ROOT>/Libraries/Animated/src/polyfills/.*
6565

66+
module.file_ext=.js
67+
module.file_ext=.json
68+
module.file_ext=.ios.js
69+
6670
munge_underscores=true
6771

6872
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'

.flowconfig.android

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ emoji=true
4444
esproposal.optional_chaining=enable
4545
esproposal.nullish_coalescing=enable
4646

47+
module.file_ext=.js
48+
module.file_ext=.json
49+
module.file_ext=.android.js
50+
4751
module.system=haste
4852
module.system.haste.use_name_reducers=true
4953
# keep the following in sync with server/haste/hasteImpl.js

RNTester/NativeModuleExample/NativeScreenshotManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
'use strict';
1212

13-
import type {TurboModule} from 'RCTExport';
14-
import * as TurboModuleRegistry from 'TurboModuleRegistry';
13+
import type {TurboModule} from '../../Libraries/TurboModule/RCTExport';
14+
import * as TurboModuleRegistry from '../../Libraries/TurboModule/TurboModuleRegistry';
1515

1616
export interface Spec extends TurboModule {
1717
+getConstants: () => {||};

RNTester/RCTTest/RCTSnapshotNativeComponent.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
'use strict';
1212

13-
import type {SyntheticEvent} from 'CoreEventTypes';
14-
import type {ViewProps} from 'ViewPropTypes';
15-
import type {NativeComponent} from 'ReactNative';
13+
import type {SyntheticEvent} from '../../Libraries/Types/CoreEventTypes';
14+
import type {ViewProps} from '../../Libraries/Components/View/ViewPropTypes';
15+
import type {NativeComponent} from '../../Libraries/Renderer/shims/ReactNative';
1616

1717
type SnapshotReadyEvent = SyntheticEvent<
1818
$ReadOnly<{
@@ -28,7 +28,7 @@ type NativeProps = $ReadOnly<{|
2828

2929
type SnapshotViewNativeType = Class<NativeComponent<NativeProps>>;
3030

31-
const requireNativeComponent = require('requireNativeComponent');
31+
const requireNativeComponent = require('../../Libraries/ReactNative/requireNativeComponent');
3232

3333
module.exports = ((requireNativeComponent(
3434
'RCTSnapshot',

RNTester/js/AnimatedGratuitousApp/AnExApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const React = require('react');
1414
const ReactNative = require('react-native');
1515
const {Animated, LayoutAnimation, PanResponder, StyleSheet, View} = ReactNative;
1616

17-
const AnExSet = require('AnExSet');
17+
const AnExSet = require('./AnExSet');
1818

1919
const CIRCLE_SIZE = 80;
2020
const CIRCLE_MARGIN = 18;

RNTester/js/AssetScaledImageExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const React = require('react');
1414
const ReactNative = require('react-native');
1515
const {Image, StyleSheet, View, ScrollView} = ReactNative;
1616

17-
import type {PhotoIdentifier} from 'CameraRoll';
17+
import type {PhotoIdentifier} from '../../Libraries/CameraRoll/CameraRoll';
1818

1919
type Props = $ReadOnly<{|
2020
asset: PhotoIdentifier,

RNTester/js/CameraRollExample.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ const CameraRollView = require('./CameraRollView');
2828

2929
const AssetScaledImageExampleView = require('./AssetScaledImageExample');
3030

31-
import type {PhotoIdentifier, GroupTypes} from 'CameraRoll';
31+
import type {
32+
PhotoIdentifier,
33+
GroupTypes,
34+
} from '../../Libraries/CameraRoll/CameraRoll';
3235

3336
type Props = $ReadOnly<{|
3437
navigator?: ?Array<

RNTester/js/CameraRollView.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ const {
2424
View,
2525
} = ReactNative;
2626

27-
const groupByEveryN = require('groupByEveryN');
28-
const logError = require('logError');
27+
const groupByEveryN = require('../../Libraries/Utilities/groupByEveryN');
28+
const logError = require('../../Libraries/Utilities/logError');
2929

3030
import type {
3131
PhotoIdentifier,
3232
PhotoIdentifiersPage,
3333
GetPhotosParams,
34-
} from 'CameraRoll';
34+
} from '../../Libraries/CameraRoll/CameraRoll';
3535

3636
type Props = $ReadOnly<{|
3737
/**

RNTester/js/FlatListExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
import type {Item} from './ListExampleShared';
1414

15-
const Alert = require('Alert');
15+
const Alert = require('../../Libraries/Alert/Alert');
1616
const React = require('react');
1717
const ReactNative = require('react-native');
1818
const {Animated, StyleSheet, View} = ReactNative;
1919

2020
const RNTesterPage = require('./RNTesterPage');
2121

22-
const infoLog = require('infoLog');
22+
const infoLog = require('../../Libraries/Utilities/infoLog');
2323

2424
const {
2525
FooterComponent,

RNTester/js/ImageCapInsetsExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
const React = require('react');
1414
const ReactNative = require('react-native');
1515

16-
const nativeImageSource = require('nativeImageSource');
16+
const nativeImageSource = require('../../Libraries/Image/nativeImageSource');
1717
const {Image, StyleSheet, Text, View} = ReactNative;
1818

1919
type Props = $ReadOnly<{||}>;

0 commit comments

Comments
 (0)