Browse Source

Add popToRoot to example-redux

Guy Carmeli 8 years ago
parent
commit
0a5c6ff99d

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/activities/BottomTabActivity.java View File

139
         for (ScreenStack stack: mScreenStacks) {
139
         for (ScreenStack stack: mScreenStacks) {
140
             if (stack.peek().navigatorId.equals(navigatorId)) {
140
             if (stack.peek().navigatorId.equals(navigatorId)) {
141
                 Screen popped = stack.popToRoot();
141
                 Screen popped = stack.popToRoot();
142
-                setNavigationStyle(getCurrentScreen());
142
+                StyleHelper.updateStyles(mToolbar, getCurrentScreen());
143
                 return popped;
143
                 return popped;
144
             }
144
             }
145
         }
145
         }

+ 1
- 1
android/app/src/main/java/com/reactnativenavigation/activities/SingleScreenActivity.java View File

68
     public Screen popToRoot(String navigatorId) {
68
     public Screen popToRoot(String navigatorId) {
69
         super.popToRoot(navigatorId);
69
         super.popToRoot(navigatorId);
70
         Screen screen = mScreenStack.popToRoot();
70
         Screen screen = mScreenStack.popToRoot();
71
-        setNavigationStyle(getCurrentScreen());
71
+        StyleHelper.updateStyles(mToolbar, getCurrentScreen());
72
         return screen;
72
         return screen;
73
     }
73
     }
74
 
74
 

+ 8
- 0
example-redux/src/screens/PushedScreen.js View File

76
           <Text style={styles.button}>Dismiss all modals</Text>
76
           <Text style={styles.button}>Dismiss all modals</Text>
77
         </TouchableOpacity>
77
         </TouchableOpacity>
78
 
78
 
79
+        <TouchableOpacity onPress={ this.onPopToRootPress.bind(this) }>
80
+          <Text style={styles.button}>Pop to root</Text>
81
+        </TouchableOpacity>
82
+
79
         <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}}/>
83
         <TextInput style={{height: 40, borderColor: 'gray', borderWidth: 1}}/>
80
 
84
 
81
         <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
85
         <Text style={{fontWeight: '500'}}>String prop: {this.props.str}</Text>
140
   onDismissModal() {
144
   onDismissModal() {
141
     this.props.navigator.dismissModal();
145
     this.props.navigator.dismissModal();
142
   }
146
   }
147
+
148
+  onPopToRootPress() {
149
+    this.props.navigator.popToRoot();
150
+  }
143
 }
151
 }
144
 
152
 
145
 const styles = StyleSheet.create({
153
 const styles = StyleSheet.create({