Commit Graph

1315 Commits

Author SHA1 Message Date
Satyajit Sahoo
5eee804e7f chore: publish
- @react-navigation/bottom-tabs@5.10.1
 - @react-navigation/compat@5.3.1
 - @react-navigation/core@5.13.1
 - @react-navigation/devtools@5.1.9
 - @react-navigation/drawer@5.10.1
 - @react-navigation/material-bottom-tabs@5.3.1
 - @react-navigation/material-top-tabs@5.3.1
 - @react-navigation/native@5.8.1
 - @react-navigation/routers@5.5.1
 - @react-navigation/stack@5.11.0
@react-navigation/bottom-tabs@5.10.1 @react-navigation/compat@5.3.1 @react-navigation/core@5.13.1 @react-navigation/devtools@5.1.9 @react-navigation/drawer@5.10.1 @react-navigation/material-bottom-tabs@5.3.1 @react-navigation/material-top-tabs@5.3.1 @react-navigation/native@5.8.1 @react-navigation/routers@5.5.1 @react-navigation/stack@5.11.0
2020-10-28 22:21:16 +01:00
Satyajit Sahoo
45dbe5c40e feat: enable react-native-screens in Stack by default on iOS 2020-10-28 22:15:37 +01:00
Satyajit Sahoo
d26bcc057e fix: improve types for route prop in screenOptions 2020-10-28 22:06:52 +01:00
Satyajit Sahoo
836ca4482e chore: fix loading indicator not visible in auth example 2020-10-27 01:37:53 +01:00
Satyajit Sahoo
fdd549a536 chore: migrate example to community async-storage 2020-10-27 00:44:30 +01:00
Satyajit Sahoo
128bbbe62a chore: add ability to manually run expo publish workflow 2020-10-25 02:05:18 +02:00
Satyajit Sahoo
a186b445b4 chore: fix slug for example app 2020-10-25 01:58:38 +02:00
Satyajit Sahoo
ac11a3bded chore: publish
- @react-navigation/bottom-tabs@5.10.0
 - @react-navigation/compat@5.3.0
 - @react-navigation/core@5.13.0
 - @react-navigation/devtools@5.1.8
 - @react-navigation/drawer@5.10.0
 - @react-navigation/material-bottom-tabs@5.3.0
 - @react-navigation/material-top-tabs@5.3.0
 - @react-navigation/native@5.8.0
 - @react-navigation/routers@5.5.0
 - @react-navigation/stack@5.10.0
