Browse Source

Clean playground app

Mostly removed unused files left over from the recent playground app refactor
Guy Carmeli 5 years ago
parent
commit
57750961a9

+ 1
- 1
playground/src/screens/Alert.js View File

@@ -1,7 +1,7 @@
1 1
 const React = require('react');
2 2
 const { PureComponent } = require('react');
3 3
 
4
-const { Text, Button, View, Platform } = require('react-native');
4
+const { Text, Button, View } = require('react-native');
5 5
 const { Navigation } = require('react-native-navigation');
6 6
 
7 7
 const testIDs = require('../testIDs');

+ 0
- 73
playground/src/screens/BackHandlerModalScreen.js View File

@@ -1,73 +0,0 @@
1
-const React = require('react');
2
-const { Component } = require('react');
3
-
4
-const { View, Text, Button, BackHandler } = require('react-native');
5
-
6
-class BackHandlerModalScreen extends Component {
7
-  static options() {
8
-    return {
9
-      topBar: {
10
-        title: {
11
-          text: 'Back Handler'
12
-        }
13
-      }
14
-    };
15
-  }
16
-
17
-  constructor(props) {
18
-    super(props);
19
-    this.backHandler = () => {
20
-      this.setState({
21
-        backPress: 'Back button pressed!'
22
-      });
23
-      return true;
24
-    };
25
-    this.state = {
26
-      backPress: ''
27
-    };
28
-  }
29
-
30
-  render() {
31
-    return (
32
-      <View style={styles.root}>
33
-        <Text style={styles.h1}>{`Back Handler Screen`}</Text>
34
-        <Text style={styles.h2}>{this.state.backPress}</Text>
35
-        <Button title='add back handler' onPress={() => this.addBackHandler()} />
36
-        <Button title='remove back handler' onPress={() => this.removeBackHandler()} />
37
-      </View>
38
-    );
39
-  }
40
-
41
-  addBackHandler() {
42
-    BackHandler.addEventListener('hardwareBackPress', this.backHandler);
43
-  }
44
-
45
-  removeBackHandler() {
46
-    BackHandler.removeEventListener('hardwareBackPress', this.backHandler);
47
-  }
48
-
49
-  componentWillUnmount() {
50
-    BackHandler.removeEventListener('hardwareBackPress', this.backHandler);
51
-  }
52
-}
53
-
54
-const styles = {
55
-  root: {
56
-    flex: 1,
57
-    backgroundColor: 'white',
58
-    justifyContent: 'center',
59
-    alignItems: 'center'
60
-  },
61
-  h2: {
62
-    fontSize: 12,
63
-    textAlign: 'center',
64
-    margin: 10
65
-  },
66
-  footer: {
67
-    fontSize: 10,
68
-    color: '#888',
69
-    marginTop: 10
70
-  }
71
-};
72
-
73
-module.exports = BackHandlerModalScreen;

+ 1
- 1
playground/src/screens/LayoutsScreen.js View File

@@ -34,7 +34,7 @@ class LayoutsScreen extends React.Component {
34 34
     );
35 35
   }
36 36
 
37
-  stack = () => Navigation.showModal(Screens.StackScreen);
37
+  stack = () => Navigation.showModal(Screens.Stack);
38 38
 
