Browse Source

Fix example project

Guy Carmeli 8 years ago
parent
commit
2787a6294b

+ 0
- 14
example/src/app.js View File

@@ -9,20 +9,6 @@ import { Navigation } from 'react-native-navigation';
9 9
 import { registerScreens } from './screens';
10 10
 registerScreens();
11 11
 
12
-AppRegistry.registerComponent('App', () => App);
13
-
14
-export default class App extends Component {
15
-  constructor(props) {
16
-    super(props);
17
-  }
18
-
19
-  render() {
20
-    return (
21
-      <View />
22
-    );
23
-  }
24
-}
25
-
26 12
 // this will start our app
27 13
 Navigation.startTabBasedApp({
28 14
   tabs: [

+ 0
- 111
example/src/screens/FirstTabScreen.android.js View File

@@ -1,111 +0,0 @@
1
-import React, {Component} from 'react';
2
-import {
3
-  Text,
4
-  View,
5
-  ScrollView,
6
-  TouchableOpacity,
7
-  StyleSheet
8
-} from 'react-native';
9
-
10
-export default class FirstTabScreen extends Component {
11
-  static navigatorButtons = {
12
-    leftButtons: [{
13
-      icon: require('../../img/navicon_menu.png'),
14
-      id: 'menu'
15
-    }],
16
-    rightButtons: [
17
-      {
18
-        title: 'Edit',
19
-        id: 'edit'
20
-      },
21
-      {
22
-        icon: require('../../img/navicon_add.png'),
23
-        id: 'add'
24
-      }
25
-    ]
26
-  };
27
-  static navigatorStyle = {
28
-    drawUnderTabBar: true
29
-  };
30
-  constructor(props) {
31
-    super(props);
32
-    // if you want to listen on navigator events, set this up
33
-    // this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
34
-  }
35
-  onNavigatorEvent(event) {
36
-    if (event.id == 'menu') {
37
-      this.props.navigator.toggleDrawer({
38
-        side: 'left',
39
-        animated: true
40
-      });
41
-    }
42
-    if (event.id == 'edit') {
43
-      // AlertIOS.alert('NavBar', 'Edit button pressed');
44
-    }
45
-    if (event.id == 'add') {
46
-      // AlertIOS.alert('NavBar', 'Add button pressed');
47
-    }
48
-  }
49
-  render() {
50
-    return (
51
-      <View style={{flex: 1, padding: 20}}>
52
-
53
-        <TouchableOpacity onPress={ this.onPushPress.bind(this) }>
54
-          <Text style={styles.button}>Push Plain Screen</Text>
55
-        </TouchableOpacity>
56
-
57
-        <TouchableOpacity onPress={ this.onPushStyledPress.bind(this) }>
58
-          <Text style={styles.button}>Push Styled Screen</Text>
59
-        </TouchableOpacity>
60
-
61
-        <TouchableOpacity onPress={ this.onModalPress.bind(this) }>
62
-          <Text style={styles.button}>Show Modal Screen</Text>
63
-        </TouchableOpacity>
64
-
65
-        <TouchableOpacity onPress={ this.onLightBoxPress.bind(this) }>
66
-          <Text style={styles.button}>Show LightBox</Text>
67
-        </TouchableOpacity>
68
-
69
-      </View>
70
-    );
71
-  }
72
-  onPushPress() {
73
-    this.props.navigator.push({
74
-      title: "More",
75
-      screen: "example.PushedScreen"
76
-    });
77
-  }
78
-  onPushStyledPress() {
79
-    console.warn('navigator.push not implemented yet');
80
-    // this.props.navigator.push({
81
-    //   title: "Styled",
82
-    //   screen: "example.StyledScreen"
83
-    // });
84
-  }
85
-  onModalPress() {
86
-    console.warn('navigator.showModal not implemented yet');
87
-    // this.props.navigator.showModal({
88
-    //   title: "Modal",
89
-    //   screen: "example.ModalScreen"
90
-    // });
91
-  }
92
-  onLightBoxPress() {
93
-    console.warn('navigator.showLightBox not implemented yet');
94
-    // this.props.navigator.showLightBox({
95
-    //   screen: "example.LightBoxScreen",
96
-    //   style: {
97
-    //     backgroundBlur: "dark"
98
-    //   }
99
-    // });
100
-  }
101
-}
102
-
103
-const styles = StyleSheet.create({
104
-  button: {
105
-    textAlign: 'center',
106
-    fontSize: 18,
107
-    marginBottom: 10,
108
-    marginTop:10,
109
-    color: 'blue'
110
-  }
111
-});

example/src/screens/FirstTabScreen.ios.js → example/src/screens/FirstTabScreen.js View File


+ 0
- 133
example/src/screens/SecondTabScreen.android.js View File

@@ -1,133 +0,0 @@
1
-import React, {Component} from 'react';
2
-import {
3
-  Text,
4
-  View,
5
-  ScrollView,
6
-  TouchableOpacity,
7
-  StyleSheet
8
-} from 'react-native';
9
-
10
-export default class SecondTabScreen extends Component {
11
-  static navigatorStyle = {
12
-    drawUnderTabBar: true
13
-  };
14
-  constructor(props) {
15
-    super(props);
16
-    this.buttonsCounter = 0;
17
-    // if you want to listen on navigator events, set this up
18
-    // this.props.navigator.setOnNavigatorEvent(this.onNavigatorEvent.bind(this));
19
-  }
20
-  render() {
21
-    return (
22
-      <View style={{flex: 1, padding: 20}}>
23
-
24
-        <TouchableOpacity onPress={ this.onChangeButtonsPress.bind(this) }>
25
-          <Text style={styles.button}>Change Buttons</Text>
26
-        </TouchableOpacity>
27
-
28
-        <TouchableOpacity onPress={ this.onChangeTitlePress.bind(this) }>
29
-          <Text style={styles.button}>Change Title</Text>
30
-        </TouchableOpacity>
31
-
32
-        <TouchableOpacity onPress={ this.onSwitchTabPress.bind(this) }>
33
-          <Text style={styles.button}>Switch To Tab#1</Text>
34
-        </TouchableOpacity>
35
-
36
-        <TouchableOpacity onPress={ this.onSetTabBadgePress.bind(this) }>
37
-          <Text style={styles.button}>Set Tab Badge</Text>
38
-        </TouchableOpacity>
39
-
40
-        <TouchableOpacity onPress={ this.onToggleTabsPress.bind(this) }>
41
-          <Text style={styles.button}>Toggle Tabs</Text>
42
-        </TouchableOpacity>
43
-
44
-      </View>
45
-    );
46
-  }
47
-  onChangeTitlePress() {
48
-    this.props.navigator.setTitle({
49
-      title: Math.round(Math.random() * 100000).toString()
50
-    });
51
-  }
52
-  onChangeButtonsPress() {
53
-    let buttons;
54
-    if (this.buttonsCounter % 3 == 0) {
55
-      buttons = [
56
-        {
57
-          title: 'Edit',
58
-          id: 'edit',
59
-          disabled: true
60
-        },
61
-        {
62
-          icon: require('../../img/navicon_add.png'),
63
-          id: 'add'
64
-        }
65
-      ];
66
-    } else if (this.buttonsCounter % 3 == 1) {
67
-      buttons = [{
68
-        title: 'Save',
69
-        id: 'save'
70
-      }];
71
-    } else {
72
-      buttons = [];
73
-    }
74
-    this.buttonsCounter++;
75
-
76
-    this.props.navigator.setButtons({
77
-      rightButtons: buttons,
78
-      animated: true
79
-    });
80
-  }
81
-  onSwitchTabPress() {
82
-    this.props.navigator.switchToTab({
83
-      tabIndex: 0
84
-    });
85
-  }
86
-  onSetTabBadgePress() {
87
-    this.props.navigator.setTabBadge({
88
-      badge: 12
89
-    });
90
-  }
91
-  onToggleTabsPress() {
92
-    this.props.navigator.toggleTabs({
93
-      to: this.tabsHidden ? 'shown' : 'hidden'
94
-    });
95
-    this.tabsHidden = !this.tabsHidden;
96
-  }
97
-  onNavigatorEvent(event) {
98
-    // handle a deep link
99
-    if (event.type == 'DeepLink') {
100
-      const parts = event.link.split('/');
101
-      if (parts[0] == 'tab2') {
102
-        this.props.navigator.resetTo({
103
-          title: "Replaced Root",
104
-          screen: parts[1],
105
-          animated: true
106
-        });
107
-        this.props.navigator.switchToTab();
108
-      }
109
-    }
110
-    // handle a button press
111
-    // if (event.type == 'NavBarButtonPress') {
112
-    //   if (event.id == 'edit') {
113
-    //     AlertIOS.alert('NavBar', 'Dynamic Edit button pressed');
114
-    //   }
115
-    //   if (event.id == 'add') {
116
-    //     AlertIOS.alert('NavBar', 'Dynamic Add button pressed');
117
-    //   }
118
-    //   if (event.id == 'save') {
119
-    //     AlertIOS.alert('NavBar', 'Dynamic Save button pressed');
120
-    //   }
121
-    // }
122
-  }
123
-}
124
-
125
-const styles = StyleSheet.create({
126
-  button: {
127
-    textAlign: 'center',
128
-    fontSize: 18,
129
-    marginBottom: 10,
130
-    marginTop:10,
131
-    color: 'blue'
132
-  }
133
-});

example/src/screens/SecondTabScreen.ios.js → example/src/screens/SecondTabScreen.js View File