Skip to content

Commit

Permalink
- Update folder structure of RNTester's JS directory. (#25013)
Browse files Browse the repository at this point in the history
Summary:
Changes RNTester, first attempt in the direction of improving the RNTester overall. Related ticket: #24647

Changed the `js` directory of the RNTester to have the following structure:
```
- js
    - assets
    - components
    - examples
    - types
    - utils
```
* **assets**
_Any images, gifs, and media content_

* **components**
_All shared components_

* **examples**
_Example View/Components to be rendered by the App_

 * **types**
_Shared flow types_

 * **utils**
_Shared utilities_

## Changelog

[General] [Changed] - Update folder structure of RNTester's JS directory.
Pull Request resolved: #25013

Differential Revision: D15515773

Pulled By: cpojer

fbshipit-source-id: 0e4b6386127f338dca0ffe8c237073be53a9e221
  • Loading branch information
AndreiCalazans authored and facebook-github-bot committed May 28, 2019
1 parent 54abe1f commit 3945f10
Show file tree
Hide file tree
Showing 148 changed files with 247 additions and 354 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@ RNTester/build
# CocoaPods
/template/ios/Pods/
/template/ios/Podfile.lock
RNTester/RNTesterPods.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
113 changes: 0 additions & 113 deletions RNTester/js/AssetScaledImageExample.js

This file was deleted.

14 changes: 7 additions & 7 deletions RNTester/js/RNTesterApp.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ const {
UIManager,
View,
} = require('react-native');
const RNTesterActions = require('./RNTesterActions');
const RNTesterExampleContainer = require('./RNTesterExampleContainer');
const RNTesterExampleList = require('./RNTesterExampleList');
const RNTesterActions = require('./utils/RNTesterActions');
const RNTesterExampleContainer = require('./components/RNTesterExampleContainer');
const RNTesterExampleList = require('./components/RNTesterExampleList');
/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was found when
* making Flow check .android.js files. */
const RNTesterList = require('./RNTesterList');
const RNTesterNavigationReducer = require('./RNTesterNavigationReducer');
const URIActionMap = require('./URIActionMap');
const RNTesterList = require('./utils/RNTesterList');
const RNTesterNavigationReducer = require('./utils/RNTesterNavigationReducer');
const URIActionMap = require('./utils/URIActionMap');

const nativeImageSource = require('../../Libraries/Image/nativeImageSource');

import type {RNTesterNavigationState} from './RNTesterNavigationReducer';
import type {RNTesterNavigationState} from './utils/RNTesterNavigationReducer';

UIManager.setLayoutAnimationEnabledExperimental(true);

Expand Down
26 changes: 13 additions & 13 deletions RNTester/js/RNTesterApp.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ const {
View,
YellowBox,
} = require('react-native');
const RNTesterActions = require('./RNTesterActions');
const RNTesterExampleContainer = require('./RNTesterExampleContainer');
const RNTesterExampleList = require('./RNTesterExampleList');
const RNTesterList = require('./RNTesterList.ios');
const RNTesterNavigationReducer = require('./RNTesterNavigationReducer');
const SnapshotViewIOS = require('./SnapshotViewIOS.ios');
const URIActionMap = require('./URIActionMap');

import type {RNTesterExample} from './Shared/RNTesterTypes';
import type {RNTesterAction} from './RNTesterActions';
import type {RNTesterNavigationState} from './RNTesterNavigationReducer';
const RNTesterActions = require('./utils/RNTesterActions');
const RNTesterExampleContainer = require('./components/RNTesterExampleContainer');
const RNTesterExampleList = require('./components/RNTesterExampleList');
const RNTesterList = require('./utils/RNTesterList.ios');
const RNTesterNavigationReducer = require('./utils/RNTesterNavigationReducer');
const SnapshotViewIOS = require('./examples/Snapshot/SnapshotViewIOS.ios');
const URIActionMap = require('./utils/URIActionMap');

import type {RNTesterExample} from './types/RNTesterTypes';
import type {RNTesterAction} from './utils/RNTesterActions';
import type {RNTesterNavigationState} from './utils/RNTesterNavigationReducer';

