Skip to content

Commit 10578d7

Browse files
committed
readme RN
1 parent 42baea2 commit 10578d7

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,6 @@ TODO
191191

192192
TODO
193193

194-
# TODO
195-
196-
- Complete examples
197-
- Support updates with a function (like `setState(oldState => newState)`)
198194

199195

200196
# FAQ
@@ -203,6 +199,27 @@ TODO
203199

204200
No. You can use this lib for whatever you want (including global state management) as long as it makes your life simple. For example, if you have a complex page and passing props and callbacks down becomes complicated you can create an updatable context fot that page.
205201

202+
### Does it work with React-Native?
203+
204+
Yes. Sometimes I want to share state between react-navigation screens (for example a multi-screen wizzard). That can be a replacement for `screenProps` that are not recommended to use anymore.
205+
206+
You can wrap your navigator with an updatable context provider for that:
207+
208+
```jsx harmony
209+
const MyStackNavigator = createStackNavigator(...);
210+
211+
const MyStatefulStackNavigator = (props) => (
212+
<Provider initialValue={myInitialNavigatorState}>
213+
<MyStackNavigator {...props}/>
214+
</Provider>
215+
);
216+
MyStatefulStackNavigator.router = MyStackNavigator.router;
217+
```
218+
219+
# TODO
220+
221+
- Complete examples
222+
- Support updates with a function (like `setState(oldState => newState)`)
206223

207224
# License
208225

0 commit comments

Comments
 (0)