Commit Graph

1200 Commits

Author SHA1 Message Date
Steven Conaway
84aea698f2 docs: fix grammar issue in a readme 2020-06-22 16:23:20 +02:00
Satyajit Sahoo
8177c45d14 feat: add an onReady callback to the container (#8491) 2020-06-22 14:03:57 +02:00
Satyajit Sahoo
16128199ed fix: remove broken showIcon option from bottom-tabs 2020-06-22 12:05:05 +02:00
Satyajit Sahoo
ea5affd914 fix: use interpolateNode in drawer to support Reanimated 2 2020-06-22 11:45:52 +02:00
Satyajit Sahoo
d2444887be fix: more improvements to types 2020-06-22 11:45:52 +02:00
Wojciech Lewicki
962456beb6 fix: fix screen disappearing on Android (#8473)
Added `collapsable={false}` to the View in order for the Android to render screens properly. This issue is most probably similar to 9c06a92d09 but fixes it on Android since the View seems to be removed from a native view hierarchy due to not drawing anything. To see the bug go to https://github.com/software-mansion/react-native-screens/issues/544.
2020-06-19 19:38:32 +02:00
Satyajit Sahoo
1aadc79fb8 refactor: enforce import type everywhere 2020-06-17 12:05:40 +02:00
Satyajit Sahoo
b14fd9453d chore: better check versions action 2020-06-16 22:44:03 +02:00
Satyajit Sahoo
cc3728fc95 chore: tweak repository field in package.json. closes #8423 2020-06-16 21:46:09 +02:00
Satyajit Sahoo
bf1ee2d9ff chore: master -> main 2020-06-16 21:42:22 +02:00
Satyajit Sahoo
6730690529 fix: fix getCurrentOptions for nested screens 2020-06-16 15:38:09 +02:00
Satyajit Sahoo
afc83eedf8 fix: fix getCurrentOptions for nested screens 2020-06-16 15:27:15 +02:00
Satyajit Sahoo
24e4333ec6 chore: update github workflows 2020-06-16 14:05:27 +02:00
Guilherme Pacheco
4480d2fe04 feat: add iconStyle prop to bottom tab bar options (#8188)
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-06-15 19:11:03 +02:00
Satyajit Sahoo
33476b9cb5 refactor: tweak type for screen options 2020-06-15 18:34:08 +02:00
Satyajit Sahoo
07c30b2847 refactor: tweak types for bottom tab bar 2020-06-15 18:01:37 +02:00
Michał Osadnik
fe3f98eb9c feat: add event for options on container (#8334) 2020-06-15 17:56:01 +02:00
Kang Byung Seon
35d6b9e3a4 fix: don't use deprecated currentlyFocusedField (#8365)
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-06-15 15:12:56 +02:00
Satyajit Sahoo
95b044ecf9 feat: add devtools package (#8436)
The `devtools` package extracts the redux devtools extension integration to a separate package. In future we can add more tools such as flipper integration to this package.

Usage:

```js
import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { useReduxDevToolsExtension } from '@react-navigation/devtools';

export default function App() {
  const navigationRef = React.useRef();

  useReduxDevToolsExtension(navigationRef);

  return (
    <NavigationContainer ref={navigationRef}>{/* ... */}</NavigationContainer>
  );
}
```
2020-06-15 13:53:17 +02:00
Satyajit Sahoo
f51f9c8493 feat: add helper to get focused route name from nested state (#8435)
Currently, to access the focused child screen, we need to do something like this:

```js
const routeName = route.state
  ? route.state.routes[route.state.index].name
  : route.params?.screen || 'Feed';
```

However, it doesn't handle some cases, such as when `route.state` is partial. This helper will make it easier:

```js
const routeName = getFocusedRouteNameFromRoute(route) ?? 'Feed';
```
2020-06-15 13:52:38 +02:00
Rajendran Nadar
e000138fe5 chore: add v5 package versions in readme (#8413) 2020-06-15 10:13:44 +02:00
Satyajit Sahoo
5042c86a09 chore: upgrade depenendecies 2020-06-12 18:37:40 +02:00
Satyajit Sahoo
34c907ec0a chore: publish
- @react-navigation/stack@5.5.1
@react-navigation/stack@5.5.1
2020-06-08 11:21:27 +02:00
Satyajit Sahoo
1ae07af796 fix: make sure the header is on top of the view 2020-06-08 11:17:53 +02:00
Satyajit Sahoo
220af93db5 chore: publish
- @react-navigation/stack@5.5.0
@react-navigation/stack@5.5.0
2020-06-08 10:56:32 +02:00
Satyajit Sahoo
1f27e4b1f6 fix: ignore onOpen from route that wasn't closing
closes #8257
2020-06-08 10:48:04 +02:00
Satyajit Sahoo
9c06a92d09 fix: fix blank screen with animationEnabled: false & headerShown: false
closes #8391
2020-06-08 10:17:02 +02:00
Satyajit Sahoo
e0e0f79793 feat: automatically hide header in nested stacks 2020-06-08 08:14:34 +02:00
Jeroen Verfallie
c7e4bf94e6 fix: pass gestureRef to PanGestureHandlerNative (#8394)
In the current implementation the ref is unused, resulting in a constant `current: {null}` on the context.
2020-06-08 08:05:59 +02:00
Satyajit Sahoo
7024d4bb81 docs: fix comment about headerBacktitleVisible 2020-06-08 01:47:09 +02:00
Satyajit Sahoo
21f61d6eeb chore: publish
- @react-navigation/bottom-tabs@5.5.2
 - @react-navigation/compat@5.1.26
 - @react-navigation/core@5.10.0
 - @react-navigation/drawer@5.8.2
 - @react-navigation/material-bottom-tabs@5.2.10
 - @react-navigation/material-top-tabs@5.2.10
 - @react-navigation/native@5.5.1
 - @react-navigation/stack@5.4.2
@react-navigation/bottom-tabs@5.5.2 @react-navigation/compat@5.1.26 @react-navigation/core@5.10.0 @react-navigation/drawer@5.8.2 @react-navigation/material-bottom-tabs@5.2.10 @react-navigation/material-top-tabs@5.2.10 @react-navigation/native@5.5.1 @react-navigation/stack@5.4.2
2020-06-06 02:15:26 +02:00
Jean Regisser
8774ca97e1 fix: catch missing params when they are required in navigate (#8389)
There is a problem with the enforcement of required params in `navigation.navigate(...)` in TypeScript as described in https://github.com/react-navigation/react-navigation/issues/7936

@Miyou found a fix 🥳. All credits go to him.

I needed this so went ahead and submitted a PR and added a test to avoid it from breaking in the future.

However note that until this project switches to TypeScript 3.9 with support for [`@ts-expect-error`](https://devblogs.microsoft.com/typescript/announcing-typescript-3-9-beta/#ts-expect-error-comments), it can still break silently.

Before the change, this is how the test looks:
<img width="861" alt="Screenshot 2020-06-05 at 22 51 00" src="https://user-images.githubusercontent.com/57791/83923057-c53dc180-a781-11ea-8c35-36406a23a717.png">
As you can see it doesn't catch the missing params which are required on line 28.

After the change, all expected errors are raised:
<img width="812" alt="Screenshot 2020-06-05 at 22 51 59" src="https://user-images.githubusercontent.com/57791/83923413-80665a80-a782-11ea-8ff2-f5af3f4e1f32.png">

Let me know what you think.
2020-06-06 00:57:28 +02:00
Satyajit Sahoo
e653d55479 refactor: minor tweaks 2020-06-06 00:38:38 +02:00
Ashoat Tevosyan
78afbffe97 fix: relatively position float Header if !headerTransparent (#8285)
## Motivation

Right now `headerMode: float` renders an absolutely-positioned header. To offset the content appropriately, it then measures the height of the header and compensates with a margin. This approach unfortunately doesn't work well for animations.

Before             |  After
:-------------------------:|:-------------------------:
<img src="http://ashoat.com/jerky_absolute.gif" width="300" />  |  <img src="http://ashoat.com/smooth_relative.gif" width="300" />

## Approach

When rendering the header absolutely we want to render it above (after, in sibling order) the content. But when rendering it relatively we want to render it first (before, in sibling order).

The margin compensation code is no longer necessary so I removed it.

## Test plan

I used the `StackHeaderCustomization` example to make sure transitions between `headerTransparent` and `!headerTransparent` looked good. I added a custom (taller) header to test if height transitions looked good, and toggled `headerShown` to make sure that transitioned well too.

Would be open to any other suggestions of things to test!
2020-06-06 00:12:00 +02:00
Diego Mello
762cc44578 fix: typo on drawerPosition default props (#8357)
Fix a minor typo from `drawerPostion` to `drawerPosition` :)

Fix https://github.com/react-navigation/react-navigation/issues/8358
2020-06-05 23:48:10 +02:00
Satyajit Sahoo
c3bd349d77 fix: make sure the wildcard pattern catches nested unmatched routes 2020-06-05 23:03:37 +02:00
Satyajit Sahoo
5dcaf903f3 refactor: rework history stack integration (#8367)
The PR reworks history integration to better integrate with browser's history stack and supports nested navigation more reliably:

- On each navigation, save the navigation in memory and use it to reset the state when user presses back/forward
- Improve heuristic to determine if we should do a push, replace or back

This closes #8230, closes #8284 and closes #8344
2020-06-05 23:02:35 +02:00
Satyajit Sahoo
2d66ef93ec fix: only use the query params for focused route in path 2020-06-05 20:01:52 +02:00
Satyajit Sahoo
4fe72e3ce7 feat: add wildcard patterns for paths
Currently, if we don't have matching routes for a path, we'll reuse the path name for the route name. This doesn't produce an error, and renders the initial route in the navigator. However, the user doesn't have a way of handling this with the default configuration.

This PR adds support for a wildcard pattern ('*'). The wildcard pattern will be matched after all other patterns were matched and will always match unmatched screens. This allows the user to implement a 404 screen.

Example:

```js
{
  Home: '',
  Profile: 'user/:id',
  404: '*',
}
```

This config will return the `404` route for paths which didn't match `Home` or `Profile`, e.g. - `/test`

Closes #8019

Co-authored-by: Evan Bacon <baconbrix@gmail.com>
2020-06-05 17:13:00 +02:00
Satyajit Sahoo
ab1f79c096 fix: prevent state change being emitted unnecessarily 2020-06-01 21:32:08 +02:00
Satyajit Sahoo
9305bfa939 chore: try to fix yarn caching on gh actions 2020-05-27 20:12:33 +02:00
Satyajit Sahoo
0c3c450f5f chore: tweak SSR output 2020-05-27 19:55:37 +02:00
Satyajit Sahoo
7ac4c13d44 chore: publish
- @react-navigation/bottom-tabs@5.5.1
 - @react-navigation/compat@5.1.25
 - @react-navigation/core@5.9.0
 - @react-navigation/drawer@5.8.1
 - @react-navigation/material-bottom-tabs@5.2.9
 - @react-navigation/material-top-tabs@5.2.9
 - @react-navigation/native@5.5.0
 - @react-navigation/stack@5.4.1
@react-navigation/bottom-tabs@5.5.1 @react-navigation/compat@5.1.25 @react-navigation/core@5.9.0 @react-navigation/drawer@5.8.1 @react-navigation/material-bottom-tabs@5.2.9 @react-navigation/material-top-tabs@5.2.9 @react-navigation/native@5.5.0 @react-navigation/stack@5.4.1
2020-05-27 18:32:30 +02:00
Raviraj
a0b9f94120 refactor: remove unnecessary check for type of bottom tab bar label 2020-05-27 18:12:21 +02:00
Satyajit Sahoo
717dffdb81 chore: improve caching of yarn on gh actions 2020-05-27 13:31:50 +02:00
Satyajit Sahoo
9016ba00e3 chore: improve caching of yarn on circleci 2020-05-27 13:19:41 +02:00
Satyajit Sahoo
9d822b95a6 fix: fix type of style for various options 2020-05-26 17:33:50 +02:00
Satyajit Sahoo
52d5cb4179 chore: add an example for SSR (#8298)
<img width="740" alt="Screen Shot 2020-05-20 at 16 31 30" src="https://user-images.githubusercontent.com/1174278/82458770-673d8880-9ab7-11ea-81d3-8ac0c1e52705.png">
2020-05-26 16:07:47 +02:00
Satyajit Sahoo
af1722d1e9 fix: export types from /native 2020-05-26 14:11:48 +02:00
Satyajit Sahoo
0b1a718756 feat: add ref to get current options in ServerContainer (#8333)
User can pass a `ref` to the container to get current options, like they can with `NavigationContainer`:

```js
const ref = React.createRef();

const html = renderToString(
  <ServerContainer ref={ref}>
    <App />
  </ServerContainer>
);

ref.current.getCurrentOptions(); // Options for screen
```
2020-05-26 13:55:06 +02:00