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,7 +139,7 @@ public class BottomTabActivity extends BaseReactActivity implements AHBottomNavi
139 139
         for (ScreenStack stack: mScreenStacks) {
140 140
             if (stack.peek().navigatorId.equals(navigatorId)) {
141 141
                 Screen popped = stack.popToRoot();
142
-                setNavigationStyle(getCurrentScreen());
142
+                StyleHelper.updateStyles(mToolbar, getCurrentScreen());
143 143
                 return popped;
144 144
             }
145 145
         }

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

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

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

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