mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-14 17:42:29 +08:00
Compare commits
107 Commits
@react-nav
...
fix/flippe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78322fbfab | ||
|
|
51cb4ce73b | ||
|
|
6cba517b74 | ||
|
|
127e030e03 | ||
|
|
a802c9df95 | ||
|
|
5fb5f41eb6 | ||
|
|
acdde18d89 | ||
|
|
8b65aea2db | ||
|
|
07a3f702da | ||
|
|
fe692c2f56 | ||
|
|
ec0d113eb2 | ||
|
|
bc19ee7616 | ||
|
|
651d8e5726 | ||
|
|
ece03d7177 | ||
|
|
f54cafbb33 | ||
|
|
f73aa55fb2 | ||
|
|
5bcf79c722 | ||
|
|
80a8567618 | ||
|
|
56984a45a3 | ||
|
|
f8fddac79d | ||
|
|
89e8271927 | ||
|
|
42c43ff761 | ||
|
|
2e47c42e9f | ||
|
|
8c89c45be4 | ||
|
|
0cc96d5ff1 | ||
|
|
78560d858f | ||
|
|
bacdbbdd7c | ||
|
|
9613cbe680 | ||
|
|
a79ce57aa7 | ||
|
|
22799fc96e | ||
|
|
b0130570be | ||
|
|
4d8a7ee7e4 | ||
|
|
d17bf146ee | ||
|
|
ebb5f24664 | ||
|
|
40dcbcf2fa | ||
|
|
0f5868f64d | ||
|
|
99735e1b73 | ||
|
|
dfd0cc78fe | ||
|
|
3aab9fd05e | ||
|
|
d6a3ca5967 | ||
|
|
1da575e0e7 | ||
|
|
e299167e10 | ||
|
|
80867722c5 | ||
|
|
98fa233014 | ||
|
|
be8532c086 | ||
|
|
8f4daef5b3 | ||
|
|
2084fb859f | ||
|
|
3ce4276a39 | ||
|
|
1a39632656 | ||
|
|
20abccda0d | ||
|
|
de84458960 | ||
|
|
73277d533c | ||
|
|
8a95fb588b | ||
|
|
6d518a46b8 | ||
|
|
d2d7f8d95e | ||
|
|
51b636d726 | ||
|
|
9506ad1f00 | ||
|
|
5bfc39668b | ||
|
|
fdb3ede3e0 | ||
|
|
504b26f3ae | ||
|
|
5f4e124032 | ||
|
|
54b215b9d3 | ||
|
|
9b2105692d | ||
|
|
3e2155b929 | ||
|
|
c322b0501c | ||
|
|
e3c514d684 | ||
|
|
f666059d80 | ||
|
|
42a875212c | ||
|
|
577d79e98c | ||
|
|
858d256b0a | ||
|
|
c333f4086e | ||
|
|
16f0e11822 | ||
|
|
ee12690a82 | ||
|
|
4135d09c6f | ||
|
|
a70adfbca1 | ||
|
|
b1134c8a34 | ||
|
|
d2e1571b53 | ||
|
|
b1d935ca53 | ||
|
|
3a5d096547 | ||
|
|
20b8ebd405 | ||
|
|
4c16083d51 | ||
|
|
e7631ea239 | ||
|
|
2ee435be3a | ||
|
|
016e7920df | ||
|
|
26ba019155 | ||
|
|
97772affa3 | ||
|
|
67f6950c14 | ||
|
|
fe6d20c10e | ||
|
|
7d74bd73a7 | ||
|
|
b46c433f1e | ||
|
|
7e71ee6c47 | ||
|
|
1287a784e6 | ||
|
|
56f7df5384 | ||
|
|
5996bbbce2 | ||
|
|
c3ba72df65 | ||
|
|
be40244214 | ||
|
|
7388e6d9bc | ||
|
|
00e70da0d4 | ||
|
|
70f4fe2ffa | ||
|
|
e639748b23 | ||
|
|
324ea7181d | ||
|
|
9d3731c2df | ||
|
|
baf8ff77d5 | ||
|
|
b4d7b0ee86 | ||
|
|
a184ce24b3 | ||
|
|
80cdc88588 | ||
|
|
b91c9b05ff |
@@ -75,9 +75,13 @@ jobs:
|
||||
- run:
|
||||
name: Build example for web
|
||||
command: yarn example expo build:web --no-pwa
|
||||
# Yarn does not execute the postinstall scripts if the package is in the cache
|
||||
- run:
|
||||
name: Install browsers
|
||||
command: yarn playwright install
|
||||
- run:
|
||||
name: Run integration tests
|
||||
command: yarn example test --maxWorkers=2
|
||||
command: yarn example test:e2e
|
||||
|
||||
build-packages:
|
||||
executor: default
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"extends": "satya164",
|
||||
"plugins": ["simple-import-sort"],
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "16"
|
||||
@@ -23,6 +24,13 @@
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"react/no-unused-prop-types": "off"
|
||||
}
|
||||
"simple-import-sort/imports": "error",
|
||||
"simple-import-sort/exports": "error"
|
||||
},
|
||||
"overrides": [{
|
||||
"files":["example/e2e/tests/*.ts"],
|
||||
"rules": {
|
||||
"jest/*": 0
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
38
.github/ISSUE_TEMPLATE/bug-report-bottom-tabs.md
vendored
38
.github/ISSUE_TEMPLATE/bug-report-bottom-tabs.md
vendored
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: Bottom Tab Navigator
|
||||
about: Report an issue with Bottom Tab Navigator (@react-navigation/bottom-tabs)
|
||||
title: ''
|
||||
labels: bug, package:bottom-tabs
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ----------------------------- | ------- |
|
||||
| iOS or Android |
|
||||
| @react-navigation/native |
|
||||
| @react-navigation/bottom-tabs |
|
||||
| react-native-screens |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
41
.github/ISSUE_TEMPLATE/bug-report-drawer.md
vendored
41
.github/ISSUE_TEMPLATE/bug-report-drawer.md
vendored
@@ -1,41 +0,0 @@
|
||||
---
|
||||
name: Drawer Navigator
|
||||
about: Report an issue with Drawer Navigator (@react-navigation/drawer)
|
||||
title: ''
|
||||
labels: bug, package:drawer
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ------------------------------ | ------- |
|
||||
| iOS or Android |
|
||||
| @react-navigation/native |
|
||||
| @react-navigation/drawer |
|
||||
| react-native-reanimated |
|
||||
| react-native-gesture-handler |
|
||||
| react-native-safe-area-context |
|
||||
| react-native-screens |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: Material Bottom Tab Navigator
|
||||
about: Report an issue with Material Bottom Tab Navigator (@react-navigation/material-bottom-tabs)
|
||||
title: ''
|
||||
labels: bug, package:material-bottom-tabs
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| -------------------------------------- | ------- |
|
||||
| iOS or Android |
|
||||
| @react-navigation/native |
|
||||
| @react-navigation/material-bottom-tabs |
|
||||
| react-native-paper |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: Material Top Tab Navigator
|
||||
about: Report an issue with Material Top Tab Navigator (@react-navigation/material-top-tabs)
|
||||
title: ''
|
||||
labels: bug, package:material-top-tabs
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ----------------------------------- | ------- |
|
||||
| iOS or Android |
|
||||
| @react-navigation/native |
|
||||
| @react-navigation/material-top-tabs |
|
||||
| react-native-tab-view |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
40
.github/ISSUE_TEMPLATE/bug-report-stack.md
vendored
40
.github/ISSUE_TEMPLATE/bug-report-stack.md
vendored
@@ -1,40 +0,0 @@
|
||||
---
|
||||
name: Stack Navigator
|
||||
about: Report an issue with Stack Navigator (@react-navigation/stack)
|
||||
title: ''
|
||||
labels: bug, package:stack
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ------------------------------ | ------- |
|
||||
| iOS or Android |
|
||||
| @react-navigation/native |
|
||||
| @react-navigation/stack |
|
||||
| react-native-gesture-handler |
|
||||
| react-native-safe-area-context |
|
||||
| react-native-screens |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
43
.github/ISSUE_TEMPLATE/bug-report-version-4.md
vendored
43
.github/ISSUE_TEMPLATE/bug-report-version-4.md
vendored
@@ -1,43 +0,0 @@
|
||||
---
|
||||
name: React Navigation 4
|
||||
about: Report an issue with React Navigation 4
|
||||
title: ''
|
||||
labels: bug, version-4
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ------------------------------ | ------- |
|
||||
| iOS or Android |
|
||||
| react-navigation |
|
||||
| react-navigation-stack |
|
||||
| react-navigation-tabs |
|
||||
| react-navigation-drawer |
|
||||
| react-native-reanimated |
|
||||
| react-native-gesture-handler |
|
||||
| react-native-safe-area-context |
|
||||
| react-native-screens |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
92
.github/ISSUE_TEMPLATE/bug-report-version-4.yml
vendored
Normal file
92
.github/ISSUE_TEMPLATE/bug-report-version-4.yml
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
name: React Navigation 4
|
||||
description: Report an issue with React Navigation 4
|
||||
labels: [bug, version-4]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
|
||||
If this is not a bug report, please use other relevant channels:
|
||||
|
||||
- [Post a feature request on Canny](https://react-navigation.canny.io/feature-requests)
|
||||
- [Ask questions on StackOverflow using the react-navigation label](https://stackoverflow.com/questions/tagged/react-navigation)
|
||||
- [Chat with others in the #help-react-native channel on Discord](https://www.reactiflux.com/)
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Current behavior
|
||||
description: |
|
||||
What code are you running and what is happening? Include a screenshot or video if it's an UI related issue.
|
||||
placeholder: Current behavior
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: |
|
||||
What do you expect to happen instead?
|
||||
placeholder: Expected behavior
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Reproduction
|
||||
description: |
|
||||
You must provide a way to reproduce the problem. If you don't provide a repro, the issue will be closed automatically after a specific period.
|
||||
|
||||
- Either re-create the bug on [Snack](https://snack.expo.dev) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
- If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
placeholder: Link to repro
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Platform
|
||||
description: |
|
||||
What are the platforms where you see the issue?
|
||||
options:
|
||||
- label: Android
|
||||
- label: iOS
|
||||
- label: Web
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Packages
|
||||
description: |
|
||||
Which packages are affected by the issue?
|
||||
options:
|
||||
- label: 'react-navigation-drawer'
|
||||
- label: 'react-navigation-stack'
|
||||
- label: 'react-navigation-tabs'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Environment
|
||||
description: |
|
||||
What are the exact versions of packages that you are using?
|
||||
|
||||
When filling the table below, remove the packages that you're not using.
|
||||
value: |
|
||||
| package | version |
|
||||
| -------------------------------------- | ------- |
|
||||
| react-navigation |
|
||||
| react-navigation-tabs |
|
||||
| react-navigation-drawer |
|
||||
| react-navigation-stack |
|
||||
| react-native-safe-area-context |
|
||||
| react-native-screens |
|
||||
| react-native-gesture-handler |
|
||||
| react-native-reanimated |
|
||||
| react-native-tab-view |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
validations:
|
||||
required: true
|
||||
36
.github/ISSUE_TEMPLATE/bug-report.md
vendored
36
.github/ISSUE_TEMPLATE/bug-report.md
vendored
@@ -1,36 +0,0 @@
|
||||
---
|
||||
name: Other bugs
|
||||
about: Report an issue which is not about a specific navigator.
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
- What code are you running and what is happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
- What do you expect should be happening?
|
||||
- Include a screenshot or video if it makes sense.
|
||||
|
||||
**How to reproduce**
|
||||
|
||||
- You must provide a way to reproduce the problem. If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
- Either re-create the bug on [Snack](https://snack.expo.io) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
|
||||
**Your Environment**
|
||||
|
||||
| software | version |
|
||||
| ------------------------------ | ------- |
|
||||
| iOS or Android |
|
||||
| @react-navigation/native |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
101
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
101
.github/ISSUE_TEMPLATE/bug-report.yml
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
name: React Navigation 6
|
||||
description: Report an issue with React Navigation 6
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
|
||||
If this is not a bug report, please use other relevant channels:
|
||||
|
||||
- [Post a feature request on Canny](https://react-navigation.canny.io/feature-requests)
|
||||
- [Ask questions on StackOverflow using the react-navigation label](https://stackoverflow.com/questions/tagged/react-navigation)
|
||||
- [Chat with others in the #help-react-native channel on Discord](https://www.reactiflux.com/)
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Current behavior
|
||||
description: |
|
||||
What code are you running and what is happening? Include a screenshot or video if it's an UI related issue.
|
||||
placeholder: Current behavior
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: |
|
||||
What do you expect to happen instead?
|
||||
placeholder: Expected behavior
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
attributes:
|
||||
label: Reproduction
|
||||
description: |
|
||||
You must provide a way to reproduce the problem. If you don't provide a repro, the issue will be closed automatically after a specific period.
|
||||
|
||||
- Either re-create the bug on [Snack](https://snack.expo.dev) or link to a GitHub repository with code that reproduces the bug.
|
||||
- Explain how to run the example app and any steps that we need to take to reproduce the issue from the example app.
|
||||
- Keep the repro code as simple as possible, with the minimum amount of code required to repro the issue.
|
||||
- Before reporting an issue, make sure you are on latest version of the package.
|
||||
- If you are having an issue with your machine or build tools, the issue belongs on another repository as that is outside of the scope of React Navigation.
|
||||
placeholder: Link to repro
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Platform
|
||||
description: |
|
||||
What are the platforms where you see the issue?
|
||||
options:
|
||||
- label: Android
|
||||
- label: iOS
|
||||
- label: Web
|
||||
- label: Windows
|
||||
- label: MacOS
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Packages
|
||||
description: |
|
||||
Which packages are affected by the issue?
|
||||
options:
|
||||
- label: '@react-navigation/bottom-tabs'
|
||||
- label: '@react-navigation/drawer'
|
||||
- label: '@react-navigation/material-bottom-tabs'
|
||||
- label: '@react-navigation/material-top-tabs'
|
||||
- label: '@react-navigation/stack'
|
||||
- label: '@react-navigation/native-stack'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Environment
|
||||
description: |
|
||||
What are the exact versions of packages that you are using?
|
||||
|
||||
When filling the table below, **please remove the packages** that you're not using.
|
||||
value: |
|
||||
| package | version |
|
||||
| -------------------------------------- | ------- |
|
||||
| @react-navigation/native |
|
||||
| @react-navigation/bottom-tabs |
|
||||
| @react-navigation/drawer |
|
||||
| @react-navigation/material-bottom-tabs |
|
||||
| @react-navigation/material-top-tabs |
|
||||
| @react-navigation/stack |
|
||||
| @react-navigation/native-stack |
|
||||
| react-native-safe-area-context |
|
||||
| react-native-screens |
|
||||
| react-native-gesture-handler |
|
||||
| react-native-reanimated |
|
||||
| react-native-tab-view |
|
||||
| react-native-pager-view |
|
||||
| react-native |
|
||||
| expo |
|
||||
| node |
|
||||
| npm or yarn |
|
||||
validations:
|
||||
required: true
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,7 +1,7 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Troubleshooting
|
||||
url: https://reactnavigation.org/docs/troubleshooting.html
|
||||
url: https://reactnavigation.org/docs/troubleshooting
|
||||
about: Read how to troubleshoot and fix common issues and mistakes.
|
||||
- name: Documentation
|
||||
url: https://reactnavigation.org
|
||||
@@ -9,12 +9,12 @@ contact_links:
|
||||
- name: Feature requests
|
||||
url: https://react-navigation.canny.io/feature-requests
|
||||
about: Post a feature request on Canny.
|
||||
- name: Discussions
|
||||
url: https://github.com/react-navigation/react-navigation/discussions
|
||||
about: Discuss questions, ideas etc. and share resources related to the library.
|
||||
- name: StackOverflow
|
||||
url: https://stackoverflow.com/questions/tagged/react-navigation
|
||||
about: Ask and answer questions using the react-navigation label.
|
||||
- name: Reactiflux
|
||||
url: https://www.reactiflux.com/
|
||||
about: Chat with other community members in the help-react-native channel.
|
||||
- name: Write an RFC
|
||||
url: https://github.com/react-navigation/rfcs
|
||||
about: Write a RFC if you have ideas for how to implement a feature request.
|
||||
|
||||
45
.github/workflows/check-labels.yml
vendored
Normal file
45
.github/workflows/check-labels.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Check for labels
|
||||
on:
|
||||
issues:
|
||||
types: [opened, edited]
|
||||
|
||||
jobs:
|
||||
check-labels:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const body = context.payload.issue.body;
|
||||
|
||||
const packages = Array.from(
|
||||
body.matchAll(/- \[x\] @react-navigation\/([\S]+)/gim)
|
||||
)
|
||||
.map((match) => match[1])
|
||||
.filter((name) =>
|
||||
[
|
||||
'bottom-tabs',
|
||||
'drawer',
|
||||
'material-bottom-tabs',
|
||||
'material-top-tabs',
|
||||
'stack',
|
||||
'native-stack',
|
||||
].includes(name)
|
||||
)
|
||||
.map((name) => `package:${name}`);
|
||||
|
||||
const platforms = Array.from(
|
||||
body.matchAll(/- \[x\] (Android|iOS|Web|Windows|MacOS)/gim)
|
||||
).map((matches) => `platform:${matches[1].toLowerCase()}`);
|
||||
|
||||
const labels = [...packages, ...platforms];
|
||||
|
||||
if (labels.length) {
|
||||
await github.issues.addLabels({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
labels,
|
||||
});
|
||||
}
|
||||
4
.github/workflows/check-repro.yml
vendored
4
.github/workflows/check-repro.yml
vendored
@@ -19,7 +19,7 @@ jobs:
|
||||
: context.payload.issue.body;
|
||||
|
||||
const regex = new RegExp(
|
||||
`https?:\\/\\/((github\\.com\\/${user}\\/[^/]+\\/?[\\s\\n]+)|(snack\\.expo\\.io\\/.+))`,
|
||||
`https?:\\/\\/((github\\.com\\/${user}\\/[^/]+\\/?[\\s\\n]+)|(snack\\.expo\\.dev\\/.+))`,
|
||||
'gm'
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
return;
|
||||
}
|
||||
|
||||
const body = "Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a [snack.expo.io](https://snack.expo.io) link or link to a GitHub repo under your username).\n\nCan you provide a [minimal repro](https://stackoverflow.com/help/minimal-reproducible-example) which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.";
|
||||
const body = "Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a [snack.expo.dev](https://snack.expo.dev) link or link to a GitHub repo under your username).\n\nCan you provide a [minimal repro](https://stackoverflow.com/help/minimal-reproducible-example) which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.";
|
||||
|
||||
const comments = await github.issues.listComments({
|
||||
issue_number: context.issue.number,
|
||||
|
||||
31
.github/workflows/closed-issue.yml
vendored
Normal file
31
.github/workflows/closed-issue.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Comment on closed issue
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
closed-issue:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.issue.state == 'closed' }}
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
script: |
|
||||
const body = "Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro.";
|
||||
const comments = await github.issues.listComments({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
});
|
||||
|
||||
if (comments.data.some(comment => comment.body === body)) {
|
||||
return;
|
||||
}
|
||||
|
||||
await github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body,
|
||||
});
|
||||
7
.github/workflows/expo-preview.yml
vendored
7
.github/workflows/expo-preview.yml
vendored
@@ -16,10 +16,9 @@ jobs:
|
||||
node-version: 14.x
|
||||
|
||||
- name: Setup Expo
|
||||
uses: expo/expo-github-action@v5
|
||||
uses: expo/expo-github-action@v6
|
||||
with:
|
||||
expo-token: ${{ secrets.EXPO_TOKEN }}
|
||||
expo-cache: true
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: Restore yarn cache
|
||||
id: yarn-cache
|
||||
@@ -47,7 +46,7 @@ jobs:
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const body = 'The Expo app for the example from this branch is ready!\n\n[expo.io/${{ steps.expo.outputs.path }}](https://expo.io/${{ steps.expo.outputs.path }})\n\n<a href="https://exp.host/${{ steps.expo.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo.outputs.path }}" height="200px" width="200px"></a>';
|
||||
const body = 'The Expo app for the example from this branch is ready!\n\n[expo.dev/${{ steps.expo.outputs.path }}](https://expo.dev/${{ steps.expo.outputs.path }})\n\n<a href="https://exp.host/${{ steps.expo.outputs.path }}"><img src="https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=exp://exp.host/${{ steps.expo.outputs.path }}" height="200px" width="200px"></a>';
|
||||
|
||||
const comments = await github.issues.listComments({
|
||||
issue_number: context.issue.number,
|
||||
|
||||
5
.github/workflows/expo.yml
vendored
5
.github/workflows/expo.yml
vendored
@@ -19,10 +19,9 @@ jobs:
|
||||
node-version: 14.x
|
||||
|
||||
- name: Setup Expo
|
||||
uses: expo/expo-github-action@v5
|
||||
uses: expo/expo-github-action@v6
|
||||
with:
|
||||
expo-token: ${{ secrets.EXPO_TOKEN }}
|
||||
expo-cache: true
|
||||
token: ${{ secrets.EXPO_TOKEN }}
|
||||
|
||||
- name: Restore yarn cache
|
||||
id: yarn-cache
|
||||
|
||||
21
.github/workflows/triage.yml
vendored
21
.github/workflows/triage.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Hey! Thanks for opening the issue. Can you provide more information about the issue? Please fill the issue template when opening the issue without deleting any section. We need all the information we can to be able to help.\n\nMake sure to at least provide - Current behaviour, Expected behaviour, A way to [reproduce the issue with minimal code](https://stackoverflow.com/help/minimal-reproducible-example) (link to [snack.expo.io](https://snack.expo.io)) or a repo on GitHub, and the information about your environment (such as the platform of the device, exact versions of all the packages mentioned in the template etc.). In addition, if you can provide a video or GIF demonstrating the issue, it will also be very helpful."
|
||||
body: "Hey! Thanks for opening the issue. Can you provide more information about the issue? Please fill the issue template when opening the issue without deleting any section. We need all the information we can to be able to help.\n\nMake sure to at least provide - Current behaviour, Expected behaviour, A way to [reproduce the issue with minimal code](https://stackoverflow.com/help/minimal-reproducible-example) (link to [snack.expo.dev](https://snack.expo.dev)) or a repo on GitHub, and the information about your environment (such as the platform of the device, exact versions of all the packages mentioned in the template etc.). In addition, if you can provide a video or GIF demonstrating the issue, it will also be very helpful."
|
||||
})
|
||||
|
||||
needs-repro:
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Hey! Thanks for opening the issue. Can you provide a [minimal repro](https://stackoverflow.com/help/minimal-reproducible-example) which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.\n\nThe easiest way to provide a repro is on [snack.expo.io](https://snack.expo.io). If it's not possible to repro it on [snack.expo.io](https://snack.expo.io), then please provide the repro in a GitHub repository."
|
||||
body: "Hey! Thanks for opening the issue. Can you provide a [minimal repro](https://stackoverflow.com/help/minimal-reproducible-example) which demonstrates the issue? Posting a snippet of your code in the issue is useful, but it's not usually straightforward to run. A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.\n\nThe easiest way to provide a repro is on [snack.expo.dev](https://snack.expo.dev). If it's not possible to repro it on [snack.expo.dev](https://snack.expo.dev), then please provide the repro in a GitHub repository."
|
||||
})
|
||||
|
||||
question:
|
||||
@@ -124,6 +124,21 @@ jobs:
|
||||
body: "Hey! Thanks for opening the issue. Seems that this issue is related to `react-native-safe-area-context` library which is a dependency of React Navigation. Can you also post your issue in [this repo](https://github.com/th3rdwave/react-native-safe-area-context) so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it."
|
||||
})
|
||||
|
||||
react-native-pager-view:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.label.name == 'library:react-native-pager-view'
|
||||
steps:
|
||||
- uses: actions/github-script@v3
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
github.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Hey! Thanks for opening the issue. Seems that this issue is related to `react-native-pager-view` library which is a dependency of Material Top Tabs. Can you also post your issue in [this repo](https://github.com/callstack/react-native-pager-view) so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it."
|
||||
})
|
||||
|
||||
react-native-paper:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.label.name == 'library:react-native-paper'
|
||||
@@ -136,5 +151,5 @@ jobs:
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: "Hey! Thanks for opening the issue. Seems that this issue is in `react-native-paper` library which is a dependency of Material Bottom Navigation. Can you also post your issue in [this repo](https://github.com/callstack/react-native-paper) so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it."
|
||||
body: "Hey! Thanks for opening the issue. Seems that this issue is in `react-native-paper` library which is a dependency of Material Bottom Tabs. Can you also post your issue in [this repo](https://github.com/callstack/react-native-paper) so that it's notified to the maintainers of that library? This will help us fix the issue faster since it's upto the maintainers of that library to investigate it."
|
||||
})
|
||||
|
||||
File diff suppressed because one or more lines are too long
2
.yarnrc
2
.yarnrc
@@ -2,4 +2,4 @@
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
yarn-path ".yarn/releases/yarn-1.18.0.js"
|
||||
yarn-path ".yarn/releases/yarn-1.22.10.cjs"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
This library is a community effort: it can only be great if we all help out in one way or another! If you feel like you aren't experienced enough using React Navigation to contribute, you can still make an impact by:
|
||||
|
||||
- Responding to one of the open [issues](https://github.com/react-navigation/react-navigation/issues). Even if you can't resolve or fully answer a question, asking for more information or clarity on an issue is extremely beneficial for someone to come after you to resolve the issue.
|
||||
- Creating public example repositories or [Snacks](https://snack.expo.io/) of navigation problems you have solved and sharing the links.
|
||||
- Creating public example repositories or [Snacks](https://snack.expo.dev/) of navigation problems you have solved and sharing the links.
|
||||
- Answering questions on [Stack Overflow](https://stackoverflow.com/search?q=react-navigation).
|
||||
- Answering questions in our [Reactiflux](https://www.reactiflux.com/) channel.
|
||||
- Providing feedback on the open [PRs](https://github.com/react-navigation/react-navigation/pulls).
|
||||
@@ -20,7 +20,7 @@ The project uses a monorepo structure for the packages managed by [yarn workspac
|
||||
yarn
|
||||
```
|
||||
|
||||
While developing, you can run the [example app](/example/) with [Expo](https://expo.io/) to test your changes:
|
||||
While developing, you can run the [example app](/example/) with [Expo](https://expo.dev/) to test your changes:
|
||||
|
||||
```sh
|
||||
yarn example start
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# React Navigation 5
|
||||
# React Navigation 6
|
||||
|
||||
[![Build Status][build-badge]][build]
|
||||
[![Code Coverage][coverage-badge]][coverage]
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import 'react-native-gesture-handler';
|
||||
|
||||
import { Assets } from '@react-navigation/elements';
|
||||
import { registerRootComponent } from 'expo';
|
||||
import { Asset } from 'expo-asset';
|
||||
import { Assets } from '@react-navigation/elements';
|
||||
|
||||
import App from './src/index';
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@ If you want to run the example from the repo,
|
||||
|
||||
- Clone the repository and run `yarn` in the project root
|
||||
- Run `yarn example start` to start the packager
|
||||
- Follow the instructions to open it with the [Expo app](https://expo.io/)
|
||||
- Follow the instructions to open it with the [Expo app](https://expo.dev/)
|
||||
|
||||
You can also run the currently published [app on Expo](https://expo.io/@react-navigation/react-navigation-example) on your Android device or iOS simulator or the [web app](https://react-navigation-example.netlify.com/) in your browser.
|
||||
You can also run the currently published [app on Expo](https://expo.dev/@react-navigation/react-navigation-example) on your Android device or iOS simulator or the [web app](https://react-navigation-example.netlify.com/) in your browser.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
package com.reactnavigation;
|
||||
package org.reactnavigation.example;
|
||||
|
||||
import android.content.Context;
|
||||
import com.facebook.flipper.android.AndroidFlipperClient;
|
||||
@@ -66,4 +66,4 @@ public class ReactNativeFlipper {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
import { page } from '../config/setup-playwright';
|
||||
|
||||
beforeEach(async () => {
|
||||
await page.click('[data-testid=LinkComponent]');
|
||||
});
|
||||
|
||||
const getPageInfo = async () => ({
|
||||
url: await page.evaluate(() => location.pathname + location.search),
|
||||
title: await page.evaluate(() => document.title),
|
||||
heading: (await page.accessibility.snapshot())?.children?.find(
|
||||
(it) => it.role === 'heading'
|
||||
)?.name,
|
||||
});
|
||||
|
||||
it('loads the article page', async () => {
|
||||
const { url, title, heading } = await getPageInfo();
|
||||
|
||||
expect(url).toBe('/link-component/article/gandalf');
|
||||
expect(title).toBe('Article by Gandalf - React Navigation Example');
|
||||
expect(heading).toBe('Article by Gandalf');
|
||||
});
|
||||
|
||||
it('goes to the album page and goes back', async () => {
|
||||
await page.click('[href="/link-component/music"]');
|
||||
|
||||
{
|
||||
const { url, title, heading } = await getPageInfo();
|
||||
|
||||
expect(url).toBe('/link-component/music');
|
||||
expect(title).toBe('Albums - React Navigation Example');
|
||||
expect(heading).toBe('Albums');
|
||||
}
|
||||
|
||||
await page.click('[aria-label="Article by Gandalf, back"]');
|
||||
await page.waitForNavigation();
|
||||
|
||||
{
|
||||
const { url, title, heading } = await getPageInfo();
|
||||
|
||||
expect(url).toBe('/link-component/article/gandalf');
|
||||
expect(title).toBe('Article by Gandalf - React Navigation Example');
|
||||
expect(heading).toBe('Article by Gandalf');
|
||||
}
|
||||
});
|
||||
@@ -1,28 +0,0 @@
|
||||
/* eslint-env jest */
|
||||
|
||||
import { chromium, Browser, BrowserContext, Page } from 'playwright';
|
||||
|
||||
let browser: Browser;
|
||||
let context: BrowserContext;
|
||||
let page: Page;
|
||||
|
||||
beforeAll(async () => {
|
||||
browser = await chromium.launch();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
context = await browser.newContext();
|
||||
page = await context.newPage();
|
||||
|
||||
await page.goto('http://localhost:3579');
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await context.close();
|
||||
});
|
||||
|
||||
export { browser, context, page };
|
||||
28
example/e2e/playwright.config.ts
Normal file
28
example/e2e/playwright.config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||
import path from 'path';
|
||||
|
||||
const config: PlaywrightTestConfig = {
|
||||
testDir: path.join(__dirname, 'tests'),
|
||||
globalSetup: require.resolve('./config/setup-server.ts'),
|
||||
globalTeardown: require.resolve('./config/teardown-server.ts'),
|
||||
workers: 1,
|
||||
reporter: 'list',
|
||||
projects: [
|
||||
{
|
||||
name: 'Chromium',
|
||||
use: { browserName: 'chromium' },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Firefox',
|
||||
use: { browserName: 'firefox' },
|
||||
},
|
||||
|
||||
{
|
||||
name: 'WebKit',
|
||||
use: { browserName: 'webkit' },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default config;
|
||||
43
example/e2e/tests/Link.test.ts
Normal file
43
example/e2e/tests/Link.test.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { Page } from '@playwright/test';
|
||||
|
||||
import { expect, it } from './baseFixture';
|
||||
|
||||
it.beforeEach(async ({ page }) => {
|
||||
await page.click('[data-testid=LinkComponent]');
|
||||
});
|
||||
|
||||
const waitAndAssertPageHeading = async (
|
||||
page: Page,
|
||||
expectedHeading: string
|
||||
) => {
|
||||
await page.waitForSelector(`text=${expectedHeading}`);
|
||||
const heading = (await page.accessibility.snapshot())?.children?.find(
|
||||
(it) => it.role === 'heading'
|
||||
)?.name;
|
||||
expect(heading).toBe(expectedHeading);
|
||||
};
|
||||
|
||||
it('loads the article page', async ({ page }) => {
|
||||
await page.waitForURL('**/link-component/article/gandalf');
|
||||
expect(await page.title()).toBe(
|
||||
'Article by Gandalf - React Navigation Example'
|
||||
);
|
||||
await waitAndAssertPageHeading(page, 'Article by Gandalf');
|
||||
});
|
||||
|
||||
it('goes to the album page and goes back', async ({ page }) => {
|
||||
await page.click('[href="/link-component/music"]');
|
||||
|
||||
await page.waitForURL('**/link-component/music');
|
||||
expect(await page.title()).toBe('Albums - React Navigation Example');
|
||||
await waitAndAssertPageHeading(page, 'Albums');
|
||||
|
||||
await page.click('[aria-label="Article by Gandalf, back"]');
|
||||
await page.waitForNavigation();
|
||||
|
||||
await page.waitForURL('**/link-component/article/gandalf');
|
||||
expect(await page.title()).toBe(
|
||||
'Article by Gandalf - React Navigation Example'
|
||||
);
|
||||
await waitAndAssertPageHeading(page, 'Article by Gandalf');
|
||||
});
|
||||
11
example/e2e/tests/baseFixture.ts
Normal file
11
example/e2e/tests/baseFixture.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { test as baseTest } from '@playwright/test';
|
||||
|
||||
const test = baseTest.extend({
|
||||
page: async ({ page }, use) => {
|
||||
await page.goto('http://localhost:3579');
|
||||
await use(page);
|
||||
},
|
||||
});
|
||||
|
||||
export const it = test;
|
||||
export const expect = test.expect;
|
||||
@@ -1,6 +1,6 @@
|
||||
import { page } from '../config/setup-playwright';
|
||||
import { expect, it } from './baseFixture';
|
||||
|
||||
it('loads the example app', async () => {
|
||||
it('loads the example app', async ({ page }) => {
|
||||
const snapshot = await page.accessibility.snapshot();
|
||||
|
||||
expect(
|
||||
@@ -1,5 +1,6 @@
|
||||
import fetch from 'node-fetch';
|
||||
import { expect, test as it } from '@playwright/test';
|
||||
import cheerio from 'cheerio';
|
||||
import fetch from 'node-fetch';
|
||||
|
||||
const server = 'http://localhost:3275';
|
||||
|
||||
@@ -23,15 +23,15 @@ PODS:
|
||||
- UMImageLoaderInterface
|
||||
- EXKeepAwake (9.1.2):
|
||||
- UMCore
|
||||
- EXPermissions (12.0.0):
|
||||
- EXPermissions (12.0.1):
|
||||
- UMCore
|
||||
- UMPermissionsInterface
|
||||
- EXSplashScreen (0.10.0):
|
||||
- EXSplashScreen (0.10.2):
|
||||
- React-Core
|
||||
- UMCore
|
||||
- EXStructuredHeaders (1.0.1):
|
||||
- UMCore
|
||||
- EXUpdates (0.5.4):
|
||||
- EXUpdates (0.5.5):
|
||||
- EXStructuredHeaders
|
||||
- React-Core
|
||||
- UMCore
|
||||
@@ -271,9 +271,9 @@ PODS:
|
||||
- React
|
||||
- react-native-flipper (0.80.0):
|
||||
- React-Core
|
||||
- react-native-safe-area-context (3.2.0):
|
||||
- react-native-pager-view (5.1.10):
|
||||
- React-Core
|
||||
- react-native-viewpager (5.0.12):
|
||||
- react-native-safe-area-context (3.2.0):
|
||||
- React-Core
|
||||
- React-RCTActionSheet (0.63.4):
|
||||
- React-Core/RCTActionSheetHeaders (= 0.63.4)
|
||||
@@ -335,13 +335,13 @@ PODS:
|
||||
- React-Core (= 0.63.4)
|
||||
- React-cxxreact (= 0.63.4)
|
||||
- React-jsi (= 0.63.4)
|
||||
- RNCAsyncStorage (1.15.1):
|
||||
- RNCAsyncStorage (1.15.5):
|
||||
- React-Core
|
||||
- RNCMaskedView (0.2.4):
|
||||
- React-Core
|
||||
- RNGestureHandler (1.10.3):
|
||||
- React-Core
|
||||
- RNReanimated (2.1.0):
|
||||
- RNReanimated (2.2.0):
|
||||
- DoubleConversion
|
||||
- FBLazyVector
|
||||
- FBReactNativeSpec
|
||||
@@ -370,8 +370,9 @@ PODS:
|
||||
- React-RCTVibration
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- RNScreens (3.0.0):
|
||||
- RNScreens (3.3.0):
|
||||
- React-Core
|
||||
- React-RCTImage
|
||||
- RNVectorIcons (8.1.0):
|
||||
- React-Core
|
||||
- UMAppLoader (2.1.0)
|
||||
@@ -451,8 +452,8 @@ DEPENDENCIES:
|
||||
- React-jsinspector (from `../../node_modules/react-native/ReactCommon/jsinspector`)
|
||||
- react-native-appearance (from `../../node_modules/react-native-appearance`)
|
||||
- react-native-flipper (from `../../node_modules/react-native-flipper`)
|
||||
- react-native-pager-view (from `../../node_modules/react-native-pager-view`)
|
||||
- react-native-safe-area-context (from `../../node_modules/react-native-safe-area-context`)
|
||||
- react-native-viewpager (from `../node_modules/react-native-pager-view`)
|
||||
- React-RCTActionSheet (from `../../node_modules/react-native/Libraries/ActionSheetIOS`)
|
||||
- React-RCTAnimation (from `../../node_modules/react-native/Libraries/NativeAnimation`)
|
||||
- React-RCTBlob (from `../../node_modules/react-native/Libraries/Blob`)
|
||||
@@ -464,7 +465,7 @@ DEPENDENCIES:
|
||||
- React-RCTVibration (from `../../node_modules/react-native/Libraries/Vibration`)
|
||||
- ReactCommon/turbomodule/core (from `../../node_modules/react-native/ReactCommon`)
|
||||
- "RNCAsyncStorage (from `../../node_modules/@react-native-async-storage/async-storage`)"
|
||||
- "RNCMaskedView (from `../node_modules/@react-native-masked-view/masked-view`)"
|
||||
- "RNCMaskedView (from `../../node_modules/@react-native-masked-view/masked-view`)"
|
||||
- RNGestureHandler (from `../../node_modules/react-native-gesture-handler`)
|
||||
- RNReanimated (from `../../node_modules/react-native-reanimated`)
|
||||
- RNScreens (from `../../node_modules/react-native-screens`)
|
||||
@@ -558,10 +559,10 @@ EXTERNAL SOURCES:
|
||||
:path: "../../node_modules/react-native-appearance"
|
||||
react-native-flipper:
|
||||
:path: "../../node_modules/react-native-flipper"
|
||||
react-native-pager-view:
|
||||
:path: "../../node_modules/react-native-pager-view"
|
||||
react-native-safe-area-context:
|
||||
:path: "../../node_modules/react-native-safe-area-context"
|
||||
react-native-viewpager:
|
||||
:path: "../node_modules/react-native-pager-view"
|
||||
React-RCTActionSheet:
|
||||
:path: "../../node_modules/react-native/Libraries/ActionSheetIOS"
|
||||
React-RCTAnimation:
|
||||
@@ -585,7 +586,7 @@ EXTERNAL SOURCES:
|
||||
RNCAsyncStorage:
|
||||
:path: "../../node_modules/@react-native-async-storage/async-storage"
|
||||
RNCMaskedView:
|
||||
:path: "../node_modules/@react-native-masked-view/masked-view"
|
||||
:path: "../../node_modules/@react-native-masked-view/masked-view"
|
||||
RNGestureHandler:
|
||||
:path: "../../node_modules/react-native-gesture-handler"
|
||||
RNReanimated:
|
||||
@@ -635,10 +636,10 @@ SPEC CHECKSUMS:
|
||||
EXFont: d6fb79f9863120f0d0b26b0c2d1453bc9511e9df
|
||||
EXImageLoader: da941c9399e01ec28f2d5b270bdd21f2c8ca596c
|
||||
EXKeepAwake: d4e4a3ed8c1c4fd940dd62fc5a8be2a190371fd4
|
||||
EXPermissions: 67ff17d3c12ea06066492dde4242f8047658fd62
|
||||
EXSplashScreen: 9d79ea338b7bb2ee94df51723870bac70b408d44
|
||||
EXPermissions: 8f8c1c05580c4e02d4ee2c8dd74bfe173ff6a723
|
||||
EXSplashScreen: a9baaf4fa866003884c90ba049f18760d6a8ce39
|
||||
EXStructuredHeaders: be834496a4d9fd0069cd12ec1cc57b31c6d3b256
|
||||
EXUpdates: e191b83e00d3e7ebfd7db3986806ceca09b7b322
|
||||
EXUpdates: efe0e8c514dcff06a8fd0b63be6019a6365fb9c7
|
||||
FBLazyVector: 3bb422f41b18121b71783a905c10e58606f7dc3e
|
||||
FBReactNativeSpec: f2c97f2529dd79c083355182cc158c9f98f4bd6e
|
||||
Flipper: d3da1aa199aad94455ae725e9f3aa43f3ec17021
|
||||
@@ -664,8 +665,8 @@ SPEC CHECKSUMS:
|
||||
React-jsinspector: 58aef7155bc9a9683f5b60b35eccea8722a4f53a
|
||||
react-native-appearance: 0f0e5fc2fcef70e03d48c8fe6b00b9158c2ba8aa
|
||||
react-native-flipper: 5a9d5959364fca6a8a9658d941343774cb197857
|
||||
react-native-pager-view: 967d50ce0f1b72e434a2d9f3b739ddbf7d5bbf83
|
||||
react-native-safe-area-context: f0906bf8bc9835ac9a9d3f97e8bde2a997d8da79
|
||||
react-native-viewpager: 98a850d1c7ac6263122d82618a77062a5f427073
|
||||
React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336
|
||||
React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b
|
||||
React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0
|
||||
@@ -676,11 +677,11 @@ SPEC CHECKSUMS:
|
||||
React-RCTText: 5c51df3f08cb9dedc6e790161195d12bac06101c
|
||||
React-RCTVibration: ae4f914cfe8de7d4de95ae1ea6cc8f6315d73d9d
|
||||
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
|
||||
RNCAsyncStorage: 08719e311ab90492c2dafd6d6fb7ffb396493638
|
||||
RNCAsyncStorage: 56a3355a10b5d660c48c6e37325ac85ebfd09885
|
||||
RNCMaskedView: fc29d354a40316a990e8fb46391f08aea829c3aa
|
||||
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
|
||||
RNReanimated: 70f662b5232dd5d19ccff581e919a54ea73df51c
|
||||
RNScreens: e8e8dd0588b5da0ab57dcca76ab9b2d8987757e0
|
||||
RNReanimated: d9da990fc90123f4ffbfdda93d00fc15174863a8
|
||||
RNScreens: bf59f17fbf001f1025243eeed5f19419d3c11ef2
|
||||
RNVectorIcons: 31cebfcf94e8cf8686eb5303ae0357da64d7a5a4
|
||||
UMAppLoader: fe2708bb0ac5cd70052bc207d06aa3b7e72b9e97
|
||||
UMBarCodeScannerInterface: 79f92bea5f7af39b381a4c82298105ceb537408a
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
module.exports = {
|
||||
testRegex: '/__integration_tests__/.*\\.(test|spec)\\.(js|tsx?)$',
|
||||
globalSetup: './e2e/config/setup-server.tsx',
|
||||
globalTeardown: './e2e/config/teardown-server.tsx',
|
||||
setupFilesAfterEnv: ['./e2e/config/setup-playwright.tsx'],
|
||||
};
|
||||
@@ -11,65 +11,63 @@
|
||||
"ios": "react-native run-ios",
|
||||
"preios": "pod-install",
|
||||
"server": "nodemon -e '.js,.ts,.tsx' --exec \"babel-node -i '/node_modules[/\\](?react-native)/' -x '.web.tsx,.web.ts,.web.js,.tsx,.ts,.js' --config-file ./server/babel.config.js server\"",
|
||||
"test": "jest"
|
||||
"test:e2e": "playwright test --config=e2e/playwright.config.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/vector-icons": "^12.0.0",
|
||||
"@react-native-async-storage/async-storage": "^1.13.0",
|
||||
"@expo/vector-icons": "^12.0.5",
|
||||
"@react-native-async-storage/async-storage": "^1.15.5",
|
||||
"@react-native-masked-view/masked-view": "~0.2.4",
|
||||
"color": "^3.1.3",
|
||||
"expo": "^41.0.1",
|
||||
"expo-asset": "~8.3.1",
|
||||
"expo-asset": "~8.3.2",
|
||||
"expo-blur": "~9.0.3",
|
||||
"expo-linking": "~2.2.3",
|
||||
"expo-splash-screen": "~0.10.0",
|
||||
"expo-splash-screen": "~0.10.2",
|
||||
"expo-status-bar": "~1.0.4",
|
||||
"expo-updates": "~0.5.4",
|
||||
"expo-updates": "~0.5.5",
|
||||
"koa": "^2.13.0",
|
||||
"react": "16.13.1",
|
||||
"react-dom": "16.13.1",
|
||||
"react-native": "~0.63.4",
|
||||
"react-native-appearance": "~0.3.3",
|
||||
"react-native-gesture-handler": "~1.10.2",
|
||||
"react-native-pager-view": "~5.0.12",
|
||||
"react-native-paper": "^4.7.2",
|
||||
"react-native-reanimated": "~2.1.0",
|
||||
"react-native-pager-view": "~5.1.10",
|
||||
"react-native-paper": "^4.9.1",
|
||||
"react-native-reanimated": "~2.2.0",
|
||||
"react-native-safe-area-context": "~3.2.0",
|
||||
"react-native-screens": "~3.0.0",
|
||||
"react-native-tab-view": "^3.0.1",
|
||||
"react-native-unimodules": "~0.13.1",
|
||||
"react-native-screens": "~3.3.0",
|
||||
"react-native-tab-view": "^3.1.1",
|
||||
"react-native-unimodules": "~0.13.3",
|
||||
"react-native-vector-icons": "^8.1.0",
|
||||
"react-native-web": "~0.15.0"
|
||||
"react-native-web": "~0.16.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.9.0",
|
||||
"@babel/node": "^7.13.13",
|
||||
"@expo/webpack-config": "~0.12.63",
|
||||
"@types/cheerio": "^0.22.28",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/node": "^7.14.2",
|
||||
"@expo/webpack-config": "~0.12.76",
|
||||
"@playwright/test": "^1.12.2",
|
||||
"@types/cheerio": "^0.22.29",
|
||||
"@types/jest-dev-server": "^4.2.0",
|
||||
"@types/koa": "^2.13.1",
|
||||
"@types/koa": "^2.13.3",
|
||||
"@types/mock-require": "^2.0.0",
|
||||
"@types/node-fetch": "^2.5.9",
|
||||
"@types/react": "~16.9.35",
|
||||
"@types/react-dom": "~16.9.8",
|
||||
"@types/react-native": "~0.63.2",
|
||||
"babel-jest": "~25.2.6",
|
||||
"@types/node-fetch": "^2.5.10",
|
||||
"@types/react": "~17.0.9",
|
||||
"@types/react-dom": "~17.0.6",
|
||||
"@types/react-native": "~0.64.9",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"babel-preset-expo": "8.3.0",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"expo-cli": "^4.4.4",
|
||||
"jest": "^26.6.3",
|
||||
"jest-dev-server": "^4.4.0",
|
||||
"cheerio": "^1.0.0-rc.9",
|
||||
"expo-cli": "^4.5.2",
|
||||
"jest-dev-server": "^5.0.3",
|
||||
"mock-require": "^3.0.3",
|
||||
"mock-require-assets": "^0.0.1",
|
||||
"node-fetch": "^2.6.1",
|
||||
"nodemon": "^2.0.6",
|
||||
"playwright": "^1.11.0",
|
||||
"pod-install": "^0.1.19",
|
||||
"pod-install": "^0.1.23",
|
||||
"react-native-flipper": "~0.80.0",
|
||||
"react-test-renderer": "~16.13.1",
|
||||
"serve": "^11.3.0",
|
||||
"typescript": "~4.2.3"
|
||||
"typescript": "^4.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,9 @@ const alias = Object.fromEntries(
|
||||
fs
|
||||
.readdirSync(packages)
|
||||
.filter((name) => !name.startsWith('.'))
|
||||
.map((name) => [
|
||||
`@react-navigation/${name}`,
|
||||
path.resolve(
|
||||
packages,
|
||||
name,
|
||||
require(`../../packages/${name}/package.json`).source
|
||||
),
|
||||
])
|
||||
.map((name) => [name, require(`../../packages/${name}/package.json`)])
|
||||
.filter(([, pak]) => pak.source != null)
|
||||
.map(([name, pak]) => [pak.name, path.resolve(packages, name, pak.source)])
|
||||
);
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import './resolve-hooks';
|
||||
|
||||
import { ServerContainer, ServerContainerRef } from '@react-navigation/native';
|
||||
import Koa from 'koa';
|
||||
import * as React from 'react';
|
||||
import ReactDOMServer from 'react-dom/server';
|
||||
import { AppRegistry } from 'react-native-web';
|
||||
import { ServerContainer, ServerContainerRef } from '@react-navigation/native';
|
||||
|
||||
import App from '../src/index';
|
||||
|
||||
AppRegistry.registerComponent('App', () => App);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import { View, TextInput, ActivityIndicator, StyleSheet } from 'react-native';
|
||||
import { Title, Button } from 'react-native-paper';
|
||||
import { useTheme, ParamListBase } from '@react-navigation/native';
|
||||
import { HeaderBackButton } from '@react-navigation/elements';
|
||||
import { ParamListBase, useTheme } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import { HeaderBackButton } from '@react-navigation/elements';
|
||||
import * as React from 'react';
|
||||
import { ActivityIndicator, StyleSheet, TextInput, View } from 'react-native';
|
||||
import { Button, Title } from 'react-native-paper';
|
||||
|
||||
type AuthStackParams = {
|
||||
Splash: undefined;
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
import * as React from 'react';
|
||||
import { ScrollView, StyleSheet } from 'react-native';
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { BlurView } from 'expo-blur';
|
||||
import {
|
||||
getFocusedRouteNameFromRoute,
|
||||
ParamListBase,
|
||||
NavigatorScreenParams,
|
||||
} from '@react-navigation/native';
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
import {
|
||||
createBottomTabNavigator,
|
||||
useBottomTabBarHeight,
|
||||
} from '@react-navigation/bottom-tabs';
|
||||
import { HeaderBackButton } from '@react-navigation/elements';
|
||||
import { HeaderBackButton, useHeaderHeight } from '@react-navigation/elements';
|
||||
import {
|
||||
getFocusedRouteNameFromRoute,
|
||||
NavigatorScreenParams,
|
||||
ParamListBase,
|
||||
useIsFocused,
|
||||
} from '@react-navigation/native';
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
import { BlurView } from 'expo-blur';
|
||||
import * as React from 'react';
|
||||
import { ScrollView, StatusBar, StyleSheet } from 'react-native';
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Contacts from '../Shared/Contacts';
|
||||
import Chat from '../Shared/Chat';
|
||||
import Contacts from '../Shared/Contacts';
|
||||
import SimpleStackScreen, { SimpleStackParams } from './SimpleStack';
|
||||
|
||||
const getTabBarIcon = (name: string) => ({
|
||||
color,
|
||||
size,
|
||||
}: {
|
||||
color: string;
|
||||
size: number;
|
||||
}) => <MaterialCommunityIcons name={name} color={color} size={size} />;
|
||||
const getTabBarIcon =
|
||||
(name: string) =>
|
||||
({ color, size }: { color: string; size: number }) =>
|
||||
<MaterialCommunityIcons name={name} color={color} size={size} />;
|
||||
|
||||
type BottomTabParams = {
|
||||
TabStack: NavigatorScreenParams<SimpleStackParams>;
|
||||
@@ -34,12 +33,22 @@ type BottomTabParams = {
|
||||
};
|
||||
|
||||
const AlbumsScreen = () => {
|
||||
const headerHeight = useHeaderHeight();
|
||||
const tabBarHeight = useBottomTabBarHeight();
|
||||
const isFocused = useIsFocused();
|
||||
|
||||
return (
|
||||
<ScrollView contentContainerStyle={{ paddingBottom: tabBarHeight }}>
|
||||
<Albums scrollEnabled={false} />
|
||||
</ScrollView>
|
||||
<>
|
||||
{isFocused && <StatusBar barStyle="light-content" />}
|
||||
<ScrollView
|
||||
contentContainerStyle={{
|
||||
paddingTop: headerHeight,
|
||||
paddingBottom: tabBarHeight,
|
||||
}}
|
||||
>
|
||||
<Albums scrollEnabled={false} />
|
||||
</ScrollView>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -96,11 +105,25 @@ export default function BottomTabsScreen({
|
||||
component={AlbumsScreen}
|
||||
options={{
|
||||
title: 'Albums',
|
||||
headerTintColor: '#fff',
|
||||
headerTransparent: true,
|
||||
headerBackground: () => (
|
||||
<BlurView
|
||||
tint="dark"
|
||||
intensity={100}
|
||||
style={StyleSheet.absoluteFill}
|
||||
/>
|
||||
),
|
||||
tabBarIcon: getTabBarIcon('image-album'),
|
||||
tabBarStyle: { position: 'absolute' },
|
||||
tabBarInactiveTintColor: 'rgba(255, 255, 255, 0.5)',
|
||||
tabBarActiveTintColor: '#fff',
|
||||
tabBarStyle: {
|
||||
position: 'absolute',
|
||||
borderTopColor: 'rgba(0, 0, 0, .2)',
|
||||
},
|
||||
tabBarBackground: () => (
|
||||
<BlurView
|
||||
tint="light"
|
||||
tint="dark"
|
||||
intensity={100}
|
||||
style={StyleSheet.absoluteFill}
|
||||
/>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet } from 'react-native';
|
||||
import { Title, Button } from 'react-native-paper';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
|
||||
import * as React from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import { Button, Title } from 'react-native-paper';
|
||||
import Feather from 'react-native-vector-icons/Feather';
|
||||
|
||||
type BottomTabParams = {
|
||||
[key: string]: undefined;
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, ScrollView, Platform } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import {
|
||||
Link,
|
||||
StackActions,
|
||||
ParamListBase,
|
||||
StackActions,
|
||||
useLinkProps,
|
||||
} from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
|
||||
type SimpleStackParams = {
|
||||
Article: { author: string };
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
DrawerContent,
|
||||
DrawerContentComponentProps,
|
||||
DrawerScreenProps,
|
||||
} from '@react-navigation/drawer';
|
||||
import {
|
||||
ParamListBase,
|
||||
useNavigation,
|
||||
useTheme,
|
||||
} from '@react-navigation/native';
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
import * as React from 'react';
|
||||
import { Dimensions, ScaledSize } from 'react-native';
|
||||
import { Appbar } from 'react-native-paper';
|
||||
import {
|
||||
useTheme,
|
||||
useNavigation,
|
||||
ParamListBase,
|
||||
} from '@react-navigation/native';
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
DrawerScreenProps,
|
||||
DrawerContent,
|
||||
DrawerContentComponentProps,
|
||||
} from '@react-navigation/drawer';
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
type DrawerParams = {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
|
||||
import type { NavigatorScreenParams } from '@react-navigation/native';
|
||||
import * as React from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import type { NavigatorScreenParams } from '@react-navigation/native';
|
||||
import { createMaterialBottomTabNavigator } from '@react-navigation/material-bottom-tabs';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Contacts from '../Shared/Contacts';
|
||||
import Chat from '../Shared/Chat';
|
||||
import Contacts from '../Shared/Contacts';
|
||||
import SimpleStackScreen, { SimpleStackParams } from './SimpleStack';
|
||||
|
||||
type MaterialBottomTabParams = {
|
||||
@@ -14,7 +15,8 @@ type MaterialBottomTabParams = {
|
||||
TabChat: undefined;
|
||||
};
|
||||
|
||||
const MaterialBottomTabs = createMaterialBottomTabNavigator<MaterialBottomTabParams>();
|
||||
const MaterialBottomTabs =
|
||||
createMaterialBottomTabNavigator<MaterialBottomTabParams>();
|
||||
|
||||
export default function MaterialBottomTabsScreen() {
|
||||
return (
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import * as React from 'react';
|
||||
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
|
||||
import * as React from 'react';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Contacts from '../Shared/Contacts';
|
||||
import Chat from '../Shared/Chat';
|
||||
import Contacts from '../Shared/Contacts';
|
||||
|
||||
type MaterialTopTabParams = {
|
||||
Albums: undefined;
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import * as React from 'react';
|
||||
import { View, Platform, StyleSheet, ScrollView } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
HeaderStyleInterpolators,
|
||||
StackScreenProps,
|
||||
TransitionPresets,
|
||||
HeaderStyleInterpolators,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
export type SimpleStackParams = {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, ScrollView, Platform } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
|
||||
type MixedStackParams = {
|
||||
Article: { author: string };
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, ScrollView, Platform } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
|
||||
type ModalStackParams = {
|
||||
Article: { author: string };
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import * as React from 'react';
|
||||
import { View, Platform, StyleSheet, ScrollView } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createNativeStackNavigator,
|
||||
NativeStackScreenProps,
|
||||
} from '@react-navigation/native-stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
export type NativeStackParams = {
|
||||
@@ -153,7 +154,7 @@ export default function NativeStackScreen({
|
||||
title: 'Albums',
|
||||
presentation: 'modal',
|
||||
headerShadowVisible: true,
|
||||
headerTranslucent: true,
|
||||
headerTransparent: true,
|
||||
headerBlurEffect: 'light',
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import { View, Platform, StyleSheet, ScrollView, Alert } from 'react-native';
|
||||
import { Appbar, Button } from 'react-native-paper';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createNativeStackNavigator,
|
||||
NativeStackScreenProps,
|
||||
} from '@react-navigation/native-stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Alert, Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Appbar, Button } from 'react-native-paper';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
export type NativeStackParams = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
import * as React from 'react';
|
||||
import { StyleSheet, Text, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import type { StackScreenProps } from '@react-navigation/stack';
|
||||
|
||||
const NotFoundScreen = ({
|
||||
route,
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Alert,
|
||||
View,
|
||||
TextInput,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import {
|
||||
useTheme,
|
||||
CommonActions,
|
||||
ParamListBase,
|
||||
NavigationAction,
|
||||
useTheme,
|
||||
} from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Alert,
|
||||
Platform,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
TextInput,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
|
||||
import Article from '../Shared/Article';
|
||||
|
||||
type PreventRemoveParams = {
|
||||
@@ -68,10 +68,7 @@ const InputScreen = ({
|
||||
React.useEffect(
|
||||
() =>
|
||||
navigation.addListener('beforeRemove', (e) => {
|
||||
const action: NavigationAction & { payload?: { confirmed?: boolean } } =
|
||||
e.data.action;
|
||||
|
||||
if (!hasUnsavedChanges || action.payload?.confirmed) {
|
||||
if (!hasUnsavedChanges) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,7 +80,7 @@ const InputScreen = ({
|
||||
);
|
||||
|
||||
if (discard) {
|
||||
navigation.dispatch(action);
|
||||
navigation.dispatch(e.data.action);
|
||||
}
|
||||
} else {
|
||||
Alert.alert(
|
||||
@@ -94,7 +91,7 @@ const InputScreen = ({
|
||||
{
|
||||
text: 'Discard',
|
||||
style: 'destructive',
|
||||
onPress: () => navigation.dispatch(action),
|
||||
onPress: () => navigation.dispatch(e.data.action),
|
||||
},
|
||||
]
|
||||
);
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import * as React from 'react';
|
||||
import { View, Platform, StyleSheet, ScrollView } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
import type { ParamListBase } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackNavigationOptions,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { Button } from 'react-native-paper';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
export type SimpleStackParams = {
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Animated,
|
||||
View,
|
||||
StyleSheet,
|
||||
ScrollView,
|
||||
Alert,
|
||||
Platform,
|
||||
} from 'react-native';
|
||||
import { Button, Appbar } from 'react-native-paper';
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
import { useTheme, ParamListBase } from '@react-navigation/native';
|
||||
import { HeaderBackground, useHeaderHeight } from '@react-navigation/elements';
|
||||
import { ParamListBase, useTheme } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
Header,
|
||||
StackHeaderProps,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import { HeaderBackground, useHeaderHeight } from '@react-navigation/elements';
|
||||
import BlurView from '../Shared/BlurView';
|
||||
import Article from '../Shared/Article';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Alert,
|
||||
Animated,
|
||||
Platform,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { Appbar, Button } from 'react-native-paper';
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
|
||||
import Albums from '../Shared/Albums';
|
||||
import Article from '../Shared/Article';
|
||||
import BlurView from '../Shared/BlurView';
|
||||
|
||||
type SimpleStackParams = {
|
||||
Article: { author: string };
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
View,
|
||||
StyleSheet,
|
||||
ScrollView,
|
||||
Platform,
|
||||
Pressable,
|
||||
Animated,
|
||||
} from 'react-native';
|
||||
import { Button, Paragraph } from 'react-native-paper';
|
||||
import { ParamListBase, useTheme } from '@react-navigation/native';
|
||||
import {
|
||||
createStackNavigator,
|
||||
StackScreenProps,
|
||||
useCardAnimation,
|
||||
} from '@react-navigation/stack';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Animated,
|
||||
Platform,
|
||||
Pressable,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { Button, Paragraph } from 'react-native-paper';
|
||||
|
||||
import Article from '../Shared/Article';
|
||||
import NewsFeed from '../Shared/NewsFeed';
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
import { useScrollToTop } from '@react-navigation/native';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
View,
|
||||
Image,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
ScrollViewProps,
|
||||
Dimensions,
|
||||
Image,
|
||||
Platform,
|
||||
ScaledSize,
|
||||
ScrollView,
|
||||
ScrollViewProps,
|
||||
StyleSheet,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { useScrollToTop } from '@react-navigation/native';
|
||||
|
||||
const COVERS = [
|
||||
require('../../assets/album-art-01.jpg'),
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useScrollToTop, useTheme } from '@react-navigation/native';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
Image,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
ScrollViewProps,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextProps,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { useScrollToTop, useTheme } from '@react-navigation/native';
|
||||
|
||||
type Props = Partial<ScrollViewProps> & {
|
||||
date?: string;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
View,
|
||||
Image,
|
||||
Text,
|
||||
TextInput,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
ScrollViewProps,
|
||||
} from 'react-native';
|
||||
import { useScrollToTop, useTheme } from '@react-navigation/native';
|
||||
import Color from 'color';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Image,
|
||||
ScrollView,
|
||||
ScrollViewProps,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextInput,
|
||||
View,
|
||||
} from 'react-native';
|
||||
|
||||
const MESSAGES = [
|
||||
'okay',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { View, Text, FlatList, StyleSheet } from 'react-native';
|
||||
import { useScrollToTop, useTheme } from '@react-navigation/native';
|
||||
import * as React from 'react';
|
||||
import { FlatList, StyleSheet, Text, View } from 'react-native';
|
||||
|
||||
type Item = { name: string; number: number };
|
||||
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
import { useScrollToTop, useTheme } from '@react-navigation/native';
|
||||
import Color from 'color';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
View,
|
||||
TextInput,
|
||||
Image,
|
||||
ScrollView,
|
||||
StyleSheet,
|
||||
ScrollViewProps,
|
||||
StyleSheet,
|
||||
TextInput,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { useScrollToTop, useTheme } from '@react-navigation/native';
|
||||
import {
|
||||
Card,
|
||||
Text,
|
||||
Avatar,
|
||||
Subheading,
|
||||
IconButton,
|
||||
Card,
|
||||
Divider,
|
||||
IconButton,
|
||||
Subheading,
|
||||
Text,
|
||||
} from 'react-native-paper';
|
||||
import Color from 'color';
|
||||
|
||||
type Props = Partial<ScrollViewProps> & {
|
||||
date?: number;
|
||||
|
||||
@@ -1,65 +1,69 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
ScrollView,
|
||||
Platform,
|
||||
StatusBar,
|
||||
I18nManager,
|
||||
Dimensions,
|
||||
ScaledSize,
|
||||
Linking,
|
||||
LogBox,
|
||||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
||||
import {
|
||||
Provider as PaperProvider,
|
||||
DefaultTheme as PaperLightTheme,
|
||||
DarkTheme as PaperDarkTheme,
|
||||
List,
|
||||
Divider,
|
||||
Text,
|
||||
} from 'react-native-paper';
|
||||
import { createURL } from 'expo-linking';
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import {
|
||||
useFlipper,
|
||||
useReduxDevToolsExtension,
|
||||
} from '@react-navigation/devtools';
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
DrawerScreenProps,
|
||||
} from '@react-navigation/drawer';
|
||||
import {
|
||||
CompositeScreenProps,
|
||||
DarkTheme,
|
||||
DefaultTheme,
|
||||
InitialState,
|
||||
NavigationContainer,
|
||||
DefaultTheme,
|
||||
DarkTheme,
|
||||
NavigatorScreenParams,
|
||||
PathConfigMap,
|
||||
useNavigationContainerRef,
|
||||
NavigatorScreenParams,
|
||||
} from '@react-navigation/native';
|
||||
import { createDrawerNavigator } from '@react-navigation/drawer';
|
||||
import {
|
||||
createStackNavigator,
|
||||
HeaderStyleInterpolators,
|
||||
StackNavigationProp,
|
||||
StackScreenProps,
|
||||
} from '@react-navigation/stack';
|
||||
import { createURL } from 'expo-linking';
|
||||
import * as React from 'react';
|
||||
import {
|
||||
useReduxDevToolsExtension,
|
||||
useFlipper,
|
||||
} from '@react-navigation/devtools';
|
||||
Dimensions,
|
||||
I18nManager,
|
||||
Linking,
|
||||
LogBox,
|
||||
Platform,
|
||||
ScaledSize,
|
||||
ScrollView,
|
||||
StatusBar,
|
||||
} from 'react-native';
|
||||
import {
|
||||
DarkTheme as PaperDarkTheme,
|
||||
DefaultTheme as PaperLightTheme,
|
||||
Divider,
|
||||
List,
|
||||
Provider as PaperProvider,
|
||||
Text,
|
||||
} from 'react-native-paper';
|
||||
import { SafeAreaView } from 'react-native-safe-area-context';
|
||||
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
|
||||
|
||||
import { restartApp } from './Restart';
|
||||
import SettingsItem from './Shared/SettingsItem';
|
||||
import NativeStack from './Screens/NativeStack';
|
||||
import SimpleStack from './Screens/SimpleStack';
|
||||
import ModalStack from './Screens/ModalStack';
|
||||
import MixedStack from './Screens/MixedStack';
|
||||
import MixedHeaderMode from './Screens/MixedHeaderMode';
|
||||
import StackTransparent from './Screens/StackTransparent';
|
||||
import StackHeaderCustomization from './Screens/StackHeaderCustomization';
|
||||
import NativeStackHeaderCustomization from './Screens/NativeStackHeaderCustomization';
|
||||
import BottomTabs from './Screens/BottomTabs';
|
||||
import MaterialTopTabsScreen from './Screens/MaterialTopTabs';
|
||||
import MaterialBottomTabs from './Screens/MaterialBottomTabs';
|
||||
import NotFound from './Screens/NotFound';
|
||||
import DynamicTabs from './Screens/DynamicTabs';
|
||||
import MasterDetail from './Screens/MasterDetail';
|
||||
import AuthFlow from './Screens/AuthFlow';
|
||||
import PreventRemove from './Screens/PreventRemove';
|
||||
import BottomTabs from './Screens/BottomTabs';
|
||||
import DynamicTabs from './Screens/DynamicTabs';
|
||||
import LinkComponent from './Screens/LinkComponent';
|
||||
import MasterDetail from './Screens/MasterDetail';
|
||||
import MaterialBottomTabs from './Screens/MaterialBottomTabs';
|
||||
import MaterialTopTabsScreen from './Screens/MaterialTopTabs';
|
||||
import MixedHeaderMode from './Screens/MixedHeaderMode';
|
||||
import MixedStack from './Screens/MixedStack';
|
||||
import ModalStack from './Screens/ModalStack';
|
||||
import NativeStack from './Screens/NativeStack';
|
||||
import NativeStackHeaderCustomization from './Screens/NativeStackHeaderCustomization';
|
||||
import NotFound from './Screens/NotFound';
|
||||
import PreventRemove from './Screens/PreventRemove';
|
||||
import SimpleStack from './Screens/SimpleStack';
|
||||
import StackHeaderCustomization from './Screens/StackHeaderCustomization';
|
||||
import StackTransparent from './Screens/StackTransparent';
|
||||
import SettingsItem from './Shared/SettingsItem';
|
||||
|
||||
if (Platform.OS !== 'web') {
|
||||
LogBox.ignoreLogs(['Require cycle:']);
|
||||
@@ -151,9 +155,8 @@ export default function App() {
|
||||
const [theme, setTheme] = React.useState(DefaultTheme);
|
||||
|
||||
const [isReady, setIsReady] = React.useState(Platform.OS === 'web');
|
||||
const [initialState, setInitialState] = React.useState<
|
||||
InitialState | undefined
|
||||
>();
|
||||
const [initialState, setInitialState] =
|
||||
React.useState<InitialState | undefined>();
|
||||
|
||||
React.useEffect(() => {
|
||||
const restoreState = async () => {
|
||||
@@ -333,9 +336,10 @@ export default function App() {
|
||||
>
|
||||
{({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: StackNavigationProp<RootStackParamList>;
|
||||
}) => (
|
||||
}: CompositeScreenProps<
|
||||
DrawerScreenProps<RootDrawerParamList, 'Examples'>,
|
||||
StackScreenProps<RootStackParamList>
|
||||
>) => (
|
||||
<ScrollView
|
||||
style={{ backgroundColor: theme.colors.background }}
|
||||
>
|
||||
|
||||
@@ -8,8 +8,6 @@ const packages = path.resolve(__dirname, '..', 'packages');
|
||||
module.exports = async function (env, argv) {
|
||||
const config = await createExpoWebpackConfigAsync(env, argv);
|
||||
|
||||
config.context = path.resolve(__dirname, '..');
|
||||
|
||||
config.module.rules.push({
|
||||
test: /\.(js|ts|tsx)$/,
|
||||
include: /(packages|example)\/.+/,
|
||||
@@ -27,11 +25,13 @@ module.exports = async function (env, argv) {
|
||||
fs.readdirSync(packages)
|
||||
.filter((name) => !name.startsWith('.'))
|
||||
.forEach((name) => {
|
||||
config.resolve.alias[`@react-navigation/${name}`] = path.resolve(
|
||||
packages,
|
||||
name,
|
||||
require(`../packages/${name}/package.json`).source
|
||||
);
|
||||
const pak = require(`../packages/${name}/package.json`);
|
||||
|
||||
if (pak.source == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
config.resolve.alias[pak.name] = path.resolve(packages, name, pak.source);
|
||||
});
|
||||
|
||||
return config;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
"allowBranch": "main",
|
||||
"conventionalCommits": true,
|
||||
"createRelease": "github",
|
||||
"distTag": "next",
|
||||
"message": "chore: publish",
|
||||
"ignoreChanges": [
|
||||
"**/__fixtures__/**",
|
||||
|
||||
23
package.json
23
package.json
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"description": "Rethinking navigation",
|
||||
"description": "Routing and navigation for your React Native apps",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
@@ -29,20 +29,24 @@
|
||||
"release": "lerna publish",
|
||||
"example": "yarn --cwd example"
|
||||
},
|
||||
"dependencies": {
|
||||
"react-native-web": "~0.16.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/config-conventional": "^12.1.1",
|
||||
"@types/jest": "^26.0.22",
|
||||
"@commitlint/config-conventional": "^12.1.4",
|
||||
"@types/jest": "^26.0.23",
|
||||
"babel-jest": "^26.6.3",
|
||||
"codecov": "^3.8.1",
|
||||
"commitlint": "^12.1.1",
|
||||
"eslint": "^7.23.0",
|
||||
"codecov": "^3.8.2",
|
||||
"commitlint": "^12.1.4",
|
||||
"eslint": "^7.27.0",
|
||||
"eslint-config-satya164": "^3.1.10",
|
||||
"eslint-plugin-simple-import-sort": "^7.0.0",
|
||||
"husky": "^4.3.6",
|
||||
"jest": "^26.6.3",
|
||||
"lerna": "^4.0.0",
|
||||
"metro-react-native-babel-preset": "^0.65.2",
|
||||
"prettier": "^2.2.1",
|
||||
"typescript": "^4.2.3"
|
||||
"metro-react-native-babel-preset": "^0.66.0",
|
||||
"prettier": "^2.3.0",
|
||||
"typescript": "^4.3.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"react": "~16.13.1",
|
||||
@@ -66,6 +70,7 @@
|
||||
"preset": "react-native"
|
||||
},
|
||||
"prettier": {
|
||||
"quoteProps": "consistent",
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
|
||||
@@ -3,6 +3,130 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.4...@react-navigation/bottom-tabs@6.0.5) (2021-08-17)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.3...@react-navigation/bottom-tabs@6.0.4) (2021-08-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix headerTransparent not working outside stack navigator ([42c43ff](https://github.com/react-navigation/react-navigation/commit/42c43ff7617112afd223ecb323be622666c79096))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.2...@react-navigation/bottom-tabs@6.0.3) (2021-08-09)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.1...@react-navigation/bottom-tabs@6.0.2) (2021-08-07)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* avoid blink when switching tab screens ([40dcbcf](https://github.com/react-navigation/react-navigation/commit/40dcbcf2fa48d5367d3121ef9f0ad6c1dd5933c6))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## [6.0.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0...@react-navigation/bottom-tabs@6.0.1) (2021-08-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* preserve params when switching tabs. fixes [#9782](https://github.com/react-navigation/react-navigation/issues/9782) ([98fa233](https://github.com/react-navigation/react-navigation/commit/98fa2330146457045c01af820c6d8e8cb955f9d1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.22...@react-navigation/bottom-tabs@6.0.0) (2021-08-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* remove tabBarAdapative option ([5f4e124](https://github.com/react-navigation/react-navigation/commit/5f4e12403265d22a2e4d03f11a11746b01184116))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.22](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.21...@react-navigation/bottom-tabs@6.0.0-next.22) (2021-07-16)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.21](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.20...@react-navigation/bottom-tabs@6.0.0-next.21) (2021-07-16)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.20](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.18...@react-navigation/bottom-tabs@6.0.0-next.20) (2021-07-01)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.19](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.18...@react-navigation/bottom-tabs@6.0.0-next.19) (2021-06-10)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.18](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.17...@react-navigation/bottom-tabs@6.0.0-next.18) (2021-06-01)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.17](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.16...@react-navigation/bottom-tabs@6.0.0-next.17) (2021-05-29)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.16](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.15...@react-navigation/bottom-tabs@6.0.0-next.16) (2021-05-29)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.14...@react-navigation/bottom-tabs@6.0.0-next.15) (2021-05-27)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.14](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@6.0.0-next.13...@react-navigation/bottom-tabs@6.0.0-next.14) (2021-05-26)
|
||||
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
Bottom tab navigator for React Navigation following iOS design guidelines.
|
||||
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/6.x/bottom-tab-navigator/).
|
||||
Installation instructions and documentation can be found on the [React Navigation website](https://reactnavigation.org/docs/bottom-tab-navigator/).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/bottom-tabs",
|
||||
"description": "Bottom tab navigator following iOS design guidelines",
|
||||
"version": "6.0.0-next.14",
|
||||
"version": "6.0.5",
|
||||
"keywords": [
|
||||
"react-native-component",
|
||||
"react-component",
|
||||
@@ -36,23 +36,23 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/elements": "^1.0.0-next.13",
|
||||
"@react-navigation/elements": "^1.1.0",
|
||||
"color": "^3.1.3",
|
||||
"warn-once": "^0.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-navigation/native": "^6.0.0-next.10",
|
||||
"@react-navigation/native": "^6.0.2",
|
||||
"@testing-library/react-native": "^7.2.0",
|
||||
"@types/color": "^3.0.1",
|
||||
"@types/react": "^16.9.53",
|
||||
"@types/react-native": "~0.64.4",
|
||||
"@types/react": "^17.0.9",
|
||||
"@types/react-native": "~0.64.9",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.4",
|
||||
"react-native-builder-bob": "^0.18.1",
|
||||
"react-native-safe-area-context": "~3.2.0",
|
||||
"react-native-screens": "~3.0.0",
|
||||
"typescript": "^4.2.3"
|
||||
"react-native-screens": "~3.3.0",
|
||||
"typescript": "^4.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^6.0.0",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import { View, Text, Button } from 'react-native';
|
||||
import { render, fireEvent } from '@testing-library/react-native';
|
||||
import { NavigationContainer, ParamListBase } from '@react-navigation/native';
|
||||
import { createBottomTabNavigator, BottomTabScreenProps } from '../index';
|
||||
import { fireEvent, render } from '@testing-library/react-native';
|
||||
import * as React from 'react';
|
||||
import { Button, Text, View } from 'react-native';
|
||||
|
||||
import { BottomTabScreenProps, createBottomTabNavigator } from '../index';
|
||||
|
||||
it('renders a bottom tab navigator with screens', async () => {
|
||||
const Test = ({ route, navigation }: BottomTabScreenProps<ParamListBase>) => (
|
||||
|
||||
@@ -6,23 +6,22 @@ export { default as createBottomTabNavigator } from './navigators/createBottomTa
|
||||
/**
|
||||
* Views
|
||||
*/
|
||||
export { default as BottomTabView } from './views/BottomTabView';
|
||||
export { default as BottomTabBar } from './views/BottomTabBar';
|
||||
export { default as BottomTabView } from './views/BottomTabView';
|
||||
|
||||
/**
|
||||
* Utilities
|
||||
*/
|
||||
export { default as BottomTabBarHeightContext } from './utils/BottomTabBarHeightContext';
|
||||
|
||||
export { default as useBottomTabBarHeight } from './utils/useBottomTabBarHeight';
|
||||
|
||||
/**
|
||||
* Types
|
||||
*/
|
||||
export type {
|
||||
BottomTabBarButtonProps,
|
||||
BottomTabBarProps,
|
||||
BottomTabNavigationOptions,
|
||||
BottomTabNavigationProp,
|
||||
BottomTabScreenProps,
|
||||
BottomTabBarProps,
|
||||
BottomTabBarButtonProps,
|
||||
} from './types';
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import warnOnce from 'warn-once';
|
||||
import {
|
||||
useNavigationBuilder,
|
||||
createNavigatorFactory,
|
||||
DefaultNavigatorOptions,
|
||||
ParamListBase,
|
||||
TabActionHelpers,
|
||||
TabNavigationState,
|
||||
TabRouter,
|
||||
TabRouterOptions,
|
||||
TabNavigationState,
|
||||
TabActionHelpers,
|
||||
ParamListBase,
|
||||
useNavigationBuilder,
|
||||
} from '@react-navigation/native';
|
||||
import BottomTabView from '../views/BottomTabView';
|
||||
import * as React from 'react';
|
||||
import warnOnce from 'warn-once';
|
||||
|
||||
import type {
|
||||
BottomTabNavigationConfig,
|
||||
BottomTabNavigationOptions,
|
||||
BottomTabNavigationEventMap,
|
||||
BottomTabNavigationOptions,
|
||||
} from '../types';
|
||||
import BottomTabView from '../views/BottomTabView';
|
||||
|
||||
type Props = DefaultNavigatorOptions<
|
||||
ParamListBase,
|
||||
@@ -53,8 +54,22 @@ function BottomTabNavigator({
|
||||
tabBarLabelStyle: tabBarOptions.labelStyle,
|
||||
tabBarIconStyle: tabBarOptions.iconStyle,
|
||||
tabBarItemStyle: tabBarOptions.tabStyle,
|
||||
tabBarLabelPosition: tabBarOptions.labelPosition,
|
||||
tabBarAdaptive: tabBarOptions.adaptive,
|
||||
tabBarLabelPosition:
|
||||
tabBarOptions.labelPosition ??
|
||||
(tabBarOptions.adaptive === false ? 'below-icon' : undefined),
|
||||
tabBarStyle: [
|
||||
{ display: tabBarOptions.tabBarVisible ? 'none' : 'flex' },
|
||||
defaultScreenOptions.tabBarStyle,
|
||||
],
|
||||
});
|
||||
|
||||
(
|
||||
Object.keys(defaultScreenOptions) as (keyof BottomTabNavigationOptions)[]
|
||||
).forEach((key) => {
|
||||
if (defaultScreenOptions[key] === undefined) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete defaultScreenOptions[key];
|
||||
}
|
||||
});
|
||||
|
||||
warnOnce(
|
||||
@@ -63,7 +78,7 @@ function BottomTabNavigator({
|
||||
defaultScreenOptions,
|
||||
null,
|
||||
2
|
||||
)}\n\nSee https://reactnavigation.org/docs/6.x/bottom-tab-navigator#options for more details.`
|
||||
)}\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator#options for more details.`
|
||||
);
|
||||
}
|
||||
|
||||
@@ -72,29 +87,25 @@ function BottomTabNavigator({
|
||||
|
||||
warnOnce(
|
||||
true,
|
||||
`Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.`
|
||||
`Bottom Tab Navigator: 'lazy' in props is deprecated. Move it to 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/bottom-tab-navigator/#lazy for more details.`
|
||||
);
|
||||
}
|
||||
|
||||
const {
|
||||
state,
|
||||
descriptors,
|
||||
navigation,
|
||||
NavigationContent,
|
||||
} = useNavigationBuilder<
|
||||
TabNavigationState<ParamListBase>,
|
||||
TabRouterOptions,
|
||||
TabActionHelpers<ParamListBase>,
|
||||
BottomTabNavigationOptions,
|
||||
BottomTabNavigationEventMap
|
||||
>(TabRouter, {
|
||||
initialRouteName,
|
||||
backBehavior,
|
||||
children,
|
||||
screenListeners,
|
||||
screenOptions,
|
||||
defaultScreenOptions,
|
||||
});
|
||||
const { state, descriptors, navigation, NavigationContent } =
|
||||
useNavigationBuilder<
|
||||
TabNavigationState<ParamListBase>,
|
||||
TabRouterOptions,
|
||||
TabActionHelpers<ParamListBase>,
|
||||
BottomTabNavigationOptions,
|
||||
BottomTabNavigationEventMap
|
||||
>(TabRouter, {
|
||||
initialRouteName,
|
||||
backBehavior,
|
||||
children,
|
||||
screenListeners,
|
||||
screenOptions,
|
||||
defaultScreenOptions,
|
||||
});
|
||||
|
||||
return (
|
||||
<NavigationContent>
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import type * as React from 'react';
|
||||
import type {
|
||||
Animated,
|
||||
TouchableWithoutFeedbackProps,
|
||||
StyleProp,
|
||||
TextStyle,
|
||||
ViewStyle,
|
||||
GestureResponderEvent,
|
||||
} from 'react-native';
|
||||
import type { HeaderOptions } from '@react-navigation/elements';
|
||||
import type {
|
||||
Descriptor,
|
||||
NavigationHelpers,
|
||||
NavigationProp,
|
||||
ParamListBase,
|
||||
Descriptor,
|
||||
TabNavigationState,
|
||||
TabActionHelpers,
|
||||
RouteProp,
|
||||
TabActionHelpers,
|
||||
TabNavigationState,
|
||||
} from '@react-navigation/native';
|
||||
import type * as React from 'react';
|
||||
import type {
|
||||
Animated,
|
||||
GestureResponderEvent,
|
||||
StyleProp,
|
||||
TextStyle,
|
||||
TouchableWithoutFeedbackProps,
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import type { EdgeInsets } from 'react-native-safe-area-context';
|
||||
import type { HeaderOptions } from '@react-navigation/elements';
|
||||
|
||||
export type Layout = { width: number; height: number };
|
||||
|
||||
@@ -86,23 +86,6 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
||||
*/
|
||||
title?: string;
|
||||
|
||||
/**
|
||||
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
||||
* Set it to `false` if you want to render the screen on initial render.
|
||||
*/
|
||||
lazy?: boolean;
|
||||
|
||||
/**
|
||||
* Function that given returns a React Element to display as a header.
|
||||
*/
|
||||
header?: (props: BottomTabHeaderProps) => React.ReactNode;
|
||||
|
||||
/**
|
||||
* Whether to show the header. Setting this to `false` hides the header.
|
||||
* Defaults to `true`.
|
||||
*/
|
||||
headerShown?: boolean;
|
||||
|
||||
/**
|
||||
* Title string of a tab displayed in the tab bar
|
||||
* or a function that given { focused: boolean, color: string, position: 'below-icon' | 'beside-icon' } returns a React.Node to display in tab bar.
|
||||
@@ -117,6 +100,31 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
||||
position: LabelPosition;
|
||||
}) => React.ReactNode);
|
||||
|
||||
/**
|
||||
* Whether the tab label should be visible. Defaults to `true`.
|
||||
*/
|
||||
tabBarShowLabel?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the label is shown below the icon or beside the icon.
|
||||
*
|
||||
* - `below-icon`: the label is shown below the icon (typical for iPhones)
|
||||
* - `beside-icon` the label is shown next to the icon (typical for iPad)
|
||||
*
|
||||
* By default, the position is chosen automatically based on device width.
|
||||
*/
|
||||
tabBarLabelPosition?: LabelPosition;
|
||||
|
||||
/**
|
||||
* Style object for the tab label.
|
||||
*/
|
||||
tabBarLabelStyle?: StyleProp<TextStyle>;
|
||||
|
||||
/**
|
||||
* Whether label font should scale to respect Text Size accessibility settings.
|
||||
*/
|
||||
tabBarAllowFontScaling?: boolean;
|
||||
|
||||
/**
|
||||
* A function that given { focused: boolean, color: string } returns a React.Node to display in the tab bar.
|
||||
*/
|
||||
@@ -126,6 +134,11 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
||||
size: number;
|
||||
}) => React.ReactNode;
|
||||
|
||||
/**
|
||||
* Style object for the tab icon.
|
||||
*/
|
||||
tabBarIconStyle?: StyleProp<TextStyle>;
|
||||
|
||||
/**
|
||||
* Text to show in a badge on the tab icon.
|
||||
*/
|
||||
@@ -148,17 +161,9 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
||||
*/
|
||||
tabBarTestID?: string;
|
||||
|
||||
/**
|
||||
* Animation config for showing and hiding the tab bar.
|
||||
*/
|
||||
tabBarVisibilityAnimationConfig?: {
|
||||
show?: TabBarVisibilityAnimationConfig;
|
||||
hide?: TabBarVisibilityAnimationConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
* Function which returns a React element to render as the tab bar button.
|
||||
* Renders `TouchableWithoutFeedback` by default.
|
||||
* Renders `Pressable` by default.
|
||||
*/
|
||||
tabBarButton?: (props: BottomTabBarButtonProps) => React.ReactNode;
|
||||
|
||||
@@ -178,59 +183,35 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
||||
tabBarActiveBackgroundColor?: string;
|
||||
|
||||
/**
|
||||
* background color for the inactive tabs.
|
||||
* Background color for the inactive tabs.
|
||||
*/
|
||||
tabBarInactiveBackgroundColor?: string;
|
||||
|
||||
/**
|
||||
* Whether label font should scale to respect Text Size accessibility settings.
|
||||
*/
|
||||
tabBarAllowFontScaling?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the tab label should be visible. Defaults to `true`.
|
||||
*/
|
||||
tabBarShowLabel?: boolean;
|
||||
|
||||
/**
|
||||
* Style object for the tab label.
|
||||
*/
|
||||
tabBarLabelStyle?: StyleProp<TextStyle>;
|
||||
|
||||
/**
|
||||
* Style object for the tab icon.
|
||||
*/
|
||||
tabBarIconStyle?: StyleProp<TextStyle>;
|
||||
|
||||
/**
|
||||
* Style object for the tab item container.
|
||||
*/
|
||||
tabBarItemStyle?: StyleProp<ViewStyle>;
|
||||
|
||||
/**
|
||||
* Whether the label is rendered below the icon or beside the icon.
|
||||
* By default, the position is chosen automatically based on device width.
|
||||
* In `below-icon` orientation (typical for iPhones), the label is rendered below and in `beside-icon` orientation, it's rendered beside (typical for iPad).
|
||||
*/
|
||||
tabBarLabelPosition?: LabelPosition;
|
||||
|
||||
/**
|
||||
* Whether the label position should adapt to the orientation.
|
||||
*/
|
||||
tabBarAdaptive?: boolean;
|
||||
|
||||
/**
|
||||
* Whether the tab bar gets hidden when the keyboard is shown. Defaults to `false`.
|
||||
*/
|
||||
tabBarHideOnKeyboard?: boolean;
|
||||
|
||||
/**
|
||||
* Animation config for showing and hiding the tab bar when the keyboard is shown/hidden.
|
||||
*/
|
||||
tabBarVisibilityAnimationConfig?: {
|
||||
show?: TabBarVisibilityAnimationConfig;
|
||||
hide?: TabBarVisibilityAnimationConfig;
|
||||
};
|
||||
|
||||
/**
|
||||
* Style object for the tab bar container.
|
||||
*/
|
||||
tabBarStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||
|
||||
/**
|
||||
* Component to use as background for the tab bar.
|
||||
* Function which returns a React Element to use as background for the tab bar.
|
||||
* You could render an image, a gradient, blur view etc.
|
||||
*
|
||||
* When using `BlurView`, make sure to set `position: 'absolute'` in `tabBarStyle` as well.
|
||||
@@ -238,6 +219,23 @@ export type BottomTabNavigationOptions = HeaderOptions & {
|
||||
*/
|
||||
tabBarBackground?: () => React.ReactNode;
|
||||
|
||||
/**
|
||||
* Whether this screens should render the first time it's accessed. Defaults to `true`.
|
||||
* Set it to `false` if you want to render the screen on initial render.
|
||||
*/
|
||||
lazy?: boolean;
|
||||
|
||||
/**
|
||||
* Function that given returns a React Element to display as a header.
|
||||
*/
|
||||
header?: (props: BottomTabHeaderProps) => React.ReactNode;
|
||||
|
||||
/**
|
||||
* Whether to show the header. Setting this to `false` hides the header.
|
||||
* Defaults to `true`.
|
||||
*/
|
||||
headerShown?: boolean;
|
||||
|
||||
/**
|
||||
* Whether this screen should be unmounted when navigating away from it.
|
||||
* Defaults to `false`.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import BottomTabBarHeightContext from './BottomTabBarHeightContext';
|
||||
|
||||
export default function useFloatingBottomTabBarHeight() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { Keyboard, Platform, EmitterSubscription } from 'react-native';
|
||||
import { EmitterSubscription, Keyboard, Platform } from 'react-native';
|
||||
|
||||
export default function useIsKeyboardShown() {
|
||||
const [isKeyboardShown, setIsKeyboardShown] = React.useState(false);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Animated, StyleSheet, StyleProp, TextStyle } from 'react-native';
|
||||
import color from 'color';
|
||||
import { useTheme } from '@react-navigation/native';
|
||||
import color from 'color';
|
||||
import * as React from 'react';
|
||||
import { Animated, StyleProp, StyleSheet, TextStyle } from 'react-native';
|
||||
|
||||
type Props = {
|
||||
/**
|
||||
@@ -48,6 +48,8 @@ export default function Badge({
|
||||
setRendered(false);
|
||||
}
|
||||
});
|
||||
|
||||
return () => opacity.stopAnimation();
|
||||
}, [opacity, rendered, visible]);
|
||||
|
||||
if (visible && !rendered) {
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
View,
|
||||
Animated,
|
||||
StyleSheet,
|
||||
Platform,
|
||||
LayoutChangeEvent,
|
||||
StyleProp,
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import { MissingIcon } from '@react-navigation/elements';
|
||||
import {
|
||||
CommonActions,
|
||||
NavigationContext,
|
||||
NavigationRouteContext,
|
||||
TabNavigationState,
|
||||
ParamListBase,
|
||||
CommonActions,
|
||||
useTheme,
|
||||
TabNavigationState,
|
||||
useLinkBuilder,
|
||||
useTheme,
|
||||
} from '@react-navigation/native';
|
||||
import { MissingIcon } from '@react-navigation/elements';
|
||||
import React from 'react';
|
||||
import {
|
||||
Animated,
|
||||
LayoutChangeEvent,
|
||||
Platform,
|
||||
StyleProp,
|
||||
StyleSheet,
|
||||
View,
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import { EdgeInsets, useSafeAreaFrame } from 'react-native-safe-area-context';
|
||||
|
||||
import BottomTabItem from './BottomTabItem';
|
||||
import type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';
|
||||
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
||||
import useIsKeyboardShown from '../utils/useIsKeyboardShown';
|
||||
import type { BottomTabBarProps, BottomTabDescriptorMap } from '../types';
|
||||
import BottomTabItem from './BottomTabItem';
|
||||
|
||||
type Props = BottomTabBarProps & {
|
||||
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
||||
@@ -48,16 +48,16 @@ const shouldUseHorizontalLabels = ({
|
||||
layout,
|
||||
dimensions,
|
||||
}: Options) => {
|
||||
const { tabBarLabelPosition, tabBarAdaptive = true } = descriptors[
|
||||
state.routes[state.index].key
|
||||
].options;
|
||||
const { tabBarLabelPosition } =
|
||||
descriptors[state.routes[state.index].key].options;
|
||||
|
||||
if (tabBarLabelPosition) {
|
||||
return tabBarLabelPosition === 'beside-icon';
|
||||
}
|
||||
|
||||
if (!tabBarAdaptive) {
|
||||
return false;
|
||||
switch (tabBarLabelPosition) {
|
||||
case 'beside-icon':
|
||||
return true;
|
||||
case 'below-icon':
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (layout.width >= 768) {
|
||||
@@ -145,6 +145,10 @@ export default function BottomTabBar({
|
||||
tabBarVisibilityAnimationConfig,
|
||||
tabBarStyle,
|
||||
tabBarBackground,
|
||||
tabBarActiveTintColor,
|
||||
tabBarInactiveTintColor,
|
||||
tabBarActiveBackgroundColor,
|
||||
tabBarInactiveBackgroundColor,
|
||||
} = focusedOptions;
|
||||
|
||||
const dimensions = useSafeAreaFrame();
|
||||
@@ -202,6 +206,8 @@ export default function BottomTabBar({
|
||||
...visibilityAnimationConfig?.hide?.config,
|
||||
}).start();
|
||||
}
|
||||
|
||||
return () => visible.stopAnimation();
|
||||
}, [visible, shouldShowTabBar]);
|
||||
|
||||
const [layout, setLayout] = React.useState({
|
||||
@@ -299,7 +305,7 @@ export default function BottomTabBar({
|
||||
|
||||
if (!focused && !event.defaultPrevented) {
|
||||
navigation.dispatch({
|
||||
...CommonActions.navigate(route.name),
|
||||
...CommonActions.navigate({ name: route.name, merge: true }),
|
||||
target: state.key,
|
||||
});
|
||||
}
|
||||
@@ -342,12 +348,10 @@ export default function BottomTabBar({
|
||||
to={buildLink(route.name, route.params)}
|
||||
testID={options.tabBarTestID}
|
||||
allowFontScaling={options.tabBarAllowFontScaling}
|
||||
activeTintColor={options.tabBarActiveTintColor}
|
||||
inactiveTintColor={options.tabBarInactiveTintColor}
|
||||
activeBackgroundColor={options.tabBarActiveBackgroundColor}
|
||||
inactiveBackgroundColor={
|
||||
options.tabBarInactiveBackgroundColor
|
||||
}
|
||||
activeTintColor={tabBarActiveTintColor}
|
||||
inactiveTintColor={tabBarInactiveTintColor}
|
||||
activeBackgroundColor={tabBarActiveBackgroundColor}
|
||||
inactiveBackgroundColor={tabBarInactiveBackgroundColor}
|
||||
button={options.tabBarButton}
|
||||
icon={
|
||||
options.tabBarIcon ??
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
Text,
|
||||
Pressable,
|
||||
StyleSheet,
|
||||
Platform,
|
||||
StyleProp,
|
||||
ViewStyle,
|
||||
TextStyle,
|
||||
GestureResponderEvent,
|
||||
} from 'react-native';
|
||||
import { Link, Route, useTheme } from '@react-navigation/native';
|
||||
import Color from 'color';
|
||||
import React from 'react';
|
||||
import {
|
||||
GestureResponderEvent,
|
||||
Platform,
|
||||
Pressable,
|
||||
StyleProp,
|
||||
StyleSheet,
|
||||
Text,
|
||||
TextStyle,
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
|
||||
import TabBarIcon from './TabBarIcon';
|
||||
import type { BottomTabBarButtonProps, LabelPosition } from '../types';
|
||||
import TabBarIcon from './TabBarIcon';
|
||||
|
||||
type Props = {
|
||||
/**
|
||||
|
||||
@@ -1,28 +1,29 @@
|
||||
import * as React from 'react';
|
||||
import { StyleSheet, Platform } from 'react-native';
|
||||
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
||||
import {
|
||||
getHeaderTitle,
|
||||
Header,
|
||||
SafeAreaProviderCompat,
|
||||
Screen,
|
||||
} from '@react-navigation/elements';
|
||||
import type {
|
||||
ParamListBase,
|
||||
TabNavigationState,
|
||||
} from '@react-navigation/native';
|
||||
import {
|
||||
Header,
|
||||
Screen,
|
||||
SafeAreaProviderCompat,
|
||||
getHeaderTitle,
|
||||
} from '@react-navigation/elements';
|
||||
import { MaybeScreenContainer, MaybeScreen } from './ScreenFallback';
|
||||
import BottomTabBar, { getTabBarHeight } from './BottomTabBar';
|
||||
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
||||
import BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';
|
||||
import * as React from 'react';
|
||||
import { Platform, StyleSheet } from 'react-native';
|
||||
import { SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
||||
|
||||
import type {
|
||||
BottomTabNavigationConfig,
|
||||
BottomTabDescriptorMap,
|
||||
BottomTabNavigationHelpers,
|
||||
BottomTabBarProps,
|
||||
BottomTabDescriptorMap,
|
||||
BottomTabHeaderProps,
|
||||
BottomTabNavigationConfig,
|
||||
BottomTabNavigationHelpers,
|
||||
BottomTabNavigationProp,
|
||||
} from '../types';
|
||||
import BottomTabBarHeightCallbackContext from '../utils/BottomTabBarHeightCallbackContext';
|
||||
import BottomTabBarHeightContext from '../utils/BottomTabBarHeightContext';
|
||||
import BottomTabBar, { getTabBarHeight } from './BottomTabBar';
|
||||
import { MaybeScreen, MaybeScreenContainer } from './ScreenFallback';
|
||||
|
||||
type Props = BottomTabNavigationConfig & {
|
||||
state: TabNavigationState<ParamListBase>;
|
||||
@@ -120,7 +121,7 @@ export default function BottomTabView(props: Props) {
|
||||
return (
|
||||
<MaybeScreen
|
||||
key={route.key}
|
||||
style={StyleSheet.absoluteFill}
|
||||
style={[StyleSheet.absoluteFill, { zIndex: isFocused ? 0 : -1 }]}
|
||||
visible={isFocused}
|
||||
enabled={detachInactiveScreens}
|
||||
>
|
||||
@@ -130,13 +131,15 @@ export default function BottomTabView(props: Props) {
|
||||
route={descriptor.route}
|
||||
navigation={descriptor.navigation}
|
||||
headerShown={descriptor.options.headerShown}
|
||||
headerTransparent={descriptor.options.headerTransparent}
|
||||
headerStatusBarHeight={
|
||||
descriptor.options.headerStatusBarHeight
|
||||
}
|
||||
header={header({
|
||||
layout: dimensions,
|
||||
route: descriptor.route,
|
||||
navigation: descriptor.navigation as BottomTabNavigationProp<ParamListBase>,
|
||||
navigation:
|
||||
descriptor.navigation as BottomTabNavigationProp<ParamListBase>,
|
||||
options: descriptor.options,
|
||||
})}
|
||||
style={sceneContainerStyle}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ResourceSavingView } from '@react-navigation/elements';
|
||||
import * as React from 'react';
|
||||
import { StyleProp, View, ViewProps, ViewStyle } from 'react-native';
|
||||
import { ResourceSavingView } from '@react-navigation/elements';
|
||||
|
||||
type Props = {
|
||||
visible: boolean;
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import type { Route } from '@react-navigation/native';
|
||||
import React from 'react';
|
||||
import {
|
||||
View,
|
||||
StyleSheet,
|
||||
StyleProp,
|
||||
StyleSheet,
|
||||
TextStyle,
|
||||
View,
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import type { Route } from '@react-navigation/native';
|
||||
|
||||
import Badge from './Badge';
|
||||
|
||||
type Props = {
|
||||
@@ -27,6 +28,7 @@ type Props = {
|
||||
};
|
||||
|
||||
export default function TabBarIcon({
|
||||
route: _,
|
||||
horizontal,
|
||||
badge,
|
||||
badgeStyle,
|
||||
|
||||
@@ -3,6 +3,108 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [6.0.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0...@react-navigation/core@6.0.1) (2021-08-03)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add merge to the navigate types ([#9777](https://github.com/react-navigation/react-navigation/issues/9777)) ([be8532c](https://github.com/react-navigation/react-navigation/commit/be8532c0867bdb0cff4b29c0892bdfe85c33e8e3))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.17...@react-navigation/core@6.0.0) (2021-08-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* clear options set from a screen when it unmounts. closes [#9756](https://github.com/react-navigation/react-navigation/issues/9756) ([d2d7f8d](https://github.com/react-navigation/react-navigation/commit/d2d7f8d95e84e8d45b6807f59afcf4d0e64c3828))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.17](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.16...@react-navigation/core@6.0.0-next.17) (2021-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* use nested params for initial state only ([577d79e](https://github.com/react-navigation/react-navigation/commit/577d79e98c6d6f1c78e0f3232225b2b6b331340b))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.16](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.15...@react-navigation/core@6.0.0-next.16) (2021-07-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* prevent navigation state updates after state cleanup ([#9688](https://github.com/react-navigation/react-navigation/issues/9688)) ([16f0e11](https://github.com/react-navigation/react-navigation/commit/16f0e11822b14aa5b1ba4b288fb38fcf15088419))
|
||||
* sort wildcard and :params ([#9672](https://github.com/react-navigation/react-navigation/issues/9672)) ([4135d09](https://github.com/react-navigation/react-navigation/commit/4135d09c6f14030257b2da47658e102b083c7727))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.13...@react-navigation/core@6.0.0-next.15) (2021-07-01)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* fix typechecking in linking config ([b1134c8](https://github.com/react-navigation/react-navigation/commit/b1134c8a34f96be2817cb780c4bd23b2025b4c35))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* show stack trace in the flipper plugin ([97772af](https://github.com/react-navigation/react-navigation/commit/97772affa3c8f26489f0bdbfb6872ef4377b8ed1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.14](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.13...@react-navigation/core@6.0.0-next.14) (2021-06-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* show stack trace in the flipper plugin ([97772af](https://github.com/react-navigation/react-navigation/commit/97772affa3c8f26489f0bdbfb6872ef4377b8ed1))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.13](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.12...@react-navigation/core@6.0.0-next.13) (2021-05-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* validate property names in linking config ([324ea71](https://github.com/react-navigation/react-navigation/commit/324ea7181db6b743f512854be267cc9d65975b6f))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.12](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.11...@react-navigation/core@6.0.0-next.12) (2021-05-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* try to fix [#9631](https://github.com/react-navigation/react-navigation/issues/9631) ([b4d7b0e](https://github.com/react-navigation/react-navigation/commit/b4d7b0ee86c09419a18357867a0a25bb90d960c0))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.10...@react-navigation/core@6.0.0-next.11) (2021-05-27)
|
||||
|
||||
**Note:** Version bump only for package @react-navigation/core
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [6.0.0-next.10](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@6.0.0-next.9...@react-navigation/core@6.0.0-next.10) (2021-05-26)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@react-navigation/core",
|
||||
"description": "Core utilities for building navigators",
|
||||
"version": "6.0.0-next.10",
|
||||
"version": "6.0.1",
|
||||
"keywords": [
|
||||
"react",
|
||||
"react-native",
|
||||
@@ -35,22 +35,22 @@
|
||||
"clean": "del lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/routers": "^6.0.0-next.3",
|
||||
"@react-navigation/routers": "^6.0.1",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"nanoid": "^3.1.22",
|
||||
"nanoid": "^3.1.23",
|
||||
"query-string": "^7.0.0",
|
||||
"react-is": "^16.13.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/react-native": "^7.2.0",
|
||||
"@types/react": "^16.9.53",
|
||||
"@types/react-is": "^16.7.1",
|
||||
"@types/react": "^17.0.9",
|
||||
"@types/react-is": "^17.0.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"immer": "^9.0.1",
|
||||
"immer": "^9.0.2",
|
||||
"react": "~16.13.1",
|
||||
"react-native-builder-bob": "^0.18.1",
|
||||
"react-test-renderer": "~16.13.1",
|
||||
"typescript": "^4.2.3"
|
||||
"typescript": "^4.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*"
|
||||
|
||||
@@ -1,60 +1,42 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
CommonActions,
|
||||
Route,
|
||||
NavigationState,
|
||||
InitialState,
|
||||
PartialState,
|
||||
NavigationAction,
|
||||
NavigationState,
|
||||
ParamListBase,
|
||||
PartialState,
|
||||
Route,
|
||||
} from '@react-navigation/routers';
|
||||
import EnsureSingleNavigator from './EnsureSingleNavigator';
|
||||
import UnhandledActionContext from './UnhandledActionContext';
|
||||
import NavigationBuilderContext from './NavigationBuilderContext';
|
||||
import NavigationStateContext from './NavigationStateContext';
|
||||
import NavigationRouteContext from './NavigationRouteContext';
|
||||
import NavigationContext from './NavigationContext';
|
||||
import { ScheduleUpdateContext } from './useScheduleUpdate';
|
||||
import useChildListeners from './useChildListeners';
|
||||
import useKeyedChildListeners from './useKeyedChildListeners';
|
||||
import useOptionsGetters from './useOptionsGetters';
|
||||
import useEventEmitter from './useEventEmitter';
|
||||
import useSyncState from './useSyncState';
|
||||
import checkSerializable from './checkSerializable';
|
||||
import * as React from 'react';
|
||||
|
||||
import checkDuplicateRouteNames from './checkDuplicateRouteNames';
|
||||
import findFocusedRoute from './findFocusedRoute';
|
||||
import checkSerializable from './checkSerializable';
|
||||
import { NOT_INITIALIZED_ERROR } from './createNavigationContainerRef';
|
||||
import EnsureSingleNavigator from './EnsureSingleNavigator';
|
||||
import findFocusedRoute from './findFocusedRoute';
|
||||
import NavigationBuilderContext from './NavigationBuilderContext';
|
||||
import NavigationContainerRefContext from './NavigationContainerRefContext';
|
||||
import NavigationContext from './NavigationContext';
|
||||
import NavigationRouteContext from './NavigationRouteContext';
|
||||
import NavigationStateContext from './NavigationStateContext';
|
||||
import type {
|
||||
NavigationContainerEventMap,
|
||||
NavigationContainerRef,
|
||||
NavigationContainerProps,
|
||||
NavigationContainerRef,
|
||||
} from './types';
|
||||
import NavigationContainerRefContext from './NavigationContainerRefContext';
|
||||
import UnhandledActionContext from './UnhandledActionContext';
|
||||
import useChildListeners from './useChildListeners';
|
||||
import useEventEmitter from './useEventEmitter';
|
||||
import useKeyedChildListeners from './useKeyedChildListeners';
|
||||
import useOptionsGetters from './useOptionsGetters';
|
||||
import { ScheduleUpdateContext } from './useScheduleUpdate';
|
||||
import useSyncState from './useSyncState';
|
||||
|
||||
type State = NavigationState | PartialState<NavigationState> | undefined;
|
||||
|
||||
const serializableWarnings: string[] = [];
|
||||
const duplicateNameWarnings: string[] = [];
|
||||
|
||||
try {
|
||||
/**
|
||||
* Migration instructions for removal of devtools from core
|
||||
*/
|
||||
Object.defineProperty(
|
||||
global,
|
||||
'REACT_NAVIGATION_REDUX_DEVTOOLS_EXTENSION_INTEGRATION_ENABLED',
|
||||
{
|
||||
set(_) {
|
||||
console.warn(
|
||||
"Redux devtools extension integration can be enabled with the '@react-navigation/devtools' package. For more details, see https://reactnavigation.org/docs/devtools"
|
||||
);
|
||||
},
|
||||
}
|
||||
);
|
||||
} catch (e) {
|
||||
// Ignore
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove `key` and `routeNames` from the state objects recursively to get partial state.
|
||||
*
|
||||
@@ -113,15 +95,10 @@ const BaseNavigationContainer = React.forwardRef(
|
||||
);
|
||||
}
|
||||
|
||||
const [
|
||||
state,
|
||||
getState,
|
||||
setState,
|
||||
scheduleUpdate,
|
||||
flushUpdates,
|
||||
] = useSyncState<State>(() =>
|
||||
getPartialState(initialState == null ? undefined : initialState)
|
||||
);
|
||||
const [state, getState, setState, scheduleUpdate, flushUpdates] =
|
||||
useSyncState<State>(() =>
|
||||
getPartialState(initialState == null ? undefined : initialState)
|
||||
);
|
||||
|
||||
const isFirstMountRef = React.useRef<boolean>(true);
|
||||
|
||||
@@ -215,12 +192,13 @@ const BaseNavigationContainer = React.forwardRef(
|
||||
return acc;
|
||||
}, {}),
|
||||
...emitter.create('root'),
|
||||
resetRoot,
|
||||
dispatch,
|
||||
resetRoot,
|
||||
isFocused: () => true,
|
||||
canGoBack,
|
||||
getRootState,
|
||||
getState: () => stateRef.current,
|
||||
getParent: () => undefined,
|
||||
getState: () => stateRef.current,
|
||||
getRootState,
|
||||
getCurrentRoute,
|
||||
getCurrentOptions,
|
||||
isReady: () => listeners.focus[0] != null,
|
||||
@@ -241,7 +219,10 @@ const BaseNavigationContainer = React.forwardRef(
|
||||
|
||||
const onDispatchAction = React.useCallback(
|
||||
(action: NavigationAction, noop: boolean) => {
|
||||
emitter.emit({ type: '__unsafe_action__', data: { action, noop } });
|
||||
emitter.emit({
|
||||
type: '__unsafe_action__',
|
||||
data: { action, noop, stack: stackRef.current },
|
||||
});
|
||||
},
|
||||
[emitter]
|
||||
);
|
||||
@@ -264,12 +245,15 @@ const BaseNavigationContainer = React.forwardRef(
|
||||
[emitter]
|
||||
);
|
||||
|
||||
const stackRef = React.useRef<string | undefined>();
|
||||
|
||||
const builderContext = React.useMemo(
|
||||
() => ({
|
||||
addListener,
|
||||
addKeyedListener,
|
||||
onDispatchAction,
|
||||
onOptionsChange,
|
||||
stackRef,
|
||||
}),
|
||||
[addListener, addKeyedListener, onDispatchAction, onOptionsChange]
|
||||
);
|
||||
@@ -367,9 +351,8 @@ const BaseNavigationContainer = React.forwardRef(
|
||||
}
|
||||
}
|
||||
|
||||
const duplicateRouteNamesResult = checkDuplicateRouteNames(
|
||||
hydratedState
|
||||
);
|
||||
const duplicateRouteNamesResult =
|
||||
checkDuplicateRouteNames(hydratedState);
|
||||
|
||||
if (duplicateRouteNamesResult.length) {
|
||||
const message = `Found screens with the same name nested inside one another. Check:\n${duplicateRouteNamesResult.map(
|
||||
|
||||
@@ -4,8 +4,7 @@ import * as React from 'react';
|
||||
* Context which holds the values for the current navigation tree.
|
||||
* Intended for use in SSR. This is not safe to use on the client.
|
||||
*/
|
||||
const CurrentRenderContext = React.createContext<
|
||||
{ options?: object } | undefined
|
||||
>(undefined);
|
||||
const CurrentRenderContext =
|
||||
React.createContext<{ options?: object } | undefined>(undefined);
|
||||
|
||||
export default CurrentRenderContext;
|
||||
|
||||
@@ -6,13 +6,14 @@ type Props = {
|
||||
|
||||
const MULTIPLE_NAVIGATOR_ERROR = `Another navigator is already registered for this container. You likely have multiple navigators under a single "NavigationContainer" or "Screen". Make sure each navigator is under a separate "Screen" container. See https://reactnavigation.org/docs/nesting-navigators for a guide on nesting.`;
|
||||
|
||||
export const SingleNavigatorContext = React.createContext<
|
||||
| {
|
||||
register(key: string): void;
|
||||
unregister(key: string): void;
|
||||
}
|
||||
| undefined
|
||||
>(undefined);
|
||||
export const SingleNavigatorContext =
|
||||
React.createContext<
|
||||
| {
|
||||
register(key: string): void;
|
||||
unregister(key: string): void;
|
||||
}
|
||||
| undefined
|
||||
>(undefined);
|
||||
|
||||
/**
|
||||
* Component which ensures that there's only one navigator nested under it.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { ParamListBase } from '@react-navigation/routers';
|
||||
|
||||
import type { RouteGroupConfig } from './types';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import type {
|
||||
NavigationAction,
|
||||
NavigationState,
|
||||
ParamListBase,
|
||||
} from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
import type { NavigationHelpers } from './types';
|
||||
|
||||
export type ListenerMap = {
|
||||
@@ -38,7 +39,10 @@ export type FocusedNavigationCallback<T> = (
|
||||
|
||||
export type FocusedNavigationListener = <T>(
|
||||
callback: FocusedNavigationCallback<T>
|
||||
) => { handled: boolean; result: T };
|
||||
) => {
|
||||
handled: boolean;
|
||||
result: T;
|
||||
};
|
||||
|
||||
export type GetStateListener = () => NavigationState;
|
||||
|
||||
@@ -57,6 +61,7 @@ const NavigationBuilderContext = React.createContext<{
|
||||
onRouteFocus?: (key: string) => void;
|
||||
onDispatchAction: (action: NavigationAction, noop: boolean) => void;
|
||||
onOptionsChange: (options: object) => void;
|
||||
stackRef?: React.MutableRefObject<string | undefined>;
|
||||
}>({
|
||||
onDispatchAction: () => undefined,
|
||||
onOptionsChange: () => undefined,
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import * as React from 'react';
|
||||
import type { ParamListBase } from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
import type { NavigationContainerRef } from './types';
|
||||
|
||||
/**
|
||||
* Context which holds the route prop for a screen.
|
||||
*/
|
||||
const NavigationContainerRefContext = React.createContext<
|
||||
NavigationContainerRef<ParamListBase> | undefined
|
||||
>(undefined);
|
||||
const NavigationContainerRefContext =
|
||||
React.createContext<NavigationContainerRef<ParamListBase> | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
export default NavigationContainerRefContext;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import * as React from 'react';
|
||||
import type { ParamListBase } from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
import type { NavigationProp } from './types';
|
||||
|
||||
/**
|
||||
* Context which holds the navigation prop for a screen.
|
||||
*/
|
||||
const NavigationContext = React.createContext<
|
||||
NavigationProp<ParamListBase> | undefined
|
||||
>(undefined);
|
||||
const NavigationContext =
|
||||
React.createContext<NavigationProp<ParamListBase> | undefined>(undefined);
|
||||
|
||||
export default NavigationContext;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import * as React from 'react';
|
||||
import type { ParamListBase } from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
import type { NavigationHelpers } from './types';
|
||||
|
||||
/**
|
||||
* Context which holds the navigation helpers of the parent navigator.
|
||||
* Navigators should use this context in their view component.
|
||||
*/
|
||||
const NavigationHelpersContext = React.createContext<
|
||||
NavigationHelpers<ParamListBase> | undefined
|
||||
>(undefined);
|
||||
const NavigationHelpersContext =
|
||||
React.createContext<NavigationHelpers<ParamListBase> | undefined>(undefined);
|
||||
|
||||
export default NavigationHelpersContext;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import * as React from 'react';
|
||||
import type { Route } from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
/**
|
||||
* Context which holds the route prop for a screen.
|
||||
*/
|
||||
const NavigationRouteContext = React.createContext<Route<string> | undefined>(
|
||||
undefined
|
||||
);
|
||||
const NavigationRouteContext =
|
||||
React.createContext<Route<string> | undefined>(undefined);
|
||||
|
||||
export default NavigationRouteContext;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import type { NavigationState, PartialState } from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
const MISSING_CONTEXT_ERROR =
|
||||
"Couldn't find a navigation context. Have you wrapped your app with 'NavigationContainer'? See https://reactnavigation.org/docs/getting-started for setup instructions.";
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
import * as React from 'react';
|
||||
import type {
|
||||
Route,
|
||||
ParamListBase,
|
||||
NavigationState,
|
||||
ParamListBase,
|
||||
PartialState,
|
||||
Route,
|
||||
} from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
import EnsureSingleNavigator from './EnsureSingleNavigator';
|
||||
import NavigationStateContext from './NavigationStateContext';
|
||||
import StaticContainer from './StaticContainer';
|
||||
import EnsureSingleNavigator from './EnsureSingleNavigator';
|
||||
import useOptionsGetters from './useOptionsGetters';
|
||||
import type { NavigationProp, RouteConfigComponent } from './types';
|
||||
import useOptionsGetters from './useOptionsGetters';
|
||||
|
||||
type Props<State extends NavigationState, ScreenOptions extends {}> = {
|
||||
screen: RouteConfigComponent<ParamListBase, string> & { name: string };
|
||||
@@ -19,6 +20,7 @@ type Props<State extends NavigationState, ScreenOptions extends {}> = {
|
||||
getState: () => State;
|
||||
setState: (state: State) => void;
|
||||
options: object;
|
||||
clearOptions: () => void;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -36,6 +38,7 @@ export default function SceneView<
|
||||
getState,
|
||||
setState,
|
||||
options,
|
||||
clearOptions,
|
||||
}: Props<State, ScreenOptions>) {
|
||||
const navigatorKeyRef = React.useRef<string | undefined>();
|
||||
const getKey = React.useCallback(() => navigatorKeyRef.current, []);
|
||||
@@ -77,6 +80,12 @@ export default function SceneView<
|
||||
isInitialRef.current = false;
|
||||
});
|
||||
|
||||
// Clear options set by this screen when it is unmounted
|
||||
React.useEffect(() => {
|
||||
return clearOptions;
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
const getIsInitial = React.useCallback(() => isInitialRef.current, []);
|
||||
|
||||
const context = React.useMemo(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ParamListBase, NavigationState } from '@react-navigation/routers';
|
||||
import type { RouteConfig, EventMapBase } from './types';
|
||||
import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
||||
|
||||
import type { EventMapBase, RouteConfig } from './types';
|
||||
|
||||
/**
|
||||
* Empty component used for specifying route configuration.
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import * as React from 'react';
|
||||
import type { NavigationAction } from '@react-navigation/routers';
|
||||
import * as React from 'react';
|
||||
|
||||
const UnhandledActionContext = React.createContext<
|
||||
((action: NavigationAction) => void) | undefined
|
||||
>(undefined);
|
||||
const UnhandledActionContext =
|
||||
React.createContext<((action: NavigationAction) => void) | undefined>(
|
||||
undefined
|
||||
);
|
||||
|
||||
export default UnhandledActionContext;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import * as React from 'react';
|
||||
import { act, render } from '@testing-library/react-native';
|
||||
import {
|
||||
DefaultRouterOptions,
|
||||
NavigationState,
|
||||
@@ -8,12 +6,15 @@ import {
|
||||
StackRouter,
|
||||
TabRouter,
|
||||
} from '@react-navigation/routers';
|
||||
import { act, render } from '@testing-library/react-native';
|
||||
import * as React from 'react';
|
||||
|
||||
import BaseNavigationContainer from '../BaseNavigationContainer';
|
||||
import NavigationStateContext from '../NavigationStateContext';
|
||||
import createNavigationContainerRef from '../createNavigationContainerRef';
|
||||
import MockRouter, { MockActions } from './__fixtures__/MockRouter';
|
||||
import useNavigationBuilder from '../useNavigationBuilder';
|
||||
import NavigationStateContext from '../NavigationStateContext';
|
||||
import Screen from '../Screen';
|
||||
import useNavigationBuilder from '../useNavigationBuilder';
|
||||
import MockRouter, { MockActions } from './__fixtures__/MockRouter';
|
||||
|
||||
it('throws when getState is accessed without a container', () => {
|
||||
expect.assertions(1);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { render } from '@testing-library/react-native';
|
||||
import * as React from 'react';
|
||||
|
||||
import StaticContainer from '../StaticContainer';
|
||||
|
||||
it("doesn't update element if no props changed", () => {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import {
|
||||
BaseRouter,
|
||||
Router,
|
||||
CommonNavigationAction,
|
||||
DefaultRouterOptions,
|
||||
NavigationState,
|
||||
Route,
|
||||
DefaultRouterOptions,
|
||||
Router,
|
||||
} from '@react-navigation/routers';
|
||||
|
||||
export type MockActions = CommonNavigationAction | { type: 'NOOP' | 'UPDATE' };
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
import type { NavigationState, ParamListBase } from '@react-navigation/routers';
|
||||
import { render } from '@testing-library/react-native';
|
||||
import * as React from 'react';
|
||||
|
||||
import BaseNavigationContainer from '../BaseNavigationContainer';
|
||||
import createNavigationContainerRef from '../createNavigationContainerRef';
|
||||
import Screen from '../Screen';
|
||||
import useNavigationBuilder from '../useNavigationBuilder';
|
||||
import MockRouter from './__fixtures__/MockRouter';
|
||||
|
||||
it('adds the listener even if container is mounted later', () => {
|
||||
const ref = createNavigationContainerRef<ParamListBase>();
|
||||
const listener = jest.fn();
|
||||
|
||||
ref.addListener('state', listener);
|
||||
|
||||
const TestNavigator = (props: any) => {
|
||||
const { state, descriptors } = useNavigationBuilder<
|
||||
NavigationState,
|
||||
any,
|
||||
{},
|
||||
{ title?: string },
|
||||
any
|
||||
>(MockRouter, props);
|
||||
const { render, options } = descriptors[state.routes[state.index].key];
|
||||
|
||||
return (
|
||||
<main>
|
||||
<h1>{options.title}</h1>
|
||||
<div>{render()}</div>
|
||||
</main>
|
||||
);
|
||||
};
|
||||
|
||||
const element = (
|
||||
<BaseNavigationContainer ref={ref}>
|
||||
<TestNavigator>
|
||||
<Screen name="foo">{() => null}</Screen>
|
||||
<Screen name="bar">{() => null}</Screen>
|
||||
</TestNavigator>
|
||||
</BaseNavigationContainer>
|
||||
);
|
||||
|
||||
render(element).update(element);
|
||||
|
||||
expect(listener).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user