type Props = {
exampleFromAppetizeParams: string,
Expand Down Expand Up @@ -168,10 +168,10 @@ const styles = StyleSheet.create({
});

AppRegistry.registerComponent('SetPropertiesExampleApp', () =>
require('./SetPropertiesExampleApp'),
require('./examples/SetPropertiesExample/SetPropertiesExampleApp'),
);
AppRegistry.registerComponent('RootViewSizeFlexibilityExampleApp', () =>
require('./RootViewSizeFlexibilityExampleApp'),
require('./examples/RootViewSizeFlexibilityExample/RootViewSizeFlexibilityExampleApp'),
);
AppRegistry.registerComponent('RNTesterApp', () => RNTesterApp);

Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,18 @@ class Spindicator extends React.PureComponent<$FlowFixMeProps> {
}

const THUMB_URLS = [
require('./Thumbnails/like.png'),
require('./Thumbnails/dislike.png'),
require('./Thumbnails/call.png'),
require('./Thumbnails/fist.png'),
require('./Thumbnails/bandaged.png'),
require('./Thumbnails/flowers.png'),
require('./Thumbnails/heart.png'),
require('./Thumbnails/liking.png'),
require('./Thumbnails/party.png'),
require('./Thumbnails/poke.png'),
require('./Thumbnails/superlike.png'),
require('./Thumbnails/victory.png'),
require('../assets/like.png'),
require('../assets/dislike.png'),
require('../assets/call.png'),
require('../assets/fist.png'),
require('../assets/bandaged.png'),
require('../assets/flowers.png'),
require('../assets/heart.png'),
require('../assets/liking.png'),
require('../assets/party.png'),
require('../assets/poke.png'),
require('../assets/superlike.png'),
require('../assets/victory.png'),
];

const LOREM_IPSUM =
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const React = require('react');
const {StyleSheet, Text, TouchableHighlight} = require('react-native');

import type {PressEvent} from '../../Libraries/Types/CoreEventTypes';
import type {PressEvent} from '../../../Libraries/Types/CoreEventTypes';

type Props = $ReadOnly<{|
children?: React.Node,
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ const {
TouchableHighlight,
View,
} = require('react-native');
const RNTesterActions = require('./RNTesterActions');
const RNTesterActions = require('../utils/RNTesterActions');
const RNTesterExampleFilter = require('./RNTesterExampleFilter');

import type {RNTesterExample} from './Shared/RNTesterTypes';
import type {ViewStyleProp} from '../../Libraries/StyleSheet/StyleSheet';
import type {RNTesterExample} from '../types/RNTesterTypes';
import type {ViewStyleProp} from '../../../Libraries/StyleSheet/StyleSheet';

type Props = {
onNavigate: Function,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const React = require('react');
const {StyleSheet, Switch, Text, View} = require('react-native');
const RNTesterStatePersister = require('./RNTesterStatePersister');
const RNTesterStatePersister = require('../utils/RNTesterStatePersister');

class RNTesterSettingSwitchRow extends React.Component<
$FlowFixMeProps,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ function Basic() {
<Text>
This text contains an inline blue view{' '}
<View style={{width: 25, height: 25, backgroundColor: 'steelblue'}} /> and
an inline image <Image source={require('../flux.png')} />. Neat, huh?
an inline image <Image source={require('../assets/flux.png')} />. Neat,
huh?
</Text>
);
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const React = require('react');

const RNTesterExampleContainer = require('./RNTesterExampleContainer');
import type {RNTesterExample} from './Shared/RNTesterTypes';
import type {RNTesterExample} from '../types/RNTesterTypes';

const createExamplePage = function(
title: ?string,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const {
TouchableWithoutFeedback,
} = require('react-native');

const RNTesterBlock = require('./RNTesterBlock');
const RNTesterPage = require('./RNTesterPage');
const RNTesterBlock = require('../../components/RNTesterBlock');
const RNTesterPage = require('../../components/RNTesterPage');

const importantForAccessibilityValues = [
'auto',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {
Platform,
} = require('react-native');

const RNTesterBlock = require('./RNTesterBlock');
const RNTesterBlock = require('../../components/RNTesterBlock');

class AccessibilityExample extends React.Component {
render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const React = require('react');
const {Text, View, Alert} = require('react-native');

const RNTesterBlock = require('./RNTesterBlock');
const RNTesterBlock = require('../../components/RNTesterBlock');

type Props = $ReadOnly<{||}>;
class AccessibilityIOSExample extends React.Component<Props> {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const {
View,
} = require('react-native');

const RNTesterBlock = require('./RNTesterBlock');
const RNTesterBlock = require('../../components/RNTesterBlock');

// corporate ipsum > lorem ipsum
const alertMessage =
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const React = require('react');
const {Animated, Easing, StyleSheet, Text, View} = require('react-native');
const RNTesterButton = require('./RNTesterButton');
const RNTesterButton = require('../../components/RNTesterButton');

const styles = StyleSheet.create({
content: {
Expand Down Expand Up @@ -259,7 +259,7 @@ exports.examples = [
Press to Spin it!
</RNTesterButton>
<Animated.Image
source={require('./bunny.png')}
source={require('../../assets/bunny.png')}
style={[
styles.rotatingImage,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ const styles = StyleSheet.create({
});

const CHAIN_IMGS = [
require('../hawk.png'),
require('../bunny.png'),
require('../relay.png'),
require('../hawk.png'),
require('../bunny.png'),
require('../../../assets/hawk.png'),
require('../../../assets/bunny.png'),
require('../../../assets/relay.png'),
require('../../../assets/hawk.png'),
require('../../../assets/bunny.png'),
];

module.exports = AnExChained;
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class AnExTilt extends React.Component<Object, any> {
},
],
}}
source={require('./trees.jpg')}
source={require('../../../assets/trees.jpg')}
/>
</Animated.View>
);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ exports.examples = [
render() {
return (
<Image
source={require('./hawk.png')}
source={require('../../assets/hawk.png')}
style={[styles.box, styles.shadow1, styles.shadowImage]}
/>
);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const {
TouchableWithoutFeedback,
} = require('react-native');

const RNTesterBlock = require('./RNTesterBlock');
const RNTesterPage = require('./RNTesterPage');
const RNTesterBlock = require('../../components/RNTesterBlock');
const RNTesterPage = require('../../components/RNTesterPage');

type Props = $ReadOnly<{||}>;
type State = {|
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

'use strict';

import type {Item} from './ListExampleShared';
import type {Item} from '../../components/ListExampleShared';

const React = require('react');
const {Alert, Animated, StyleSheet, View} = require('react-native');

const RNTesterPage = require('./RNTesterPage');
const RNTesterPage = require('../../components/RNTesterPage');

const infoLog = require('../../Libraries/Utilities/infoLog');
const infoLog = require('../../../../Libraries/Utilities/infoLog');

const {
FooterComponent,
Expand All @@ -32,7 +32,7 @@ const {
getItemLayout,
pressItem,
renderSmallSwitchOption,
} = require('./ListExampleShared');
} = require('../../components/ListExampleShared');

const VIEWABILITY_CONFIG = {
minimumViewTime: 3000,
Expand Down
Loading

0 comments on commit 3945f10

Please sign in to comment.