Daniel Zlotin преди 7 години
родител
ревизия
9a398c3f86
променени са 3 файла, в които са добавени 66 реда и са изтрити 4 реда
  1. 63
    0
      playground/src/containers/OptionsScreen.js
  2. 1
    4
      playground/src/containers/PushedScreen.js
  3. 2
    0
      playground/src/containers/index.js

+ 63
- 0
playground/src/containers/OptionsScreen.js Целия файл

@@ -0,0 +1,63 @@
1
+import _ from 'lodash';
2
+import React, { Component } from 'react';
3
+import {
4
+  StyleSheet,
5
+  View,
6
+  Text,
7
+  Button
8
+} from 'react-native';
9
+
10
+import Navigation from 'react-native-navigation';
11
+
12
+class OptionsScreen extends Component {
13
+  static navigationOptions = {
14
+    title: 'Static Title'
15
+  }
16
+
17
+  constructor(props) {
18
+    super(props);
19
+    this.onClickDynamicOptions = this.onClickDynamicOptions.bind(this);
20
+  }
21
+
22
+  render() {
23
+    return (
24
+      <View style={styles.root}>
25
+        <Text style={styles.h1}>{`Style Screen`}</Text>
26
+        <Button title="Dynamic Options" onPress={this.onClickDynamicOptions} />
27
+        <Text style={styles.footer}>{`this.props.id = ${this.props.id}`}</Text>
28
+      </View>
29
+    );
30
+  }
31
+
32
+  onClickDynamicOptions() {
33
+    // Navigation.setOptions({
34
+    //   title: 'Dynamic Title'
35
+    // });
36
+  }
37
+}
38
+
39
+const styles = {
40
+  root: {
41
+    flexGrow: 1,
42
+    justifyContent: 'center',
43
+    alignItems: 'center',
44
+    backgroundColor: '#f5fcff'
45
+  },
46
+  h1: {
47
+    fontSize: 24,
48
+    textAlign: 'center',
49
+    margin: 10
50
+  },
51
+  h2: {
52
+    fontSize: 12,
53
+    textAlign: 'center',
54
+    margin: 10
55
+  },
56
+  footer: {
57
+    fontSize: 10,
58
+    color: '#888',
59
+    marginTop: 10
60
+  }
61
+};
62
+
63
+export default PushedScreen;

+ 1
- 4
playground/src/containers/PushedScreen.js Целия файл

@@ -10,10 +10,6 @@ import {
10 10
 import Navigation from 'react-native-navigation';
11 11
 
12 12
 class PushedScreen extends Component {
13
-  static navigationStyle = {
14
-    title: 'Static Title'
15
-  }
16
-
17 13
   constructor(props) {
18 14
     super(props);
19 15
     this.onClickPush = this.onClickPush.bind(this);
@@ -22,6 +18,7 @@ class PushedScreen extends Component {
22 18
     this.onClickPopToFirstPosition = this.onClickPopToFirstPosition.bind(this);
23 19
     this.onClickPopToRoot = this.onClickPopToRoot.bind(this);
24 20
   }
21
+
25 22
   render() {
26 23
     const stackPosition = this.getStackPosition();
27 24
     return (

+ 2
- 0
playground/src/containers/index.js Целия файл

@@ -5,6 +5,7 @@ import TextScreen from './TextScreen';
5 5
 import PushedScreen from './PushedScreen';
6 6
 import LifecycleScreen from './LifecycleScreen';
7 7
 import ModalScreen from './ModalScreen';
8
+import OptionsScreen from './OptionsScreen';
8 9
 
9 10
 export function registerContainers() {
10 11
   Navigation.registerContainer(`navigation.playground.WelcomeScreen`, () => WelcomeScreen);
@@ -12,4 +13,5 @@ export function registerContainers() {
12 13
   Navigation.registerContainer(`navigation.playground.LifecycleScreen`, () => LifecycleScreen);
13 14
   Navigation.registerContainer(`navigation.playground.TextScreen`, () => TextScreen);
14 15
   Navigation.registerContainer(`navigation.playground.PushedScreen`, () => PushedScreen);
16
+  Navigation.registerContainer(`navigation.playground.OptionsScreen`, () => OptionsScreen);
15 17
 }