Satyajit Sahoo
3096de6286
fix: only call listeners for focused screen for global events
2020-03-23 13:43:43 +01:00
Satyajit Sahoo
1c001424b5
fix: don't emit events for screens that don't exist anymore
2020-03-23 13:03:33 +01:00
Satyajit Sahoo
179b6312fe
chore: update prettier
2020-03-22 23:58:06 +01:00
Satyajit Sahoo
3709e652f4
feat: support function in listeners prop
2020-03-22 23:33:25 +01:00
Satyajit Sahoo
5b15c7164f
fix: return correct value for isFocused after changing screens
...
fixes #7843
2020-03-22 23:31:04 +01:00
Satyajit Sahoo
d5bb357053
chore: temporarily disables devtools until we add a public API
...
closes #7726
2020-03-19 18:39:04 +01:00
Satyajit Sahoo
646cbfb28e
refactor: move action helper types to routers
2020-03-13 12:34:37 +01:00
Satyajit Sahoo
5bb0f405ce
fix: fix links for documentation
2020-02-28 17:12:18 +01:00
Satyajit Sahoo
2dfa4f3629
fix: move updating state to useEffect
2020-02-28 17:01:58 +01:00
Satyajit Sahoo
162410843c
feat: add ability add listeners with listeners prop
...
This adds ability to listen to events from the component where the navigator is defined, even if the screen is not rendered.
```js
<Tabs.Screen
name="Chat"
component={Chat}
options={{ title: 'Chat' }}
listeners={{
tabPress: e => console.log('Tab press', e.target),
}}
/>
```
Closes #6756
2020-02-26 13:02:22 +01:00
Satyajit Sahoo
028c2887c6
refactor: tweak error messages more
2020-02-25 20:58:14 +01:00
Satyajit Sahoo
7a44cda136
refactor: tweak error messages
2020-02-25 17:58:09 +01:00
Satyajit Sahoo
f16700812f
fix: avoid emitting focus events twice
...
fixes #6749
2020-02-21 18:56:06 +01:00
Satyajit Sahoo
125bd70e49
fix: preserve screen order with numeric names
...
fixes #6900
2020-02-21 05:43:32 +01:00
Satyajit Sahoo
bb0226e26d
chore: tweak error message
2020-02-18 18:59:39 +01:00
Satyajit Sahoo
1a28c299b5
fix: show descriptive error for invalid return for useFocusEffect
2020-02-15 20:02:39 +01:00
Satyajit Sahoo
040f5dbb9d
refactor: drop use of performTransaction
2020-02-15 19:05:50 +01:00
Satyajit Sahoo
aaf01e01e7
fix: return '/' for empty paths
2020-02-14 23:17:29 +01:00
Satyajit Sahoo
ac242fd281
refactor: discard all routes but last when getting action from state
2020-02-14 23:04:09 +01:00
Satyajit Sahoo
c5fcfbd427
fix: link to migration guide on invalid usage
2020-02-14 22:48:04 +01:00
Satyajit Sahoo
f964200b0d
fix: update links in error messages
2020-02-14 18:32:53 +01:00
Satyajit Sahoo
c8ac5fab61
fix: return false for canGoBack if navigator hasn't finished mounting
2020-02-12 21:28:03 +01:00
Satyajit Sahoo
b6accd03f6
fix: throw a descriptive error if navigation object hasn't initialized
2020-02-12 20:59:58 +01:00
Satyajit Sahoo
030c63c89f
fix: fix false positives for circular object check
...
fixes #6827
2020-02-12 11:42:36 +01:00
Abhinandan Ramaprasath
2bf0958502
fix: static container memo check ( #6825 )
...
Memo check compared elements of prevProps to nextProps but failed
to take new props into account. Fixed the logic and added a new
test.
2020-02-12 10:56:23 +01:00
Satyajit Sahoo
359ae1bfac
fix: don't cleanup state on switching navigator
...
This leads to a glitch. Switching navigators should be handled by the router properly.
2020-02-11 18:56:27 +01:00
Satyajit Sahoo
13b4e07348
fix: add some links in the error messages
2020-02-10 16:16:54 +01:00
Satyajit Sahoo
86c39d2e0e
refactor: move types and base router to routers package
2020-02-10 16:04:20 +01:00
Wojciech Lewicki
61b1134f90
feat: support ignoring empty path strings ( #349 )
2020-02-05 13:31:40 +01:00
Satyajit Sahoo
ca4a36070a
fix: improve error message for unhandled action
2020-02-04 17:33:03 +01:00
Wojciech Lewicki
4ca5cc6329
feat: add initialRouteName property to config ( #322 )
2020-02-04 14:44:57 +01:00
Michał Osadnik
bec2f754d4
refactor: rename NavigationNativeContainer to NavigationContainer ( #344 )
2020-02-04 10:21:16 +01:00
Satyajit Sahoo
e5063b9339
fix: ignore circular references when checking serializable
2020-02-03 05:18:03 +01:00
Satyajit Sahoo
fa4a959549
fix: add warning when passing inline function to component prop
2020-01-30 05:03:32 +01:00
Satyajit Sahoo
5a3f8356b0
feat: integrate with history API on web
2020-01-29 23:14:12 +01:00
Satyajit Sahoo
eeae11033a
refactor: track history for tabs and drawer in a history key
2020-01-29 23:14:12 +01:00
Wojciech Lewicki
b931ae62df
feat: add screens prop for nested configs ( #308 )
...
Nested configs' names with their configs are now in `screens` property of the route object.
2020-01-29 16:26:17 +01:00
Satyajit Sahoo
ecd68afb46
feat: add useIsDrawerOpen hook ( #299 )
2020-01-27 12:59:24 +01:00
Satyajit Sahoo
2243b45cc1
fix: tweak error messages for validation
2020-01-25 14:42:17 +01:00
NoemiRozpara
5751e7f97a
fix: warn if non-serializable values found in state
2020-01-24 12:58:06 +01:00
Satyajit Sahoo
179e807a64
fix: add error message when trying to use v4 API with v5
2020-01-24 00:01:35 +01:00
Satyajit Sahoo
2f1f0af862
fix: validate screen configs
2020-01-23 23:52:27 +01:00
Satyajit Sahoo
9976a888a0
refactor: move replace to stack router
2020-01-23 20:13:40 +01:00
Satyajit Sahoo
14250851d1
refactor: remove resetRoot from the navigation prop
...
Using `resetRoot` requires knowledge of the whole navigation tree that a specific screen shouldn't have. It's better to remove it to discourage resetting whole navigator state from inside a screen.
It's still possible if the user needs it:
- Expose `resetRoot` from container's ref via context
- Use `reset` with the target set to the root navigation state's key
2020-01-23 14:44:34 +01:00
Satyajit Sahoo
6c2acbb304
fix: make sure that we return correct value if selector changes
...
https://github.com/react-navigation/navigation-ex/pull/273#issuecomment-576581225
2020-01-21 18:04:04 +01:00
Satyajit Sahoo
65e5147910
chore: add some more examples
2020-01-20 15:38:05 +01:00
Satyajit Sahoo
32a2206513
feat: add useNavigationState hook
...
Sometimes it's useful to get the current navigation state inside a screen. We have the `dangerouslyGetState` method for that. However, the problem with this method is that it won't trigger a re-render when it changes, so user cannot rely on it for rendering something.
This adds a 2 things:
1. A `state` event similar to `focus` and `blur` that user can subscribe to
2. A `useNavigationState` hook that takes a selector and returns part of the state
Internally `useNavigationState` subscribes to the state event to get the current navigation state.
I have also made it mandatory to pass a selector to `useNavigationState`. This makes it harder to accidentally get the whole navigation state, which will trigger a re-render every time anything changes, even if we don't care about the change. With a selector, we can tell which part we care about, and if that part didn't change, it won't trigger a re-render.
For example, to get the same functionality as the old `isFirstRouteInParent` method:
```js
function MyComponent({ route }) {
const isFirstRouteInParent = useNavigationState(state => state.routes[0] === route);
// content
}
```
2020-01-18 23:25:42 +01:00
Satyajit Sahoo
3bf5ddde2a
fix: don't add ?if query params is empty
2020-01-18 22:30:39 +01:00
Wojciech Lewicki
1e53821d52
feat: support nested config in getPathFromState ( #266 )
...
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com >
2020-01-17 22:43:37 +01:00
Satyajit Sahoo
23ab45aceb
fix: fix types for useFocusEffect
...
See #270
2020-01-17 15:54:02 +01:00