Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[standards] Rewrite imports in RNTester to use standard paths #24317

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RNTester/NativeModuleExample/NativeScreenshotManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => {||};
Expand Down
10 changes: 5 additions & 5 deletions RNTester/RCTTest/RCTSnapshotNativeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<{
Expand All @@ -28,8 +30,6 @@ type NativeProps = $ReadOnly<{|

type SnapshotViewNativeType = Class<NativeComponent<NativeProps>>;

const requireNativeComponent = require('requireNativeComponent');

module.exports = ((requireNativeComponent(
'RCTSnapshot',
): any): SnapshotViewNativeType);
3 changes: 1 addition & 2 deletions RNTester/js/ARTExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 1 addition & 4 deletions RNTester/js/AccessibilityAndroidExample.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
9 changes: 7 additions & 2 deletions RNTester/js/AccessibilityExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
7 changes: 4 additions & 3 deletions RNTester/js/AccessibilityIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -34,7 +33,9 @@ class AccessibilityIOSExample extends React.Component<Props> {
<Text>Accessibility magic tap example</Text>
</View>
<View
onAccessibilityEscape={() => alert('onAccessibilityEscape success')}
onAccessibilityEscape={() =>
Alert.alert('onAccessibilityEscape success')
}
accessible={true}>
<Text>Accessibility escape example</Text>
</View>
Expand Down
8 changes: 4 additions & 4 deletions RNTester/js/ActionSheetIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
'use strict';

const React = require('react');
const ReactNative = require('react-native');
const {
ActionSheetIOS,
StyleSheet,
Text,
View,
Alert,
NativeModules,
} = ReactNative;
findNodeHandle,
} = require('react-native');
const ScreenshotManager = NativeModules.ScreenshotManager;

const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -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),
Expand Down
9 changes: 7 additions & 2 deletions RNTester/js/AlertExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
9 changes: 7 additions & 2 deletions RNTester/js/AlertIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/AnimatedExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
11 changes: 8 additions & 3 deletions RNTester/js/AnimatedGratuitousApp/AnExApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExBobble.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExChained.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object, any> {
constructor(props: Object) {
Expand Down
10 changes: 8 additions & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)};
Expand Down
9 changes: 7 additions & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExTilt.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object, any> {
constructor(props: Object) {
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/AppStateExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions RNTester/js/AssetScaledImageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/AsyncStorageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/BorderExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/BoxShadowExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/ButtonExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!`);
Expand Down
8 changes: 5 additions & 3 deletions RNTester/js/CameraRollExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
'use strict';

const React = require('react');
const ReactNative = require('react-native');
const {
CameraRoll,
Image,
Expand All @@ -20,15 +19,18 @@ const {
Text,
View,
TouchableOpacity,
} = ReactNative;
} = require('react-native');

const invariant = require('invariant');

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<
Expand Down
9 changes: 4 additions & 5 deletions RNTester/js/CameraRollView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
'use strict';

const React = require('react');
const ReactNative = require('react-native');
const {
ActivityIndicator,
Alert,
Expand All @@ -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<{|
/**
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/CheckBoxExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions RNTester/js/ClipboardExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {|
Expand Down
Loading