Commit Graph

591 Commits

Author SHA1 Message Date
satyajit.happy
819b7904fa feat: add a useFocusEffect hook 2019-08-01 12:38:58 +02:00
satyajit.happy
fb8d3024bf feat: add focus and blur events 2019-08-01 12:34:54 +02:00
Satyajit Sahoo
f130d3c292 fix: don't crash if no navigator handles an action (#30) 2019-07-31 12:09:33 +01:00
Satyajit Sahoo
7787ee16aa fix: memoize callbacks in container to avoid re-creating navigation prop (#34) 2019-07-31 12:00:44 +01:00
satyajit.happy
0893388155 test: add a test for useNavigation 2019-07-30 22:05:30 +02:00
satyajit.happy
9ff483a554 fix: adjust index when route names are changed 2019-07-29 00:59:11 +02:00
satyajit.happy
04483a4f1b test: fix types for mock router 2019-07-29 00:52:07 +02:00
satyajit.happy
571c513eae fix: throw when no screens defined 2019-07-29 00:50:43 +02:00
Michal Osadnik
1368b4fd20 refactor: change names in example 2019-07-27 15:54:02 +02:00
Michał Osadnik
20f1998d7f feat: imperative dispatch 2019-07-26 19:07:00 +01:00
satyajit.happy
f4f0ad6272 fix: use the same navigation object for options and screen 2019-07-25 11:52:03 +02:00
satyajit.happy
c0715dda58 fix: fix tab router in example app 2019-07-24 15:18:58 +02:00
satyajit.happy
049d03f321 refactor: rehydrate only once 2019-07-24 11:20:13 +02:00
satyajit.happy
d6501d3e5d fix: make rehydration keys stable 2019-07-24 10:56:41 +02:00
satyajit.happy
13b16b2d42 refactor: only accept a key for setParams
It doesn't make much sense for setParams to accept a name as you'd not want to set params for a random route.
So this commit changes the signature so that only a key can be passed.

It also adds a 'source' property to actions which the reducer can use if key wasn't provided.
2019-07-23 23:37:01 +02:00
satyajit.happy
d4f1fb731a refactor: move type imports to the end 2019-07-23 23:23:21 +02:00
Michał Osadnik
f41657e4fe refactor: make router a function (#22) 2019-07-23 23:21:23 +02:00
satyajit.happy
ae599aa006 chore: fix linting files 2019-07-23 23:16:52 +02:00
Satyajit Sahoo
75d356f3e9 chore: supress error messages regarding error boundary in tests (#28) 2019-07-23 21:51:39 +01:00
satyajit.happy
78ccf49627 fix: combine options and fix state type in CompositeNavigationProp 2019-07-23 13:23:39 +02:00
satyajit.happy
ab17e9af73 refactor: let router specify its state shape 2019-07-23 13:05:22 +02:00
satyajit.happy
55246370a6 fix: fix the types for composite navigation prop 2019-07-23 10:55:03 +02:00
Satyajit Sahoo
30b8fb26b1 fix: fix type signature for setParams (#24) 2019-07-23 00:53:38 +02:00
satyajit.happy
d3e200d727 refactor: only accept name in jumpTo 2019-07-23 00:26:43 +02:00
Satyajit Sahoo
bd6aa667cb refactor: mark initial state as stale to determine when to rehydrate (#23) 2019-07-22 22:21:56 +01:00
satyajit.happy
2798c93e8b refactor: tweak types 2019-07-22 21:01:39 +02:00
satyajit.happy
2eb86cd215 feat: add a setOptions method to set screen options
In React Navigation, the screen options can be specified statically. If you need to configure any options based on props and state of the component, or want to update state and props based on some action such as tab press, you need to do it in a hacky way by changing params. it's way more complicated than it needs to be. It also breaks when used with HOCs which don't hoist static props, a common source of confusion.

This PR adds a `setOptions` API to be able to update options directly without going through params.
2019-07-22 20:50:53 +02:00
satyajit.happy
2b819e4310 feat: improve types for options and support a function 2019-07-22 12:21:40 +02:00
satyajit.happy
e1cf13e34d feat: add a useNavigation hook to access the navigation object 2019-07-21 15:37:11 +02:00
satyajit.happy
57b7ed827c refactor: move some common actions to base router 2019-07-21 02:55:34 +02:00
Michał Osadnik
1de5494793 feat: add target argument to setParams (#18) 2019-07-20 20:51:03 +01:00
dependabot[bot]
a64f402ded chore(deps): bump lodash from 4.17.10 to 4.17.11 (#17) 2019-07-20 19:54:43 +01:00
Michał Osadnik
4483dd2c3a feat: make NAVIGATE and JUMP_TO to support key and name of the route (#16) 2019-07-20 16:46:29 +01:00
Satyajit Sahoo
44b2ace9ee refactor: drop getStateForChildUpdate in favor of getStateForRouteFocus (#15) 2019-07-20 13:05:30 +01:00
Satyajit Sahoo
3d8ba13135 refactor: memoize the context object in container (#14) 2019-07-20 13:05:00 +01:00
satyajit.happy
6955ae9d25 feat: handle screens nested in React.Fragment 2019-07-20 05:28:51 +02:00
Michał Osadnik
637263e9cf refactor: make container a function (#13) 2019-07-20 05:28:36 +02:00
Michal Osadnik
77c7315350 refactor: get rid of dangerously setState 2019-07-18 23:50:29 +01:00
Michał Osadnik
cb89debb94 refactor: add transaction support (#12) 2019-07-18 23:17:59 +01:00
satyajit.happy
38aa8e447b docs: update README to match latest API 2019-07-18 22:09:44 +02:00
Michał Osadnik
d3099c18b8 refactor: move navigation.state to a route prop (#6) 2019-07-18 15:14:47 +02:00
satyajit.happy
b775dbaacf feat: handle route names change 2019-07-18 14:47:04 +02:00
satyajit.happy
95773de0a3 refactor: create initial state only once 2019-07-17 12:38:04 +02:00
Michal Osadnik
ea8655252d feat: let child navigators handle actions from parent
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2019-07-17 12:36:55 +02:00
Michał Osadnik
f383d131d9 feat: add createNavigator and not export Screen directly (#3) 2019-07-17 00:11:53 +01:00
satyajit.happy
0ff3de1266 refactor: use a class component for the container
With the function component. we have issues with our getState function which doesn't always return latest state.
2019-07-16 12:28:15 +02:00
satyajit.happy
e7014a62e3 refactor: remove code for cleaning up navigator
It messes up with other state changes. We'll figure something out later
2019-07-15 04:35:21 +02:00
satyajit.happy
6a58a4a966 fix: cleanup navigator state on unmount 2019-07-14 19:39:32 +02:00
satyajit.happy
cfb3921446 docs: add JSDoc for some comments 2019-07-14 18:57:31 +02:00
satyajit.happy
db6fe6bb1e refactor: add separate method for rehydration and fix types 2019-07-14 18:42:30 +02:00