39 39
   bottomTabs = () => Navigation.showModal({
40 40
     bottomTabs: {

+ 1
- 2
playground/src/screens/Screens.js View File

@@ -3,8 +3,7 @@ module.exports = {
3 3
   Pushed: 'Pushed',
4 4
   Layouts: 'Layouts',
5 5
   Options: 'Options',
6
-  StackScreen: 'StackScreen',
7
-  Pushed: 'Pushed',
6
+  Stack: 'Stack',
8 7
   Modal: 'Modal',
9 8
   Overlay: 'Overlay',
10 9
   OverlayAlert: 'OverlayAlert',

+ 0
- 164
playground/src/screens/TextScreen.js View File

@@ -1,164 +0,0 @@
1
-const React = require('react');
2
-const { Component } = require('react');
3
-
4
-const { View, Text, Button, Platform } = require('react-native');
5
-
6
-const { Navigation } = require('react-native-navigation');
7
-const testIDs = require('../testIDs');
8
-const Bounds = require('../components/Bounds');
9
-class TextScreen extends Component {
10
-  static options() {
11
-    return {
12
-      bottomTabs: {
13
-        drawBehind: true,
14
-        testID: testIDs.BOTTOM_TABS_ELEMENT
15
-      },
16
-      topBar: {
17
-        testID: testIDs.TOP_BAR_ELEMENT
18
-      }
19
-    };
20
-  }
21
-
22
-  render() {
23
-    return (
24
-      <Bounds>
25
-        <View style={styles.root}>
26
-          <Text style={styles.h1} testID={testIDs.CENTERED_TEXT_HEADER}>{this.props.text || 'Text Screen'}</Text>
27
-          {this.renderTextFromFunctionInProps()}
28
-          <Text style={styles.footer}>{`this.props.componentId = ${this.props.componentId}`}</Text>
29
-          <Button title={'Set Tab Badge'} testID={testIDs.SET_TAB_BADGE_BUTTON} onPress={() => this.onClickSetBadge()} />
30
-          <Button title={'Set empty Tab Badge'} testID={testIDs.SET_TAB_BADGE_BUTTON_NULL} onPress={() => this.onClickSetNullBadge()} />
31
-          <Button title={'Switch To Tab 2'} testID={testIDs.SWITCH_SECOND_TAB_BUTTON} onPress={() => this.onClickSwitchToTab()} />
32
-          <Button title={'Switch To Tab 1 by componentID'} testID={testIDs.SWITCH_FIRST_TAB_BUTTON} onPress={() => this.onClickSwitchToTabByComponentID()} />
33
-          {/* tslint:disable-next-line:max-line-length */}
34
-          { Platform.OS === 'android' && <Button title='Hide Tab Bar' testID={testIDs.HIDE_BOTTOM_TABS_BUTTON} onPress={() => this.toggleTabBarVisibility(this.props.componentId, false)} /> }
35
-          { Platform.OS === 'android' && <Button title='Show Tab Bar' testID={testIDs.SHOW_BOTTOM_TABS_BUTTON} onPress={() => this.toggleTabBarVisibility('BottomTabs', true)} /> }
36
-          <Button title='Hide Tab Bar on Push' testID={testIDs.HIDE_BOTTOM_TABS_ON_PUSH_BUTTON} onPress={() => this.hideTabBarOnPush()} />
37
-          <Button title='Show Left Side Menu' testID={testIDs.SHOW_LEFT_SIDE_MENU_BUTTON} onPress={() => this.showSideMenu('left')} />
38
-          <Button title='Show Right Side Menu' testID={testIDs.SHOW_RIGHT_SIDE_MENU_BUTTON} onPress={() => this.showSideMenu('right')} />
39
-          <Button title='Push' testID={testIDs.PUSH_BUTTON} onPress={this.onClickPush} />
40
-          <Button title='Pop' testID={testIDs.POP_BUTTON} onPress={this.onClickPop} />
41
-          <Button title='Dismiss modal' testID={testIDs.DISMISS_MODAL_BUTTON} onPress={this.onClickDismissModal} />
42
-        </View>
43
-      </Bounds>
44
-    );
45
-  }
46
-
47
-  onClickSetBadge() {
48
-    Navigation.mergeOptions(this.props.componentId, {
49
-      bottomTab: {
50
-        badge: `TeSt`
51
-      }
52
-    });
53
-  }
54
-
55
-  onClickSetNullBadge() {
56
-    Navigation.mergeOptions(this.props.componentId, {
57
-      bottomTab: {
58
-        badge: null
59
-      }
60
-    });
61
-  }
62
-
63
-  onClickPush = async () => {
64
-    await Navigation.push(this.props.componentId, {
65
-      component: {
66
-        name: 'navigation.playground.PushedScreen'
67
-      }
68
-    });
69
-  }
70
-
71
-  onClickDismissModal = () => {
72
-    Navigation.dismissModal(this.props.componentId);
73
-  }
74
-
75
-  onClickPop = async () => {
76
-    await Navigation.pop(this.props.componentId);
77
-  }
78
-
79
-  renderTextFromFunctionInProps() {
80
-    if (!this.props.myFunction) {
81
-      return undefined;
82
-    }
83
-    return (
84
-      <Text style={styles.h1}>{this.props.myFunction()}</Text>
85
-    );
86
-  }
87
-
88
-  onClickSwitchToTab() {
89
-    Navigation.mergeOptions(this.props.componentId, {
90
-      bottomTabs: {
91
-        currentTabIndex: 1,
92
-        visible: false,
93
-        drawBehind: true,
94
-        animate: true
95
-      }
96
-    });
97
-  }
98
-
99
-  onClickSwitchToTabByComponentID() {
100
-    Navigation.mergeOptions(this.props.componentId, {
101
-      bottomTabs: {
102
-        currentTabId: 'TAB1_ID'
103
-      }
104
-    });
105
-  }
106
-
107
-  toggleTabBarVisibility(componentId, visible) {
108
-    Navigation.mergeOptions(componentId, {
109
-      bottomTabs: {
110
-        visible,
111
-        drawBehind: true,
112
-        animate: true
113
-      }
114
-    });
115
-  }
116
-
117
-  hideTabBarOnPush() {
118
-    Navigation.push(this.props.componentId, {
119
-      component: {
120
-        name: 'navigation.playground.PushedScreen'
121
-      }
122
-    });
123
-  }
124
-
125
-  showSideMenu(side) {
126
-    Navigation.mergeOptions(this.props.componentId, {
127
-      sideMenu: {
128
-        [side]: {
129
-          visible: true
130
-        }
131
-      }
132
-    });
133
-  }
134
-
135
-  onClickPop() {
136
-    Navigation.pop(this.props.componentId);
137
-  }
138
-}
139
-
140
-module.exports = TextScreen;
141
-
142
-const styles = {
143
-  root: {
144
-    flexGrow: 1,
145
-    justifyContent: 'center',
146
-    alignItems: 'center',
147
-    backgroundColor: '#E3DCC3'
148
-  },
149
-  h1: {
150
-    fontSize: 24,
151
-    textAlign: 'center',
152
-    margin: 10
153
-  },
154
-  h2: {
155
-    fontSize: 12,
156
-    textAlign: 'center',
157
-    margin: 10
158
-  },
159
-  footer: {
160
-    fontSize: 10,
161
-    color: '#888',
162
-    marginTop: 10
163
-  }
164
-};

+ 1
- 1
playground/src/screens/index.js View File

@@ -16,7 +16,7 @@ const Screens = require('./Screens');
16 16
 function registerScreens() {
17 17
   Navigation.registerComponent(Screens.Layouts, () => require('./LayoutsScreen'));
18 18
   Navigation.registerComponent(Screens.Options, () => require('./OptionsScreen'));
19
-  Navigation.registerComponent(Screens.StackScreen, () => require('./StackScreen'));
19
+  Navigation.registerComponent(Screens.Stack, () => require('./StackScreen'));
20 20
   Navigation.registerComponent(Screens.Pushed, () => require('./PushedScreen'));
21 21
   Navigation.registerComponent(Screens.Modal, () => require('./ModalScreen'))
22 22
   Navigation.registerComponent(Screens.Navigation, () => require('./NavigationScreen'));