@react-navigation/bottom-tabs@5.10.0 @react-navigation/compat@5.3.0 @react-navigation/core@5.13.0 @react-navigation/devtools@5.1.8 @react-navigation/drawer@5.10.0 @react-navigation/material-bottom-tabs@5.3.0 @react-navigation/material-top-tabs@5.3.0 @react-navigation/native@5.8.0 @react-navigation/routers@5.5.0 @react-navigation/stack@5.10.0
2020-10-25 01:38:02 +02:00
Satyajit Sahoo
55d635f53e chore: fix custom link button example on web 2020-10-25 01:32:36 +02:00
Satyajit Sahoo
95600500a4 chore: upgrade depenendecies 2020-10-25 01:28:19 +02:00
Satyajit Sahoo
6cf124a190 docs: improve jsdoc for linking 2020-10-24 23:51:59 +02:00
Satyajit Sahoo
bfd0d94985 docs: fix incorrect comment 2020-10-24 23:35:50 +02:00
Satyajit Sahoo
748e92f120 feat: add getInitialURL and subscribe options to linking config
For apps with push notifications linking to screens inside the app, currently we need to handle them separately (e.g. [instructions for firebase](https://rnfirebase.io/messaging/notifications#handling-interaction), [instructions for expo notifications](https://docs.expo.io/push-notifications/receiving-notifications/)). But if we add a link in the notification to use for deep linking, we can instead reuse the same deep linking logic instead.

This commit adds the `getInitialURL` and `subscribe` options which internally used `Linking` API to allow more advanced implementations by combining it with other sources such as push notifications.

Example usage with Firebase notifications could look like this:

```js
const linking = {
  prefixes: ['myapp://', 'https://myapp.com'],
  async getInitialURL() {
    // Check if app was opened from a deep link
    const url = await Linking.getInitialURL();

    if (url != null) {
      return url;
    }

    // Check if there is an initial firebase notification
    const message = await messaging().getInitialNotification();

    // Get the `url` property from the notification which corresponds to a screen
    // This property needs to be set on the notification payload when sending it
    return message?.notification.url;
  },
  subscribe(listener) {
    const onReceiveURL = ({ url }: { url: string }) => listener(url);

    // Listen to incoming links from deep linking
    Linking.addEventListener('url', onReceiveURL);

    // Listen to firebase push notifications
    const unsubscribeNotification = messaging().onNotificationOpenedApp(
      (message) => {
        const url = message.notification.url;

        if (url) {
          // If the notification has a `url` property, use it for linking
          listener(url);
        }
      }
    );

    return () => {
      // Clean up the event listeners
      Linking.removeEventListener('url', onReceiveURL);
      unsubscribeNotification();
    };
  },
  config,
};
```
2020-10-24 23:32:51 +02:00
Satyajit Sahoo
7f3b27a9ec feat: allow deep linking to reset state (#8973)
Currently when we receive a deep link after the app is rendered, it always results in a `navigate` action. While it's ok with the default configuration, it may result in incorrect behaviour when a custom `getStateForPath` function is provided and it returns a routes array different than the initial route and new route pair.

The commit changes 2 things:

1. Add ability to reset state via params of `navigate` by specifying a `state` property instead of `screen`
2. Update `getStateForAction` to return an action for reset when necessary according to the deep linking configuration

Closes #8952
2020-10-24 15:27:06 +02:00
Satyajit Sahoo
f51086edea feat: update helper types to have navigator specific methods 2020-10-23 18:12:36 +02:00
Wojciech Lewicki
7196889bf1 feat: add optional screens per navigator (#8805)
Changes done here will work properly with https://github.com/software-mansion/react-native-screens/pull/624 merged and released. The documentation of `screensEnabled` and `activeLimit` props should also be added. It also enabled `Screens` in iOS stack-navigator by default.

New things:
- `detachInactiveScreens` - prop for navigators with `react-native-screens` integration that can be set by user. It controls if the `react-native-screens` are used by the navigator.
- `detachPreviousScreen` - option that tells to keep the previous screen active. It can be set by user, defaults to `true` for normal mode and `false` for the last screen for mode = “modal”.

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-10-23 17:59:26 +02:00
Satyajit Sahoo
7dc2f5832e feat: improve types for navigation state (#8980)
The commit improves the navigation state object to have more specific types.
e.g. The `routeNames` array will now have proper type instead of `string[]`
2020-10-23 17:06:31 +02:00
Satyajit Sahoo
8ec6c1a603 chore: remove test code from example app 2020-10-23 16:51:44 +02:00
Satyajit Sahoo
960f0a5281 refactor: make sure height set on header container is focused header height 2020-10-23 03:32:40 +02:00
Satyajit Sahoo
da91cec941 fix: add missing check for parent header when calculating height 2020-10-23 02:37:36 +02:00
Satyajit Sahoo
38e17aae93 fix: don't set statusbar height on nested header by default 2020-10-23 02:27:50 +02:00
Satyajit Sahoo
0f60b4617f refactor: refactor HeaderSegment to function component 2020-10-23 02:17:04 +02:00
Drew Miller
f01bb4834b feat: add sceneContainerStyle prop to bottom-tabs navigator (#8947)
This feature adds the sceneContainerStyle prop to the bottom-tabs navigator, to allow setting styles on the container's view. It's already implemented in the material-top-tabs and drawer navigators, I've simply ported it into the bottom-tabs navigator.

It also fixes this issue:

https://github.com/react-navigation/react-navigation/issues/8076

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-10-23 02:16:09 +02:00
Satyajit Sahoo
261a33a0d0 fix: fix imports from query-string. closes #8971 (#8976) 2020-10-23 02:15:47 +02:00
Listi
d6cac6713a fix: fix header buttons not pressable when headerTransparent=true & headerMode=float (#8804)
Motivation
--
Previously when using `headerMode="float"` with headerTransparent set to true, we cant press header buttons in Android. This PR fixes this. (resolves #8731 )
Been doing some debugging and found out that this is caused by `HeaderContainer` being set as `absolute`. Initially it didn't have width & height in Android when it's set to default, that's why we can't access the children.
So, the solution in this PR is to define the height by using headerHeight. But, since we can't access headerHeight from header, Im using local state for keeping up with the headerHeight. Or should I move the HeaderHeight provider out of StackContainer? I'm not sure, since I think it was intended to be kept inside the StackContainer

Test Plan
--
With this config, now the header button can be clicked. Tested in both platform
```typescript
  <Stack.Navigator
    headerMode="float"
    screenOptions={{
      headerTransparent: true
    }}
  >
     <Stack.Screen  
      name="Home Screen"
      component={Home}
      />
      <Stack.Screen  
      name="Details Screen"
      component={Details}
      />
  </Stack.Navigator>
```

Android:
-
![Kapture 2020-09-30 at 19 01 21](https://user-images.githubusercontent.com/24470609/94682575-5b0fe480-034f-11eb-880a-318643d4eb00.gif)

iOS:
--
<img width="300" src="https://user-images.githubusercontent.com/24470609/94682743-9a3e3580-034f-11eb-8e90-2d31748bde5c.gif" />
2020-10-23 01:52:34 +02:00
Satyajit Sahoo
8ee0dda155 fix: set needsOffscreenAlphaCompositing and update default android animation
closes #8696
2020-10-23 01:38:14 +02:00
David Pett
8585f97226 docs: fix comments for gestureResponseDistance (#8954)
gestureResponseDistance vertical and horizontal documentations were swapped
2020-10-21 13:12:54 +02:00
Hossein Mohammadi
23ab350492 feat: support wildcard string prefixes (#8942)
Prefixes should be more flexible for situations like wild card subdomain. On android and IOS we can define wild cards by * but react-navigation does not work, In this PR I added support for RegExp Prefixes.

For Example
```js
{
  prefixes: [
    /^[^.s]+.example.com/g
 ],
}
```
I tested this work well.

Closes #8941 

Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2020-10-20 12:01:49 +02:00
ahmadj-levelbenefits
80ff5a9c54 feat: add an unhandled action listener (#8895)
Often developers miss these console messages: this allows missed routes to be emitted to whatever event logger users prefer.
2020-10-09 16:49:20 +02:00
Kaushil Ruparelia
90ebfc40b3 feat: make react-native-vector-icons optional (#8936)
Referenced from 4b26429c49/src/components/MaterialCommunityIcon.tsx (L14)

https://callstack.github.io/react-native-paper/getting-started.html
> To get smaller bundle size by excluding modules you don't use, you can use our optional babel plugin. The plugin automatically rewrites the import statements so that only the modules you use are imported instead of the whole library. Add react-native-paper/babel to the plugins section in your babel.config.js for production environment. It should look like this:
> ```
> module.exports = {
>   presets: ['module:metro-react-native-babel-preset'],
>   env: {
>     production: {
>       plugins: ['react-native-paper/babel'],
>     },
>   },
> };
> ```
> If you created your project using Expo, it'll look something like this:
> ```
> module.exports = function(api) {
>   api.cache(true);
>   return {
>     presets: ['babel-preset-expo'],
>     env: {
>       production: {
>         plugins: ['react-native-paper/babel'],
>       },
>     },
>   };
> };
> ```

Closes #8821
2020-10-09 13:41:37 +02:00
Satyajit Sahoo
091b2a2038 fix: handle pushing a route with duplicate key
Currently, stack router adds a duplicate route when pushing a new route with a key that already exists. This is a buggy behaviour since keys need to be unique in the stack.

This commit fixes the behaviour to bring the existing route with the same key to focus (and merge new params if any) instead of adding a duplicate route.
2020-10-09 00:28:45 +02:00
Satyajit Sahoo
01f86d2ac6 chore: publish
- @react-navigation/bottom-tabs@5.9.2
 - @react-navigation/compat@5.2.8
 - @react-navigation/core@5.12.5
 - @react-navigation/devtools@5.1.7
 - @react-navigation/drawer@5.9.3
 - @react-navigation/material-bottom-tabs@5.2.19
 - @react-navigation/material-top-tabs@5.2.19
 - @react-navigation/native@5.7.6
 - @react-navigation/stack@5.9.3
@react-navigation/bottom-tabs@5.9.2 @react-navigation/compat@5.2.8 @react-navigation/core@5.12.5 @react-navigation/devtools@5.1.7 @react-navigation/drawer@5.9.3 @react-navigation/material-bottom-tabs@5.2.19 @react-navigation/material-top-tabs@5.2.19 @react-navigation/native@5.7.6 @react-navigation/stack@5.9.3
2020-10-07 11:39:56 +02:00
Satyajit Sahoo
c49dab31b2 fix: use route keys instead of index for lazy load 2020-10-07 11:36:02 +02:00
Satyajit Sahoo
16e7ac131f chore: upgrade depenendecies 2020-10-07 11:18:38 +02:00
Satyajit Sahoo
9e3650831c fix: add missing check for initial state on web 2020-10-01 11:23:28 +02:00
Satyajit Sahoo
e523138321 chore: publish
- @react-navigation/bottom-tabs@5.9.1
 - @react-navigation/compat@5.2.7
 - @react-navigation/drawer@5.9.2
 - @react-navigation/material-bottom-tabs@5.2.18
 - @react-navigation/material-top-tabs@5.2.18
 - @react-navigation/native@5.7.5
 - @react-navigation/stack@5.9.2
@react-navigation/bottom-tabs@5.9.1 @react-navigation/compat@5.2.7 @react-navigation/drawer@5.9.2 @react-navigation/material-bottom-tabs@5.2.18 @react-navigation/material-top-tabs@5.2.18 @react-navigation/native@5.7.5 @react-navigation/stack@5.9.2
2020-09-28 16:58:23 +02:00
Satyajit Sahoo
cc8f1f4205 fix: check for correct resolved value in useThenable. fixes #8798 2020-09-28 16:56:26 +02:00
Satyajit Sahoo
e18578f83f chore: publish
- @react-navigation/bottom-tabs@5.9.0
 - @react-navigation/compat@5.2.6
 - @react-navigation/core@5.12.4
 - @react-navigation/devtools@5.1.6
 - @react-navigation/drawer@5.9.1
 - @react-navigation/material-bottom-tabs@5.2.17
 - @react-navigation/material-top-tabs@5.2.17
 - @react-navigation/native@5.7.4
 - @react-navigation/routers@5.4.12
 - @react-navigation/stack@5.9.1
@react-navigation/bottom-tabs@5.9.0 @react-navigation/compat@5.2.6 @react-navigation/core@5.12.4 @react-navigation/devtools@5.1.6 @react-navigation/drawer@5.9.1 @react-navigation/material-bottom-tabs@5.2.17 @react-navigation/material-top-tabs@5.2.17 @react-navigation/native@5.7.4 @react-navigation/routers@5.4.12 @react-navigation/stack@5.9.1
2020-09-23 01:44:39 +02:00
Bill Thornton
a6179b75ad feat: add compact size for bottom tabs (#8728)
This adds a compact height mode for iOS devices that are in a compact vertical class (phones in landscape). This is similar to the size change that happens to the header when in landscape mode. Finding a size reference was challenging since most apps lock phones to portrait, but [this answer](https://stackoverflow.com/a/25550871) on Stack Overflow states that it should be 32 pts.

I asked yesterday in the Discord chat if there would be interest in this and some other enhancements here, but no on replied, so I thought I would go ahead and open this to at least start a discussion.
2020-09-23 01:41:38 +02:00
Satyajit Sahoo
9b03c8e3a4 fix: fix border showing on hidden tab bar. closes #8869 2020-09-23 01:36:35 +02:00
Satyajit Sahoo
2bb6603aa3 chore: upgrade depenendecies 2020-09-23 01:34:55 +02:00
Martin Heidegger
dcbfe52667 fix: cleanly removing event listeners in useWindowDimensions (#8866)
This PR fixes the `useWindowDimensions` hook by making sure that the event listener is properly removed.
2020-09-21 13:01:22 +02:00
Thibault Malbranche
97c215d2f2 fix: typo in logic of getStateFromPath (#8868)
What just randomly reading, but I think there's a typo
```
['ab', 'aba'].sort((a, b) => {
      if (a.startsWith(b)) {
        return -1;
      }

      if (b.startsWith(a)) {
        return 1;
      }
});
(2) ["aba", "ab"]
['ab', 'a'].sort((a, b) => {
      if (a.startsWith(b)) {
        return -1;
      }

      if (b.startsWith(a)) {
        return 1;
      }
});
(2) ["ab", "a"]
```
2020-09-21 13:00:44 +02:00
Bartosz Kaszubowski
050447b9ac chore: update docs website URLs to avoid the redirect (#8819) 2020-09-10 13:34:16 +02:00
pedrobern
1c4bd6813b fix: add flex: 1 to DrawerItem style (#8701)
# Summary 

In the [DrawerItem](https://github.com/react-navigation/react-navigation/blob/main/packages/drawer/src/views/DrawerItem.tsx), It's not possible to provide style for the [label wrapper](https://github.com/react-navigation/react-navigation/blob/main/packages/drawer/src/views/DrawerItem.tsx#L167), only for the label, so the label wrapper must at least be `flex: 1` in order to be more flexible for custom components, like in the pictures below.

In the below examples, providing `flex: 1` inside the custom component view is not enough, because the wrapper does not grow. This PR will fix it.

An alternative would be creating a new prop `labelStyleWrapper`, but I don't see any motivation for doing so, as this PR would fix it.

## Before

![before](https://user-images.githubusercontent.com/39778068/89813734-81b45a80-db18-11ea-8d53-0ddcfdbb04c1.jpeg)

## After

![after](https://user-images.githubusercontent.com/39778068/89813748-8711a500-db18-11ea-92b4-3db982c1eba5.jpeg)
2020-09-02 16:22:31 +02:00
Louis-Alban KIM
2d1da7ef2f fix: add aria-level to HeaderTitle 2020-09-02 16:21:20 +02:00
Cedric van Putten
70691acdfc chore: enable faster bundling on preview builds
See https://twitter.com/expo/status/1293613036482121728
2020-09-02 16:01:08 +02:00
Brent Vatne
ee71a05570 chore: fix dependencies to be compatible with sdk-38 2020-08-24 11:12:06 +02:00
Satyajit Sahoo
b029e0f660 chore: publish
- @react-navigation/bottom-tabs@5.8.0
 - @react-navigation/compat@5.2.5
 - @react-navigation/core@5.12.3
 - @react-navigation/devtools@5.1.5
 - @react-navigation/drawer@5.9.0
 - @react-navigation/material-bottom-tabs@5.2.16
 - @react-navigation/material-top-tabs@5.2.16
 - @react-navigation/native@5.7.3
 - @react-navigation/routers@5.4.11
 - @react-navigation/stack@5.9.0
@react-navigation/bottom-tabs@5.8.0 @react-navigation/compat@5.2.5 @react-navigation/core@5.12.3 @react-navigation/devtools@5.1.5 @react-navigation/drawer@5.9.0 @react-navigation/material-bottom-tabs@5.2.16 @react-navigation/material-top-tabs@5.2.16 @react-navigation/native@5.7.3 @react-navigation/routers@5.4.11 @react-navigation/stack@5.9.0
2020-08-04 13:28:13 +02:00
Satyajit Sahoo
5625eec621 test: fix e2e tests 2020-08-04 13:14:25 +02:00