Browse Source

docs updated and setStackRoot fix

yogevbd 6 years ago
parent
commit
009151922f

+ 13
- 11
docs/docs/screen-api.md View File

45
 Navigation.popToRoot(this.props.componentId);
45
 Navigation.popToRoot(this.props.componentId);
46
 ```
46
 ```
47
 
47
 
48
-<!-- ## resetTo(params)
48
+## setRootStack(componentId, params)
49
 
49
 
50
-Reset the screen's navigation stack to a new screen (the stack root is changed).
50
+Reset the current navigation stack to a new screen component (the stack root is changed).
51
 
51
 
52
 ```js
52
 ```js
53
-this.props.navigator.resetTo({
54
-  screen: 'example.ScreenThree', // unique ID registered with Navigation.registerScreen
55
-  title: undefined, // navigation bar title of the pushed screen (optional)
56
-  passProps: {}, // simple serializable object that will pass as props to the pushed screen (optional)
57
-  animated: true, // does the resetTo have transition animation or does it happen immediately (optional)
58
-  animationType: 'fade', // 'fade' (for both) / 'slide-horizontal' (for android) does the resetTo have different transition animation (optional)
59
-  navigatorStyle: {}, // override the navigator style for the pushed screen (optional)
60
-  navigatorButtons: {} // override the nav buttons for the pushed screen (optional)
53
+Navigation.setRootStack(this.props.componentId, {
54
+  component: {
55
+        name: 'example.NewRootScreen',
56
+        passProps: {
57
+          text: 'Root screen'
58
+        },
59
+        options: {
60
+          animated: true // Will animate root change same as push
61
+        }
62
+      }
61
 });
63
 });
62
-``` -->
64
+```
63
 
65
 
64
 ## showModal(layout = {})
66
 ## showModal(layout = {})
65
 
67
 

+ 3
- 29
docs/docs/top-level-api.md View File

47
 });
47
 });
48
 ```
48
 ```
49
 
49
 
50
-## startSingleScreenApp(params) -> setRoot({stack})
51
-
52
-Change your app root into an app based on a single screen (like the iOS Calendar or Settings app). The screen will receive its own navigation stack with a native nav bar
53
-
54
-```js
55
-Navigation.setRoot({
56
-  stack: {
57
-    children: [{
58
-      component: {
59
-        name: 'example.WelcomeScreen',
60
-        passProps: {
61
-          text: 'stack with one child'
62
-        }
63
-      }
64
-    }],
65
-    options: {
66
-      topBar: {
67
-        title: {
68
-          text: 'Welcome screen'
69
-        }
70
-      }
71
-    }
72
-  }
73
-});
74
-```
75
-
76
-## showModal(params = {}) -> showModal(layout = {})
50
+## showModal(layout = {})
77
 
51
 
78
 Show a screen as a modal.
52
 Show a screen as a modal.
79
 
53
 
99
 });
73
 });
100
 ```
74
 ```
101
 
75
 
102
-## dismissModal(params = {}) -> dismissModal(componentId)
76
+## dismissModal(componentId)
103
 
77
 
104
 Dismiss the current modal.
78
 Dismiss the current modal.
105
 
79
 
107
 Navigation.dismissModal(this.props.componentId);
81
 Navigation.dismissModal(this.props.componentId);
108
 ```
82
 ```
109
 
83
 
110
-## dismissAllModals(params = {}) -> dismissAllModals()
84
+## dismissAllModals()
111
 
85
 
112
 Dismiss all the current modals at the same time.
86
 Dismiss all the current modals at the same time.
113
 
87
 

+ 1
- 1
lib/ios/RNNNavigationStackManager.m View File

113
 		}
113
 		}
114
 	}];
114
 	}];
115
 	
115
 	
116
-	[nvc setViewControllers:@[newRoot] animated:newRoot.options.animated];
116
+	[nvc setViewControllers:@[newRoot] animated:[newRoot.options.animated boolValue]];
117
 	
117
 	
118
 	[CATransaction commit];
118
 	[CATransaction commit];
119
 }
119
 }

+ 1
- 0
playground/src/screens/PushedScreen.js View File

88
           previousScreenIds: _.concat([], this.props.previousScreenIds || [], this.props.componentId)
88
           previousScreenIds: _.concat([], this.props.previousScreenIds || [], this.props.componentId)
89
         },
89
         },
90
         options: {
90
         options: {
91
+          animated: true,
91
           topBar: {
92
           topBar: {
92
             title: {
93
             title: {
93
               text: `Pushed ${this.getStackPosition() + 1}`
94
               text: `Pushed ${this.getStackPosition() + 1}`