Skip to content

Commit ddcab83

Browse files
coadofacebook-github-bot
authored andcommitted
Migrate already root exported deep imports in rn-tester. (#50958)
Summary: Pull Request resolved: #50958 In rn-tester package there are many react-native deep imports which will be deprecated in the future. It is a starter for migrating rn-tester to using root imports instead. Only deep imports that are already root exported are changed. This diff avoids using `CodegenTypes` as it causes build errors and will be resolved in next stages. Besides import changes, `PointerEvent` type is now also exported from the root. Changelog: [Internal] Reviewed By: huntie Differential Revision: D73656526 fbshipit-source-id: 5814a3d9c6a04b1236581dbbe291cd109e2c71c0
1 parent e162fba commit ddcab83

File tree

56 files changed

+73
-89
lines changed

Some content is hidden

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

56 files changed

+73
-89
lines changed

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9244,6 +9244,7 @@ export type {
92449244
LayoutChangeEvent,
92459245
LayoutRectangle,
92469246
MouseEvent,
9247+
PointerEvent,
92479248
NativeMouseEvent,
92489249
NativePointerEvent,
92499250
NativeScrollEvent,

packages/react-native/index.js.flow

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ export type {
411411
LayoutChangeEvent,
412412
LayoutRectangle,
413413
MouseEvent,
414+
PointerEvent,
414415
NativeMouseEvent,
415416
NativePointerEvent,
416417
NativeScrollEvent,

packages/rn-tester/IntegrationTests/ImageCachePolicyTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
'use strict';
1212

13-
import type {ImageURISource} from 'react-native/Libraries/Image/ImageSource';
13+
import type {ImageURISource} from 'react-native';
1414

1515
import * as React from 'react';
1616
import {useEffect, useState} from 'react';

packages/rn-tester/IntegrationTests/LayoutEventsTest.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010

1111
'use strict';
1212

13+
import type {LayoutChangeEvent, LayoutRectangle} from 'react-native';
1314
import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
14-
import type {
15-
LayoutChangeEvent,
16-
LayoutRectangle,
17-
} from 'react-native/Libraries/Types/CoreEventTypes';
1815

1916
const React = require('react');
2017
const ReactNative = require('react-native');

packages/rn-tester/NativeComponentExample/js/MyLegacyViewNativeComponent.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
11+
import type {HostComponent, ViewProps} from 'react-native';
1312

1413
import ReactNative from '../../../react-native/Libraries/Renderer/shims/ReactNative';
1514
import * as React from 'react';

packages/rn-tester/NativeComponentExample/js/MyNativeViewNativeComponent.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
* @format
99
*/
1010

11-
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
11+
import type {HostComponent, ViewProps} from 'react-native';
1312
import type {
1413
BubblingEventHandler,
1514
Double,
@@ -18,8 +17,7 @@ import type {
1817
} from 'react-native/Libraries/Types/CodegenTypes';
1918

2019
import * as React from 'react';
21-
import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
22-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
20+
import {codegenNativeCommands, codegenNativeComponent} from 'react-native';
2321

2422
type Event = $ReadOnly<{
2523
values: $ReadOnlyArray<Int32>,

packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @format
99
*/
1010

11-
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
11+
import type {TurboModule} from 'react-native';
1212
import type {EventEmitter} from 'react-native/Libraries/Types/CodegenTypes';
1313

1414
import {TurboModuleRegistry} from 'react-native';

packages/rn-tester/NativeModuleExample/NativeScreenshotManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* @format
99
*/
1010

11-
import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
11+
import type {TurboModule} from 'react-native';
1212
import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes';
1313

14-
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
14+
import {TurboModuleRegistry} from 'react-native';
1515

1616
export type ScreenshotManagerOptions = UnsafeObject;
1717

packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js

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

1111
'use strict';
1212

13-
import type {HostComponent} from 'react-native';
14-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
15-
import type {NativeSyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
13+
import type {
14+
HostComponent,
15+
NativeSyntheticEvent,
16+
ViewProps,
17+
} from 'react-native';
1618

1719
const {requireNativeComponent} = require('react-native');
1820

packages/rn-tester/ReportFullyDrawnView/ReportFullyDrawnViewNativeComponent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
*/
1010

1111
import type {HostComponent} from 'react-native';
12-
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
12+
import type {ViewProps} from 'react-native';
1313

14-
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
14+
import {codegenNativeComponent} from 'react-native';
1515

1616
type NativeProps = $ReadOnly<{
1717
...ViewProps,

0 commit comments

Comments
 (0)