mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-16 22:44:03 +08:00
Compare commits
23 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f274058b90 | ||
|
|
976178d098 | ||
|
|
493956ef71 | ||
|
|
699ea0cc50 | ||
|
|
a63f9da8c1 | ||
|
|
cceaa6780d | ||
|
|
4b8155386b | ||
|
|
1a757fc30a | ||
|
|
7b353a4aea | ||
|
|
3728390b60 | ||
|
|
a8342aaf3d | ||
|
|
860adbfd8b | ||
|
|
38d680833e | ||
|
|
cae115fc17 | ||
|
|
87b51476d0 | ||
|
|
b1b211855f | ||
|
|
60fe0dbb0a | ||
|
|
bb294b16f9 | ||
|
|
4ca2d2d22b | ||
|
|
35747a6066 | ||
|
|
bae4019995 | ||
|
|
d3a9639060 | ||
|
|
d88cbcb52d |
@@ -8,6 +8,12 @@ executors:
|
|||||||
environment:
|
environment:
|
||||||
YARN_CACHE_FOLDER: "~/.cache/yarn"
|
YARN_CACHE_FOLDER: "~/.cache/yarn"
|
||||||
|
|
||||||
|
playwright:
|
||||||
|
docker:
|
||||||
|
- image: mcr.microsoft.com/playwright:bionic
|
||||||
|
environment:
|
||||||
|
NODE_ENV: development
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
attach_project:
|
attach_project:
|
||||||
steps:
|
steps:
|
||||||
@@ -61,18 +67,9 @@ jobs:
|
|||||||
destination: coverage
|
destination: coverage
|
||||||
|
|
||||||
integration-tests:
|
integration-tests:
|
||||||
executor: default
|
executor: playwright
|
||||||
steps:
|
steps:
|
||||||
- attach_project
|
- attach_project
|
||||||
- run:
|
|
||||||
name: Install Headless Chrome dependencies
|
|
||||||
command: |
|
|
||||||
sudo apt-get install -yq \
|
|
||||||
gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
|
|
||||||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
|
|
||||||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \
|
|
||||||
libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \
|
|
||||||
fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
|
|
||||||
- run:
|
- run:
|
||||||
name: Build example for web
|
name: Build example for web
|
||||||
command: yarn example expo build:web --no-pwa
|
command: yarn example expo build:web --no-pwa
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
"mock-require-assets": "^0.0.1",
|
"mock-require-assets": "^0.0.1",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"nodemon": "^2.0.6",
|
"nodemon": "^2.0.6",
|
||||||
"playwright": "^0.14.0",
|
"playwright": "^1.9.1",
|
||||||
"serve": "^11.3.0",
|
"serve": "^11.3.0",
|
||||||
"typescript": "^4.0.3"
|
"typescript": "^4.0.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
"version": "independent",
|
"version": "independent",
|
||||||
"command": {
|
"command": {
|
||||||
"publish": {
|
"publish": {
|
||||||
"allowBranch": "main",
|
"allowBranch": "5.x",
|
||||||
"conventionalCommits": true,
|
"conventionalCommits": true,
|
||||||
"createRelease": "github",
|
"createRelease": "github",
|
||||||
"message": "chore: publish",
|
"message": "chore: publish",
|
||||||
|
|||||||
@@ -3,6 +3,67 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.11.9](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.8...@react-navigation/bottom-tabs@5.11.9) (2021-04-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* check for screens enabled in ScreenContainer ([493956e](https://github.com/react-navigation/react-navigation/commit/493956ef717a03bd8c3533a2949434e83718c5e4))
|
||||||
|
* don't pass accessibilityState to link. closes [#9418](https://github.com/react-navigation/react-navigation/issues/9418) ([699ea0c](https://github.com/react-navigation/react-navigation/commit/699ea0cc5052f190acc7ce8bc0328bb052d7cf26))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.11.8](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.7...@react-navigation/bottom-tabs@5.11.8) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.11.7](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.6...@react-navigation/bottom-tabs@5.11.7) (2021-01-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix drawer screen content not being interactable on Android ([87b5147](https://github.com/react-navigation/react-navigation/commit/87b51476d0bce8f2dae793416c2976da30a1a5f7))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.11.6](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.5...@react-navigation/bottom-tabs@5.11.6) (2021-01-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix pointerEvents in ResourceSavingScene ([60fe0db](https://github.com/react-navigation/react-navigation/commit/60fe0dbb0ae443fdb21016d368c919b933cb64e7)), closes [#9241](https://github.com/react-navigation/react-navigation/issues/9241) [#9242](https://github.com/react-navigation/react-navigation/issues/9242)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.11.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.4...@react-navigation/bottom-tabs@5.11.5) (2021-01-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.11.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.3...@react-navigation/bottom-tabs@5.11.4) (2021-01-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix drawer and bottom tabs not being visible on web. closes [#9225](https://github.com/react-navigation/react-navigation/issues/9225) ([d88cbcb](https://github.com/react-navigation/react-navigation/commit/d88cbcb52d46de26edaa9ce6bfb06badb1b1de64))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.11.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.2...@react-navigation/bottom-tabs@5.11.3) (2021-01-14)
|
## [5.11.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/bottom-tabs@5.11.2...@react-navigation/bottom-tabs@5.11.3) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/bottom-tabs",
|
"name": "@react-navigation/bottom-tabs",
|
||||||
"description": "Bottom tab navigator following iOS design guidelines",
|
"description": "Bottom tab navigator following iOS design guidelines",
|
||||||
"version": "5.11.3",
|
"version": "5.11.9",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"react-native-iphone-x-helper": "^1.3.0"
|
"react-native-iphone-x-helper": "^1.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^5.9.0",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ export default function BottomTabBarItem({
|
|||||||
onPress,
|
onPress,
|
||||||
to,
|
to,
|
||||||
accessibilityRole,
|
accessibilityRole,
|
||||||
|
accessibilityState,
|
||||||
...rest
|
...rest
|
||||||
}: BottomTabBarButtonProps) => {
|
}: BottomTabBarButtonProps) => {
|
||||||
if (Platform.OS === 'web' && to) {
|
if (Platform.OS === 'web' && to) {
|
||||||
@@ -162,6 +163,7 @@ export default function BottomTabBarItem({
|
|||||||
<TouchableWithoutFeedback
|
<TouchableWithoutFeedback
|
||||||
{...rest}
|
{...rest}
|
||||||
accessibilityRole={accessibilityRole}
|
accessibilityRole={accessibilityRole}
|
||||||
|
accessibilityState={accessibilityState}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
>
|
>
|
||||||
<View style={style}>{children}</View>
|
<View style={style}>{children}</View>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
TabNavigationState,
|
TabNavigationState,
|
||||||
useTheme,
|
useTheme,
|
||||||
} from '@react-navigation/native';
|
} from '@react-navigation/native';
|
||||||
import { ScreenContainer } from 'react-native-screens';
|
import { ScreenContainer, screensEnabled } from 'react-native-screens';
|
||||||
|
|
||||||
import SafeAreaProviderCompat, {
|
import SafeAreaProviderCompat, {
|
||||||
initialSafeAreaInsets,
|
initialSafeAreaInsets,
|
||||||
@@ -138,55 +138,54 @@ export default class BottomTabView extends React.Component<Props, State> {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
const { routes } = state;
|
const { routes } = state;
|
||||||
const { loaded, tabBarHeight } = this.state;
|
const { loaded, tabBarHeight } = this.state;
|
||||||
|
const isScreensEnabled = screensEnabled?.() && detachInactiveScreens;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavigationHelpersContext.Provider value={navigation}>
|
<NavigationHelpersContext.Provider value={navigation}>
|
||||||
<SafeAreaProviderCompat>
|
<SafeAreaProviderCompat>
|
||||||
<View style={styles.container}>
|
<ScreenContainer
|
||||||
<ScreenContainer
|
// @ts-ignore
|
||||||
// @ts-ignore
|
enabled={isScreensEnabled}
|
||||||
enabled={detachInactiveScreens}
|
style={styles.container}
|
||||||
style={styles.pages}
|
>
|
||||||
>
|
{routes.map((route, index) => {
|
||||||
{routes.map((route, index) => {
|
const descriptor = descriptors[route.key];
|
||||||
const descriptor = descriptors[route.key];
|
const { unmountOnBlur } = descriptor.options;
|
||||||
const { unmountOnBlur } = descriptor.options;
|
const isFocused = state.index === index;
|
||||||
const isFocused = state.index === index;
|
|
||||||
|
|
||||||
if (unmountOnBlur && !isFocused) {
|
if (unmountOnBlur && !isFocused) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lazy && !loaded.includes(route.key) && !isFocused) {
|
if (lazy && !loaded.includes(route.key) && !isFocused) {
|
||||||
// Don't render a screen if we've never navigated to it
|
// Don't render a screen if we've never navigated to it
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ResourceSavingScene
|
<ResourceSavingScene
|
||||||
key={route.key}
|
key={route.key}
|
||||||
style={StyleSheet.absoluteFill}
|
style={StyleSheet.absoluteFill}
|
||||||
isVisible={isFocused}
|
isVisible={isFocused}
|
||||||
enabled={detachInactiveScreens}
|
enabled={isScreensEnabled}
|
||||||
|
>
|
||||||
|
<SceneContent
|
||||||
|
isFocused={isFocused}
|
||||||
|
style={sceneContainerStyle}
|
||||||
>
|
>
|
||||||
<SceneContent
|
<BottomTabBarHeightContext.Provider value={tabBarHeight}>
|
||||||
isFocused={isFocused}
|
{descriptor.render()}
|
||||||
style={sceneContainerStyle}
|
</BottomTabBarHeightContext.Provider>
|
||||||
>
|
</SceneContent>
|
||||||
<BottomTabBarHeightContext.Provider value={tabBarHeight}>
|
</ResourceSavingScene>
|
||||||
{descriptor.render()}
|
);
|
||||||
</BottomTabBarHeightContext.Provider>
|
})}
|
||||||
</SceneContent>
|
</ScreenContainer>
|
||||||
</ResourceSavingScene>
|
<BottomTabBarHeightCallbackContext.Provider
|
||||||
);
|
value={this.handleTabBarHeightChange}
|
||||||
})}
|
>
|
||||||
</ScreenContainer>
|
{this.renderTabBar()}
|
||||||
<BottomTabBarHeightCallbackContext.Provider
|
</BottomTabBarHeightCallbackContext.Provider>
|
||||||
value={this.handleTabBarHeightChange}
|
|
||||||
>
|
|
||||||
{this.renderTabBar()}
|
|
||||||
</BottomTabBarHeightCallbackContext.Provider>
|
|
||||||
</View>
|
|
||||||
</SafeAreaProviderCompat>
|
</SafeAreaProviderCompat>
|
||||||
</NavigationHelpersContext.Provider>
|
</NavigationHelpersContext.Provider>
|
||||||
);
|
);
|
||||||
@@ -198,9 +197,6 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
pages: {
|
|
||||||
flex: 1,
|
|
||||||
},
|
|
||||||
content: {
|
content: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,32 +41,39 @@ export default function ResourceSavingScene({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Platform.OS === 'web') {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
// @ts-expect-error: hidden exists on web, but not in React Native
|
||||||
|
hidden={!isVisible}
|
||||||
|
style={[
|
||||||
|
{ display: isVisible ? 'flex' : 'none' },
|
||||||
|
styles.container,
|
||||||
|
style,
|
||||||
|
]}
|
||||||
|
pointerEvents={isVisible ? 'auto' : 'none'}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
// @ts-expect-error: hidden exists on web, but not in React Native
|
style={[styles.container, style]}
|
||||||
hidden={!isVisible}
|
// box-none doesn't seem to work properly on Android
|
||||||
style={[
|
|
||||||
styles.container,
|
|
||||||
Platform.OS === 'web' ? { display: isVisible ? 'flex' : 'none' } : null,
|
|
||||||
style,
|
|
||||||
]}
|
|
||||||
collapsable={false}
|
|
||||||
removeClippedSubviews={
|
|
||||||
// On iOS, set removeClippedSubviews to true only when not focused
|
|
||||||
// This is an workaround for a bug where the clipped view never re-appears
|
|
||||||
Platform.OS === 'ios' ? !isVisible : true
|
|
||||||
}
|
|
||||||
pointerEvents={isVisible ? 'auto' : 'none'}
|
pointerEvents={isVisible ? 'auto' : 'none'}
|
||||||
{...rest}
|
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={
|
collapsable={false}
|
||||||
Platform.OS === 'web'
|
removeClippedSubviews={
|
||||||
? null
|
// On iOS, set removeClippedSubviews to true only when not focused
|
||||||
: isVisible
|
// This is an workaround for a bug where the clipped view never re-appears
|
||||||
? styles.attached
|
Platform.OS === 'ios' ? !isVisible : true
|
||||||
: styles.detached
|
|
||||||
}
|
}
|
||||||
|
pointerEvents={isVisible ? 'auto' : 'none'}
|
||||||
|
style={isVisible ? styles.attached : styles.detached}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -3,6 +3,38 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.3.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.14...@react-navigation/compat@5.3.15) (2021-04-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.14](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.13...@react-navigation/compat@5.3.14) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.13](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.12...@react-navigation/compat@5.3.13) (2021-01-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.12](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.11...@react-navigation/compat@5.3.12) (2021-01-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.3.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.10...@react-navigation/compat@5.3.11) (2021-01-14)
|
## [5.3.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/compat@5.3.10...@react-navigation/compat@5.3.11) (2021-01-14)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/compat
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/compat",
|
"name": "@react-navigation/compat",
|
||||||
"description": "Compatibility layer to write navigator definitions in static configuration format",
|
"description": "Compatibility layer to write navigator definitions in static configuration format",
|
||||||
"version": "5.3.11",
|
"version": "5.3.15",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^5.9.0",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"react": "~16.13.1",
|
"react": "~16.13.1",
|
||||||
"react-native-builder-bob": "^0.17.0",
|
"react-native-builder-bob": "^0.17.0",
|
||||||
|
|||||||
@@ -3,6 +3,33 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.15.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.15.2...@react-navigation/core@5.15.3) (2021-04-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* properly resolve initialRouteNames ([976178d](https://github.com/react-navigation/react-navigation/commit/976178d0986a90697931ab9cc2c297eb7938e28b))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.15.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.15.1...@react-navigation/core@5.15.2) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.15.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.15.0...@react-navigation/core@5.15.1) (2021-01-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.15.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.14.4...@react-navigation/core@5.15.0) (2021-01-14)
|
# [5.15.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/core@5.14.4...@react-navigation/core@5.15.0) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/core",
|
"name": "@react-navigation/core",
|
||||||
"description": "Core utilities for building navigators",
|
"description": "Core utilities for building navigators",
|
||||||
"version": "5.15.0",
|
"version": "5.15.3",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.7.0",
|
"@react-navigation/routers": "^5.7.2",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.15",
|
"nanoid": "^3.1.15",
|
||||||
"query-string": "^6.13.6",
|
"query-string": "^6.13.6",
|
||||||
|
|||||||
@@ -2821,3 +2821,117 @@ it("throws when using 'initialRouteName' or 'screens' with legacy config", () =>
|
|||||||
})
|
})
|
||||||
).toThrow('Found invalid keys in the configuration object.');
|
).toThrow('Found invalid keys in the configuration object.');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('correctly applies initialRouteName for config with similar route names', () => {
|
||||||
|
const path = '/weekly-earnings';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
screens: {
|
||||||
|
RootTabs: {
|
||||||
|
screens: {
|
||||||
|
HomeTab: {
|
||||||
|
screens: {
|
||||||
|
Home: '',
|
||||||
|
WeeklyEarnings: 'weekly-earnings',
|
||||||
|
EventDetails: 'event-details/:eventId',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
EarningsTab: {
|
||||||
|
initialRouteName: 'Earnings',
|
||||||
|
path: 'earnings',
|
||||||
|
screens: {
|
||||||
|
Earnings: '',
|
||||||
|
WeeklyEarnings: 'weekly-earnings',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'RootTabs',
|
||||||
|
state: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'HomeTab',
|
||||||
|
state: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'WeeklyEarnings',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getStateFromPath(path, config)).toEqual(state);
|
||||||
|
expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
||||||
|
state
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('correctly applies initialRouteName for config with similar route names v2', () => {
|
||||||
|
const path = '/earnings/weekly-earnings';
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
screens: {
|
||||||
|
RootTabs: {
|
||||||
|
screens: {
|
||||||
|
HomeTab: {
|
||||||
|
initialRouteName: 'Home',
|
||||||
|
screens: {
|
||||||
|
Home: '',
|
||||||
|
WeeklyEarnings: 'weekly-earnings',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
EarningsTab: {
|
||||||
|
initialRouteName: 'Earnings',
|
||||||
|
path: 'earnings',
|
||||||
|
screens: {
|
||||||
|
Earnings: '',
|
||||||
|
WeeklyEarnings: 'weekly-earnings',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const state = {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'RootTabs',
|
||||||
|
state: {
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'EarningsTab',
|
||||||
|
state: {
|
||||||
|
index: 1,
|
||||||
|
routes: [
|
||||||
|
{
|
||||||
|
name: 'Earnings',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'WeeklyEarnings',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(getStateFromPath(path, config)).toEqual(state);
|
||||||
|
expect(getStateFromPath(getPathFromState(state, config), config)).toEqual(
|
||||||
|
state
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ type RouteConfig = {
|
|||||||
|
|
||||||
type InitialRouteConfig = {
|
type InitialRouteConfig = {
|
||||||
initialRouteName: string;
|
initialRouteName: string;
|
||||||
connectedRoutes: string[];
|
parentScreens: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
type ResultState = PartialState<NavigationState> & {
|
type ResultState = PartialState<NavigationState> & {
|
||||||
@@ -70,7 +70,7 @@ export default function getStateFromPath(
|
|||||||
if (compatOptions?.initialRouteName) {
|
if (compatOptions?.initialRouteName) {
|
||||||
initialRoutes.push({
|
initialRoutes.push({
|
||||||
initialRouteName: compatOptions.initialRouteName,
|
initialRouteName: compatOptions.initialRouteName,
|
||||||
connectedRoutes: Object.keys(compatOptions.screens),
|
parentScreens: [],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,8 @@ export default function getStateFromPath(
|
|||||||
key,
|
key,
|
||||||
screens as PathConfigMap,
|
screens as PathConfigMap,
|
||||||
[],
|
[],
|
||||||
initialRoutes
|
initialRoutes,
|
||||||
|
[]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -368,12 +369,15 @@ const createNormalizedConfigs = (
|
|||||||
routeConfig: PathConfigMap,
|
routeConfig: PathConfigMap,
|
||||||
routeNames: string[] = [],
|
routeNames: string[] = [],
|
||||||
initials: InitialRouteConfig[],
|
initials: InitialRouteConfig[],
|
||||||
|
parentScreens: string[],
|
||||||
parentPattern?: string
|
parentPattern?: string
|
||||||
): RouteConfig[] => {
|
): RouteConfig[] => {
|
||||||
const configs: RouteConfig[] = [];
|
const configs: RouteConfig[] = [];
|
||||||
|
|
||||||
routeNames.push(screen);
|
routeNames.push(screen);
|
||||||
|
|
||||||
|
parentScreens.push(screen);
|
||||||
|
|
||||||
const config = routeConfig[screen];
|
const config = routeConfig[screen];
|
||||||
|
|
||||||
if (typeof config === 'string') {
|
if (typeof config === 'string') {
|
||||||
@@ -423,7 +427,7 @@ const createNormalizedConfigs = (
|
|||||||
if (config.initialRouteName) {
|
if (config.initialRouteName) {
|
||||||
initials.push({
|
initials.push({
|
||||||
initialRouteName: config.initialRouteName,
|
initialRouteName: config.initialRouteName,
|
||||||
connectedRoutes: Object.keys(config.screens),
|
parentScreens,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,6 +438,7 @@ const createNormalizedConfigs = (
|
|||||||
config.screens as PathConfigMap,
|
config.screens as PathConfigMap,
|
||||||
routeNames,
|
routeNames,
|
||||||
initials,
|
initials,
|
||||||
|
[...parentScreens],
|
||||||
pattern ?? parentPattern
|
pattern ?? parentPattern
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -506,13 +511,23 @@ const findParseConfigForRoute = (
|
|||||||
// Try to find an initial route connected with the one passed
|
// Try to find an initial route connected with the one passed
|
||||||
const findInitialRoute = (
|
const findInitialRoute = (
|
||||||
routeName: string,
|
routeName: string,
|
||||||
|
parentScreens: string[],
|
||||||
initialRoutes: InitialRouteConfig[]
|
initialRoutes: InitialRouteConfig[]
|
||||||
): string | undefined => {
|
): string | undefined => {
|
||||||
for (const config of initialRoutes) {
|
for (const config of initialRoutes) {
|
||||||
if (config.connectedRoutes.includes(routeName)) {
|
if (parentScreens.length === config.parentScreens.length) {
|
||||||
return config.initialRouteName === routeName
|
let sameParents = true;
|
||||||
? undefined
|
for (let i = 0; i < parentScreens.length; i++) {
|
||||||
: config.initialRouteName;
|
if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) {
|
||||||
|
sameParents = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sameParents) {
|
||||||
|
return routeName !== config.initialRouteName
|
||||||
|
? config.initialRouteName
|
||||||
|
: undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
@@ -556,7 +571,11 @@ const createNestedStateObject = (
|
|||||||
) => {
|
) => {
|
||||||
let state: InitialState;
|
let state: InitialState;
|
||||||
let route = routes.shift() as ParsedRoute;
|
let route = routes.shift() as ParsedRoute;
|
||||||
let initialRoute = findInitialRoute(route.name, initialRoutes);
|
const parentScreens: string[] = [];
|
||||||
|
|
||||||
|
let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
|
||||||
|
|
||||||
|
parentScreens.push(route.name);
|
||||||
|
|
||||||
state = createStateObject(initialRoute, route, routes.length === 0);
|
state = createStateObject(initialRoute, route, routes.length === 0);
|
||||||
|
|
||||||
@@ -564,7 +583,7 @@ const createNestedStateObject = (
|
|||||||
let nestedState = state;
|
let nestedState = state;
|
||||||
|
|
||||||
while ((route = routes.shift() as ParsedRoute)) {
|
while ((route = routes.shift() as ParsedRoute)) {
|
||||||
initialRoute = findInitialRoute(route.name, initialRoutes);
|
initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
|
||||||
|
|
||||||
const nestedStateIndex =
|
const nestedStateIndex =
|
||||||
nestedState.index || nestedState.routes.length - 1;
|
nestedState.index || nestedState.routes.length - 1;
|
||||||
@@ -579,6 +598,8 @@ const createNestedStateObject = (
|
|||||||
nestedState = nestedState.routes[nestedStateIndex]
|
nestedState = nestedState.routes[nestedStateIndex]
|
||||||
.state as InitialState;
|
.state as InitialState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parentScreens.push(route.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,30 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.1.22](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.21...@react-navigation/devtools@5.1.22) (2021-04-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.1.21](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.20...@react-navigation/devtools@5.1.21) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.1.20](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.19...@react-navigation/devtools@5.1.20) (2021-01-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.1.19](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.18...@react-navigation/devtools@5.1.19) (2021-01-14)
|
## [5.1.19](https://github.com/react-navigation/react-navigation/compare/@react-navigation/devtools@5.1.18...@react-navigation/devtools@5.1.19) (2021-01-14)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/devtools
|
**Note:** Version bump only for package @react-navigation/devtools
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/devtools",
|
"name": "@react-navigation/devtools",
|
||||||
"description": "Developer tools for React Navigation",
|
"description": "Developer tools for React Navigation",
|
||||||
"version": "5.1.19",
|
"version": "5.1.22",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^5.15.0",
|
"@react-navigation/core": "^5.15.3",
|
||||||
"deep-equal": "^2.0.4"
|
"deep-equal": "^2.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -3,6 +3,74 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.12.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.12.4...@react-navigation/drawer@5.12.5) (2021-04-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* check for screens enabled in ScreenContainer ([493956e](https://github.com/react-navigation/react-navigation/commit/493956ef717a03bd8c3533a2949434e83718c5e4))
|
||||||
|
* don't handle back button with permanent drawer ([a63f9da](https://github.com/react-navigation/react-navigation/commit/a63f9da8c1efe5d34567517ac2653608c6bbdeba))
|
||||||
|
* don't pass accessibilityState to link. closes [#9418](https://github.com/react-navigation/react-navigation/issues/9418) ([699ea0c](https://github.com/react-navigation/react-navigation/commit/699ea0cc5052f190acc7ce8bc0328bb052d7cf26))
|
||||||
|
* only handle back button in drawer when focused ([cceaa67](https://github.com/react-navigation/react-navigation/commit/cceaa6780d588b2a2ffa3a2039f65f9e60a33bf9))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.12.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.12.3...@react-navigation/drawer@5.12.4) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.12.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.12.2...@react-navigation/drawer@5.12.3) (2021-01-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix drawer screen content not being interactable on Android ([87b5147](https://github.com/react-navigation/react-navigation/commit/87b51476d0bce8f2dae793416c2976da30a1a5f7))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.12.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.12.1...@react-navigation/drawer@5.12.2) (2021-01-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix pointerEvents in ResourceSavingScene ([60fe0db](https://github.com/react-navigation/react-navigation/commit/60fe0dbb0ae443fdb21016d368c919b933cb64e7)), closes [#9241](https://github.com/react-navigation/react-navigation/issues/9241) [#9242](https://github.com/react-navigation/react-navigation/issues/9242)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.12.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.12.0...@react-navigation/drawer@5.12.1) (2021-01-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.12.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.11.5...@react-navigation/drawer@5.12.0) (2021-01-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix drawer and bottom tabs not being visible on web. closes [#9225](https://github.com/react-navigation/react-navigation/issues/9225) ([d88cbcb](https://github.com/react-navigation/react-navigation/commit/d88cbcb52d46de26edaa9ce6bfb06badb1b1de64))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add pressColor and pressOpacity props to drawerItem ([#8834](https://github.com/react-navigation/react-navigation/issues/8834)) ([bae4019](https://github.com/react-navigation/react-navigation/commit/bae4019995062c682f0213c121b7927ab8006c1e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.11.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.11.4...@react-navigation/drawer@5.11.5) (2021-01-14)
|
## [5.11.5](https://github.com/react-navigation/react-navigation/compare/@react-navigation/drawer@5.11.4...@react-navigation/drawer@5.11.5) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/drawer",
|
"name": "@react-navigation/drawer",
|
||||||
"description": "Drawer navigator component with animated transitions and gesturess",
|
"description": "Drawer navigator component with animated transitions and gesturess",
|
||||||
"version": "5.11.5",
|
"version": "5.12.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"react-native-iphone-x-helper": "^1.3.0"
|
"react-native-iphone-x-helper": "^1.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^5.9.0",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
|
|||||||
@@ -116,12 +116,6 @@ export default class DrawerView extends React.Component<Props> {
|
|||||||
statusBarAnimation: 'slide',
|
statusBarAnimation: 'slide',
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
if (Platform.OS === 'web') {
|
|
||||||
document?.body?.addEventListener?.('keyup', this.handleEscape);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate(prevProps: Props) {
|
componentDidUpdate(prevProps: Props) {
|
||||||
const {
|
const {
|
||||||
open,
|
open,
|
||||||
@@ -172,22 +166,8 @@ export default class DrawerView extends React.Component<Props> {
|
|||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.toggleStatusBar(false);
|
this.toggleStatusBar(false);
|
||||||
this.handleEndInteraction();
|
this.handleEndInteraction();
|
||||||
|
|
||||||
if (Platform.OS === 'web') {
|
|
||||||
document?.body?.removeEventListener?.('keyup', this.handleEscape);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleEscape = (e: KeyboardEvent) => {
|
|
||||||
const { open, onClose } = this.props;
|
|
||||||
|
|
||||||
if (e.key === 'Escape') {
|
|
||||||
if (open) {
|
|
||||||
onClose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private handleEndInteraction = () => {
|
private handleEndInteraction = () => {
|
||||||
if (this.interactionHandle !== undefined) {
|
if (this.interactionHandle !== undefined) {
|
||||||
InteractionManager.clearInteractionHandle(this.interactionHandle);
|
InteractionManager.clearInteractionHandle(this.interactionHandle);
|
||||||
|
|||||||
@@ -56,6 +56,20 @@ type Props = {
|
|||||||
* Background color for item when its inactive.
|
* Background color for item when its inactive.
|
||||||
*/
|
*/
|
||||||
inactiveBackgroundColor?: string;
|
inactiveBackgroundColor?: string;
|
||||||
|
/**
|
||||||
|
* Color of the touchable effect on press.
|
||||||
|
* Only supported on Android.
|
||||||
|
*
|
||||||
|
* @platform android
|
||||||
|
*/
|
||||||
|
pressColor?: string;
|
||||||
|
/**
|
||||||
|
* Opacity of the touchable effect on press.
|
||||||
|
* Only supported on iOS.
|
||||||
|
*
|
||||||
|
* @platform ios
|
||||||
|
*/
|
||||||
|
pressOpacity?: string;
|
||||||
/**
|
/**
|
||||||
* Style object for the label element.
|
* Style object for the label element.
|
||||||
*/
|
*/
|
||||||
@@ -72,6 +86,7 @@ const Touchable = ({
|
|||||||
onPress,
|
onPress,
|
||||||
to,
|
to,
|
||||||
accessibilityRole,
|
accessibilityRole,
|
||||||
|
accessibilityState,
|
||||||
delayPressIn,
|
delayPressIn,
|
||||||
...rest
|
...rest
|
||||||
}: TouchableWithoutFeedbackProps & {
|
}: TouchableWithoutFeedbackProps & {
|
||||||
@@ -105,6 +120,7 @@ const Touchable = ({
|
|||||||
<TouchableItem
|
<TouchableItem
|
||||||
{...rest}
|
{...rest}
|
||||||
accessibilityRole={accessibilityRole}
|
accessibilityRole={accessibilityRole}
|
||||||
|
accessibilityState={accessibilityState}
|
||||||
delayPressIn={delayPressIn}
|
delayPressIn={delayPressIn}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
>
|
>
|
||||||
@@ -132,6 +148,8 @@ export default function DrawerItem(props: Props) {
|
|||||||
inactiveBackgroundColor = 'transparent',
|
inactiveBackgroundColor = 'transparent',
|
||||||
style,
|
style,
|
||||||
onPress,
|
onPress,
|
||||||
|
pressColor,
|
||||||
|
pressOpacity,
|
||||||
...rest
|
...rest
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
@@ -159,6 +177,8 @@ export default function DrawerItem(props: Props) {
|
|||||||
accessibilityState={{ selected: focused }}
|
accessibilityState={{ selected: focused }}
|
||||||
// @ts-expect-error: keep for compatibility with older React Native versions
|
// @ts-expect-error: keep for compatibility with older React Native versions
|
||||||
accessibilityStates={focused ? ['selected'] : []}
|
accessibilityStates={focused ? ['selected'] : []}
|
||||||
|
pressColor={pressColor}
|
||||||
|
pressOpacity={pressOpacity}
|
||||||
to={to}
|
to={to}
|
||||||
>
|
>
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ import {
|
|||||||
I18nManager,
|
I18nManager,
|
||||||
Platform,
|
Platform,
|
||||||
BackHandler,
|
BackHandler,
|
||||||
NativeEventSubscription,
|
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { ScreenContainer } from 'react-native-screens';
|
import { ScreenContainer, screensEnabled } from 'react-native-screens';
|
||||||
import {
|
import {
|
||||||
NavigationHelpersContext,
|
NavigationHelpersContext,
|
||||||
NavigationContext,
|
NavigationContext,
|
||||||
@@ -112,29 +111,48 @@ export default function DrawerView({
|
|||||||
}, [navigation, state.key]);
|
}, [navigation, state.key]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (isDrawerOpen) {
|
if (!isDrawerOpen || drawerType === 'permanent') {
|
||||||
navigation.emit({ type: 'drawerOpen' });
|
return;
|
||||||
} else {
|
|
||||||
navigation.emit({ type: 'drawerClose' });
|
|
||||||
}
|
|
||||||
}, [isDrawerOpen, navigation]);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
let subscription: NativeEventSubscription | undefined;
|
|
||||||
|
|
||||||
if (isDrawerOpen) {
|
|
||||||
// We only add the subscription when drawer opens
|
|
||||||
// This way we can make sure that the subscription is added as late as possible
|
|
||||||
// This will make sure that our handler will run first when back button is pressed
|
|
||||||
subscription = BackHandler.addEventListener('hardwareBackPress', () => {
|
|
||||||
handleDrawerClose();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return () => subscription?.remove();
|
const handleClose = () => {
|
||||||
}, [handleDrawerClose, isDrawerOpen, navigation, state.key]);
|
// We shouldn't handle the back button if the parent screen isn't focused
|
||||||
|
// This will avoid the drawer overriding event listeners from a focused screen
|
||||||
|
if (!navigation.isFocused()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDrawerClose();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleEscape = (e: KeyboardEvent) => {
|
||||||
|
if (e.key === 'Escape') {
|
||||||
|
handleClose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// We only add the listeners when drawer opens
|
||||||
|
// This way we can make sure that the listener is added as late as possible
|
||||||
|
// This will make sure that our handler will run first when back button is pressed
|
||||||
|
const subscription = BackHandler.addEventListener(
|
||||||
|
'hardwareBackPress',
|
||||||
|
handleClose
|
||||||
|
);
|
||||||
|
|
||||||
|
if (Platform.OS === 'web') {
|
||||||
|
document?.body?.addEventListener?.('keyup', handleEscape);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
subscription.remove();
|
||||||
|
|
||||||
|
if (Platform.OS === 'web') {
|
||||||
|
document?.body?.removeEventListener?.('keyup', handleEscape);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}, [drawerType, handleDrawerClose, isDrawerOpen, navigation]);
|
||||||
|
|
||||||
const focusedRouteKey = state.routes[state.index].key;
|
const focusedRouteKey = state.routes[state.index].key;
|
||||||
|
|
||||||
@@ -157,9 +175,11 @@ export default function DrawerView({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const renderContent = () => {
|
const renderContent = () => {
|
||||||
|
const isScreensEnabled = screensEnabled?.() && detachInactiveScreens;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
<ScreenContainer enabled={detachInactiveScreens} style={styles.content}>
|
<ScreenContainer enabled={isScreensEnabled} style={styles.content}>
|
||||||
{state.routes.map((route, index) => {
|
{state.routes.map((route, index) => {
|
||||||
const descriptor = descriptors[route.key];
|
const descriptor = descriptors[route.key];
|
||||||
const { unmountOnBlur } = descriptor.options;
|
const { unmountOnBlur } = descriptor.options;
|
||||||
@@ -184,7 +204,7 @@ export default function DrawerView({
|
|||||||
key={route.key}
|
key={route.key}
|
||||||
style={[StyleSheet.absoluteFill, { opacity: isFocused ? 1 : 0 }]}
|
style={[StyleSheet.absoluteFill, { opacity: isFocused ? 1 : 0 }]}
|
||||||
isVisible={isFocused}
|
isVisible={isFocused}
|
||||||
enabled={detachInactiveScreens}
|
enabled={isScreensEnabled}
|
||||||
>
|
>
|
||||||
{headerShown ? (
|
{headerShown ? (
|
||||||
<NavigationContext.Provider value={descriptor.navigation}>
|
<NavigationContext.Provider value={descriptor.navigation}>
|
||||||
|
|||||||
@@ -41,34 +41,39 @@ export default function ResourceSavingScene({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Platform.OS === 'web') {
|
||||||
|
return (
|
||||||
|
<View
|
||||||
|
// @ts-expect-error: hidden exists on web, but not in React Native
|
||||||
|
hidden={!isVisible}
|
||||||
|
style={[
|
||||||
|
{ display: isVisible ? 'flex' : 'none' },
|
||||||
|
styles.container,
|
||||||
|
style,
|
||||||
|
]}
|
||||||
|
pointerEvents={isVisible ? 'auto' : 'none'}
|
||||||
|
{...rest}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
// @ts-expect-error: hidden exists on web, but not in React Native
|
style={[styles.container, style]}
|
||||||
hidden={!isVisible}
|
// box-none doesn't seem to work properly on Android
|
||||||
style={[
|
|
||||||
styles.container,
|
|
||||||
Platform.OS === 'web'
|
|
||||||
? { display: isVisible ? 'flex' : 'none' }
|
|
||||||
: { overflow: 'hidden' },
|
|
||||||
style,
|
|
||||||
]}
|
|
||||||
collapsable={false}
|
|
||||||
removeClippedSubviews={
|
|
||||||
// On iOS, set removeClippedSubviews to true only when not focused
|
|
||||||
// This is an workaround for a bug where the clipped view never re-appears
|
|
||||||
Platform.OS === 'ios' ? !isVisible : true
|
|
||||||
}
|
|
||||||
pointerEvents={isVisible ? 'auto' : 'none'}
|
pointerEvents={isVisible ? 'auto' : 'none'}
|
||||||
{...rest}
|
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={
|
collapsable={false}
|
||||||
Platform.OS === 'web'
|
removeClippedSubviews={
|
||||||
? null
|
// On iOS, set removeClippedSubviews to true only when not focused
|
||||||
: isVisible
|
// This is an workaround for a bug where the clipped view never re-appears
|
||||||
? styles.attached
|
Platform.OS === 'ios' ? !isVisible : true
|
||||||
: styles.detached
|
|
||||||
}
|
}
|
||||||
|
pointerEvents={isVisible ? 'auto' : 'none'}
|
||||||
|
style={isVisible ? styles.attached : styles.detached}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import { BaseButton } from 'react-native-gesture-handler';
|
|||||||
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
||||||
|
|
||||||
type Props = React.ComponentProps<typeof BaseButton> & {
|
type Props = React.ComponentProps<typeof BaseButton> & {
|
||||||
activeOpacity: number;
|
pressOpacity: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useNativeDriver = Platform.OS !== 'web';
|
const useNativeDriver = Platform.OS !== 'web';
|
||||||
|
|
||||||
export default class TouchableItem extends React.Component<Props> {
|
export default class TouchableItem extends React.Component<Props> {
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
activeOpacity: 0.3,
|
pressOpacity: 0.3,
|
||||||
borderless: true,
|
borderless: true,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
};
|
};
|
||||||
@@ -27,7 +27,7 @@ export default class TouchableItem extends React.Component<Props> {
|
|||||||
overshootClamping: true,
|
overshootClamping: true,
|
||||||
restDisplacementThreshold: 0.01,
|
restDisplacementThreshold: 0.01,
|
||||||
restSpeedThreshold: 0.01,
|
restSpeedThreshold: 0.01,
|
||||||
toValue: active ? this.props.activeOpacity : 1,
|
toValue: active ? this.props.pressOpacity : 1,
|
||||||
useNativeDriver,
|
useNativeDriver,
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,41 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.3.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.14...@react-navigation/material-bottom-tabs@5.3.15) (2021-04-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't pass accessibilityState to link. closes [#9418](https://github.com/react-navigation/react-navigation/issues/9418) ([699ea0c](https://github.com/react-navigation/react-navigation/commit/699ea0cc5052f190acc7ce8bc0328bb052d7cf26))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.14](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.13...@react-navigation/material-bottom-tabs@5.3.14) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.13](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.12...@react-navigation/material-bottom-tabs@5.3.13) (2021-01-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.12](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.11...@react-navigation/material-bottom-tabs@5.3.12) (2021-01-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.3.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.10...@react-navigation/material-bottom-tabs@5.3.11) (2021-01-14)
|
## [5.3.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-bottom-tabs@5.3.10...@react-navigation/material-bottom-tabs@5.3.11) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/material-bottom-tabs",
|
"name": "@react-navigation/material-bottom-tabs",
|
||||||
"description": "Integration for bottom navigation component from react-native-paper",
|
"description": "Integration for bottom navigation component from react-native-paper",
|
||||||
"version": "5.3.11",
|
"version": "5.3.15",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^5.9.0",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
|
|||||||
@@ -111,10 +111,13 @@ function MaterialBottomTabViewInner({
|
|||||||
? ({
|
? ({
|
||||||
onPress,
|
onPress,
|
||||||
route,
|
route,
|
||||||
accessibilityRole: _0,
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
borderless: _1,
|
accessibilityRole,
|
||||||
centered: _2,
|
accessibilityState,
|
||||||
rippleColor: _3,
|
borderless,
|
||||||
|
centered,
|
||||||
|
rippleColor,
|
||||||
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
||||||
style,
|
style,
|
||||||
...rest
|
...rest
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -3,6 +3,38 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.3.15](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.14...@react-navigation/material-top-tabs@5.3.15) (2021-04-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.14](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.13...@react-navigation/material-top-tabs@5.3.14) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.13](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.12...@react-navigation/material-top-tabs@5.3.13) (2021-01-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.3.12](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.11...@react-navigation/material-top-tabs@5.3.12) (2021-01-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [5.3.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.10...@react-navigation/material-top-tabs@5.3.11) (2021-01-14)
|
## [5.3.11](https://github.com/react-navigation/react-navigation/compare/@react-navigation/material-top-tabs@5.3.10...@react-navigation/material-top-tabs@5.3.11) (2021-01-14)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/material-top-tabs",
|
"name": "@react-navigation/material-top-tabs",
|
||||||
"description": "Integration for the animated tab view component from react-native-tab-view",
|
"description": "Integration for the animated tab view component from react-native-tab-view",
|
||||||
"version": "5.3.11",
|
"version": "5.3.15",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
"color": "^3.1.3"
|
"color": "^3.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-navigation/native": "^5.9.0",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
"@types/react-native": "^0.63.30",
|
"@types/react-native": "^0.63.30",
|
||||||
|
|||||||
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.9.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.9.3...@react-navigation/native@5.9.4) (2021-04-04)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.9.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.9.2...@react-navigation/native@5.9.3) (2021-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* address breaking change in react-native for Linking ([a8342aa](https://github.com/react-navigation/react-navigation/commit/a8342aaf3d1ba8fb29faa91c7b63ed25f11745e5))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.9.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.9.1...@react-navigation/native@5.9.2) (2021-01-22)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* normalize prefix when parsing. fixes [#9081](https://github.com/react-navigation/react-navigation/issues/9081) ([4ca2d2d](https://github.com/react-navigation/react-navigation/commit/4ca2d2d22bc9eccf87451b15c823174d98cbd0a2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.9.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.9.0...@react-navigation/native@5.9.1) (2021-01-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.9.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.10...@react-navigation/native@5.9.0) (2021-01-14)
|
# [5.9.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/native@5.8.10...@react-navigation/native@5.9.0) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/native",
|
"name": "@react-navigation/native",
|
||||||
"description": "React Native integration for React Navigation",
|
"description": "React Native integration for React Navigation",
|
||||||
"version": "5.9.0",
|
"version": "5.9.4",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation",
|
"react-navigation",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^5.15.0",
|
"@react-navigation/core": "^5.15.3",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"nanoid": "^3.1.15"
|
"nanoid": "^3.1.15"
|
||||||
},
|
},
|
||||||
|
|||||||
318
packages/native/src/__tests__/extractPathFromURL.test.tsx
Normal file
318
packages/native/src/__tests__/extractPathFromURL.test.tsx
Normal file
@@ -0,0 +1,318 @@
|
|||||||
|
import extractPathFromURL from '../extractPathFromURL';
|
||||||
|
|
||||||
|
it('extracts path from URL with protocol', () => {
|
||||||
|
expect(extractPathFromURL(['scheme://'], 'scheme://some/path')).toBe(
|
||||||
|
'some/path'
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme://'], 'scheme:some/path')).toBe(
|
||||||
|
'some/path'
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme://'], 'scheme:///some/path')).toBe(
|
||||||
|
'some/path'
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:///'], 'scheme:some/path')).toBe(
|
||||||
|
'some/path'
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:'], 'scheme:some/path')).toBe('some/path');
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:'], 'scheme://some/path')).toBe(
|
||||||
|
'some/path'
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:'], 'scheme:///some/path')).toBe(
|
||||||
|
'some/path'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('extracts path from URL with protocol and host', () => {
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://example.com'],
|
||||||
|
'scheme://example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme://example.com'], 'scheme:example.com/some/path')
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://example.com'],
|
||||||
|
'scheme:///example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:///example.com'],
|
||||||
|
'scheme:example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme:example.com'], 'scheme:example.com/some/path')
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme:example.com'], 'scheme://example.com/some/path')
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com'],
|
||||||
|
'scheme:///example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('extracts path from URL with protocol and host with wildcard', () => {
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://*.example.com'],
|
||||||
|
'scheme://test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://*.example.com'],
|
||||||
|
'scheme:test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://*.example.com'],
|
||||||
|
'scheme:///test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:///*.example.com'],
|
||||||
|
'scheme:test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:*.example.com'],
|
||||||
|
'scheme:test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:*.example.com'],
|
||||||
|
'scheme://test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:*.example.com'],
|
||||||
|
'scheme:///test.example.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('extracts path from URL with protocol, host and path', () => {
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://example.com/test'],
|
||||||
|
'scheme://example.com/test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme://example.com'], 'scheme:example.com/some/path')
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://example.com/test'],
|
||||||
|
'scheme:///example.com/test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:///example.com/test'],
|
||||||
|
'scheme:example.com/test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com/test'],
|
||||||
|
'scheme:example.com/test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com/test'],
|
||||||
|
'scheme://example.com/test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com/test'],
|
||||||
|
'scheme:///example.com/test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com/test'],
|
||||||
|
'scheme:///example.com//test/some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com/test'],
|
||||||
|
'scheme:///example.com/test//some/path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:example.com/test'],
|
||||||
|
'scheme:///example.com/test/some//path'
|
||||||
|
)
|
||||||
|
).toBe('/some/path');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined for non-matching protocol', () => {
|
||||||
|
expect(extractPathFromURL(['scheme://'], 'foo://some/path')).toBe(undefined);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme://'], 'foo:some/path')).toBe(undefined);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme://'], 'foo:///some/path')).toBe(undefined);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:///'], 'foo:some/path')).toBe(undefined);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:'], 'foo:some/path')).toBe(undefined);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:'], 'foo://some/path')).toBe(undefined);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:'], 'foo:///some/path')).toBe(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined for non-matching path', () => {
|
||||||
|
expect(extractPathFromURL(['scheme://foo'], 'scheme://some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme://foo'], 'scheme:some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme://foo'], 'scheme:///some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:///foo'], 'scheme:some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:foo'], 'scheme:some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:foo'], 'scheme://some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(extractPathFromURL(['scheme:foo'], 'scheme:///some/path')).toBe(
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined for non-matching host', () => {
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme://example.com'], 'scheme://foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme://example.com'], 'scheme:foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme://example.com'], 'scheme:///foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme:///example.com'], 'scheme:foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme:example.com'], 'scheme:foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme:example.com'], 'scheme://foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(['scheme:example.com'], 'scheme:///foo.com/some/path')
|
||||||
|
).toBe(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns undefined for non-matching host with wildcard', () => {
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://*.example.com'],
|
||||||
|
'scheme://test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://*.example.com'],
|
||||||
|
'scheme:test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme://*.example.com'],
|
||||||
|
'scheme:///test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:///*.example.com'],
|
||||||
|
'scheme:test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:*.example.com'],
|
||||||
|
'scheme:test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:*.example.com'],
|
||||||
|
'scheme://test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
extractPathFromURL(
|
||||||
|
['scheme:*.example.com'],
|
||||||
|
'scheme:///test.foo.com/some/path'
|
||||||
|
)
|
||||||
|
).toBe(undefined);
|
||||||
|
});
|
||||||
26
packages/native/src/extractPathFromURL.tsx
Normal file
26
packages/native/src/extractPathFromURL.tsx
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
import escapeStringRegexp from 'escape-string-regexp';
|
||||||
|
|
||||||
|
export default function extractPathFromURL(prefixes: string[], url: string) {
|
||||||
|
for (const prefix of prefixes) {
|
||||||
|
const protocol = prefix.match(/^[^:]+:/)?.[0] ?? '';
|
||||||
|
const host = prefix
|
||||||
|
.replace(new RegExp(`^${escapeStringRegexp(protocol)}`), '')
|
||||||
|
.replace(/\/+/g, '/') // Replace multiple slash (//) with single ones
|
||||||
|
.replace(/^\//, ''); // Remove extra leading slash
|
||||||
|
|
||||||
|
const prefixRegex = new RegExp(
|
||||||
|
`^${escapeStringRegexp(protocol)}(/)*${host
|
||||||
|
.split('.')
|
||||||
|
.map((it) => (it === '*' ? '[^/]+' : escapeStringRegexp(it)))
|
||||||
|
.join('\\.')}`
|
||||||
|
);
|
||||||
|
|
||||||
|
const normalizedURL = url.replace(/\/+/g, '/');
|
||||||
|
|
||||||
|
if (prefixRegex.test(normalizedURL)) {
|
||||||
|
return normalizedURL.replace(prefixRegex, '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
getStateFromPath as getStateFromPathDefault,
|
getStateFromPath as getStateFromPathDefault,
|
||||||
NavigationContainerRef,
|
NavigationContainerRef,
|
||||||
} from '@react-navigation/core';
|
} from '@react-navigation/core';
|
||||||
import escapeStringRegexp from 'escape-string-regexp';
|
import extractPathFromURL from './extractPathFromURL';
|
||||||
import type { LinkingOptions } from './types';
|
import type { LinkingOptions } from './types';
|
||||||
|
|
||||||
type ResultState = ReturnType<typeof getStateFromPathDefault>;
|
type ResultState = ReturnType<typeof getStateFromPathDefault>;
|
||||||
@@ -30,9 +30,18 @@ export default function useLinking(
|
|||||||
subscribe = (listener) => {
|
subscribe = (listener) => {
|
||||||
const callback = ({ url }: { url: string }) => listener(url);
|
const callback = ({ url }: { url: string }) => listener(url);
|
||||||
|
|
||||||
Linking.addEventListener('url', callback);
|
const subscription = Linking.addEventListener('url', callback) as
|
||||||
|
| { remove(): void }
|
||||||
|
| undefined;
|
||||||
|
|
||||||
return () => Linking.removeEventListener('url', callback);
|
return () => {
|
||||||
|
// https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7
|
||||||
|
if (subscription?.remove) {
|
||||||
|
subscription.remove();
|
||||||
|
} else {
|
||||||
|
Linking.removeEventListener('url', callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
getStateFromPath = getStateFromPathDefault,
|
getStateFromPath = getStateFromPathDefault,
|
||||||
getActionFromState = getActionFromStateDefault,
|
getActionFromState = getActionFromStateDefault,
|
||||||
@@ -80,24 +89,6 @@ export default function useLinking(
|
|||||||
getActionFromStateRef.current = getActionFromState;
|
getActionFromStateRef.current = getActionFromState;
|
||||||
});
|
});
|
||||||
|
|
||||||
const extractPathFromURL = React.useCallback((url: string) => {
|
|
||||||
for (const prefix of prefixesRef.current) {
|
|
||||||
const protocol = prefix.match(/^[^:]+:\/\//)?.[0] ?? '';
|
|
||||||
const host = prefix.replace(protocol, '');
|
|
||||||
const prefixRegex = new RegExp(
|
|
||||||
`^${escapeStringRegexp(protocol)}${host
|
|
||||||
.split('.')
|
|
||||||
.map((it) => (it === '*' ? '[^/]+' : escapeStringRegexp(it)))
|
|
||||||
.join('\\.')}`
|
|
||||||
);
|
|
||||||
if (prefixRegex.test(url)) {
|
|
||||||
return url.replace(prefixRegex, '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const getInitialState = React.useCallback(() => {
|
const getInitialState = React.useCallback(() => {
|
||||||
let state: ResultState | undefined;
|
let state: ResultState | undefined;
|
||||||
|
|
||||||
@@ -106,7 +97,9 @@ export default function useLinking(
|
|||||||
|
|
||||||
if (url != null && typeof url !== 'string') {
|
if (url != null && typeof url !== 'string') {
|
||||||
return url.then((url) => {
|
return url.then((url) => {
|
||||||
const path = url ? extractPathFromURL(url) : null;
|
const path = url
|
||||||
|
? extractPathFromURL(prefixesRef.current, url)
|
||||||
|
: null;
|
||||||
|
|
||||||
return path
|
return path
|
||||||
? getStateFromPathRef.current(path, configRef.current)
|
? getStateFromPathRef.current(path, configRef.current)
|
||||||
@@ -114,7 +107,7 @@ export default function useLinking(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = url ? extractPathFromURL(url) : null;
|
const path = url ? extractPathFromURL(prefixesRef.current, url) : null;
|
||||||
|
|
||||||
state = path
|
state = path
|
||||||
? getStateFromPathRef.current(path, configRef.current)
|
? getStateFromPathRef.current(path, configRef.current)
|
||||||
@@ -131,7 +124,7 @@ export default function useLinking(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return thenable as PromiseLike<ResultState | undefined>;
|
return thenable as PromiseLike<ResultState | undefined>;
|
||||||
}, [extractPathFromURL]);
|
}, []);
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const listener = (url: string) => {
|
const listener = (url: string) => {
|
||||||
@@ -139,7 +132,7 @@ export default function useLinking(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = extractPathFromURL(url);
|
const path = extractPathFromURL(prefixesRef.current, url);
|
||||||
const navigation = ref.current;
|
const navigation = ref.current;
|
||||||
|
|
||||||
if (navigation && path) {
|
if (navigation && path) {
|
||||||
@@ -182,7 +175,7 @@ export default function useLinking(
|
|||||||
};
|
};
|
||||||
|
|
||||||
return subscribe(listener);
|
return subscribe(listener);
|
||||||
}, [enabled, ref, subscribe, extractPathFromURL]);
|
}, [enabled, ref, subscribe]);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getInitialState,
|
getInitialState,
|
||||||
|
|||||||
@@ -3,6 +3,28 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.7.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.7.1...@react-navigation/routers@5.7.2) (2021-02-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix getId being called for incorrect routes. closes [#9343](https://github.com/react-navigation/react-navigation/issues/9343) ([3728390](https://github.com/react-navigation/react-navigation/commit/3728390b60814ba414bd15cc5b7e5b51baa1f026))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.7.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.7.0...@react-navigation/routers@5.7.1) (2021-01-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix StackRouter incorrectly handling invalid route if key is present ([d3a9639](https://github.com/react-navigation/react-navigation/commit/d3a9639060631b06551daf0eac191ec1a442e298))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.7.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.6.2...@react-navigation/routers@5.7.0) (2021-01-14)
|
# [5.7.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/routers@5.6.2...@react-navigation/routers@5.7.0) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/routers",
|
"name": "@react-navigation/routers",
|
||||||
"description": "Routers to help build custom navigators",
|
"description": "Routers to help build custom navigators",
|
||||||
"version": "5.7.0",
|
"version": "5.7.2",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react",
|
"react",
|
||||||
"react-native",
|
"react-native",
|
||||||
|
|||||||
@@ -270,7 +270,9 @@ export default function StackRouter(options: StackRouterOptions) {
|
|||||||
)
|
)
|
||||||
: id
|
: id
|
||||||
? state.routes.find(
|
? state.routes.find(
|
||||||
(route) => id === getId?.({ params: route.params })
|
(route) =>
|
||||||
|
route.name === action.payload.name &&
|
||||||
|
id === getId?.({ params: route.params })
|
||||||
)
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
@@ -349,10 +351,13 @@ export default function StackRouter(options: StackRouterOptions) {
|
|||||||
|
|
||||||
case 'NAVIGATE':
|
case 'NAVIGATE':
|
||||||
if (
|
if (
|
||||||
action.payload.key ||
|
action.payload.name !== undefined &&
|
||||||
(action.payload.name &&
|
!state.routeNames.includes(action.payload.name)
|
||||||
state.routeNames.includes(action.payload.name))
|
|
||||||
) {
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action.payload.key || action.payload.name) {
|
||||||
// If the route already exists, navigate to that
|
// If the route already exists, navigate to that
|
||||||
let index = -1;
|
let index = -1;
|
||||||
|
|
||||||
@@ -366,7 +371,9 @@ export default function StackRouter(options: StackRouterOptions) {
|
|||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
index = state.routes.findIndex(
|
index = state.routes.findIndex(
|
||||||
(route) => id === getId?.({ params: route.params })
|
(route) =>
|
||||||
|
route.name === action.payload.name &&
|
||||||
|
id === getId?.({ params: route.params })
|
||||||
);
|
);
|
||||||
} else if (
|
} else if (
|
||||||
(state.routes[state.index].name === action.payload.name &&
|
(state.routes[state.index].name === action.payload.name &&
|
||||||
|
|||||||
@@ -440,6 +440,55 @@ it('handles navigate action', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("doesn't navigate to nonexistent screen", () => {
|
||||||
|
const router = StackRouter({});
|
||||||
|
const options: RouterConfigOptions = {
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routeParamList: {},
|
||||||
|
routeGetIdList: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
CommonActions.navigate('far', { answer: 42 }),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
CommonActions.navigate({
|
||||||
|
name: 'far',
|
||||||
|
key: 'test',
|
||||||
|
params: { answer: 42 },
|
||||||
|
}),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
it('ensures unique ID for navigate', () => {
|
it('ensures unique ID for navigate', () => {
|
||||||
const router = StackRouter({});
|
const router = StackRouter({});
|
||||||
const options: RouterConfigOptions = {
|
const options: RouterConfigOptions = {
|
||||||
@@ -567,6 +616,48 @@ it('ensures unique ID for navigate', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('ensure unique ID is only per route name for navigate', () => {
|
||||||
|
const router = StackRouter({});
|
||||||
|
const options: RouterConfigOptions = {
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routeParamList: {},
|
||||||
|
routeGetIdList: {
|
||||||
|
baz: ({ params }) => params?.foo,
|
||||||
|
bar: ({ params }) => params?.foo,
|
||||||
|
qux: ({ params }) => params?.test,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { test: 'a' } },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { foo: 'a' } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
CommonActions.navigate('bar', { foo: 'a' }),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toEqual({
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 2,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { test: 'a' } },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { foo: 'a' } },
|
||||||
|
{ key: 'bar-test', name: 'bar', params: { foo: 'a' } },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('handles go back action', () => {
|
it('handles go back action', () => {
|
||||||
const router = StackRouter({});
|
const router = StackRouter({});
|
||||||
const options: RouterConfigOptions = {
|
const options: RouterConfigOptions = {
|
||||||
@@ -1045,6 +1136,58 @@ it('handles push action', () => {
|
|||||||
).toBe(null);
|
).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("doesn't push nonexistent screen", () => {
|
||||||
|
const router = StackRouter({});
|
||||||
|
const options: RouterConfigOptions = {
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routeParamList: {},
|
||||||
|
routeGetIdList: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
StackActions.push('far', { answer: 42 }),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'PUSH',
|
||||||
|
payload: {
|
||||||
|
name: 'far',
|
||||||
|
key: 'test',
|
||||||
|
params: { answer: 42 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
it('ensures unique ID for push', () => {
|
it('ensures unique ID for push', () => {
|
||||||
const router = StackRouter({});
|
const router = StackRouter({});
|
||||||
const options: RouterConfigOptions = {
|
const options: RouterConfigOptions = {
|
||||||
@@ -1206,6 +1349,48 @@ it('ensures unique ID for push', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('ensure unique ID is only per route name for push', () => {
|
||||||
|
const router = StackRouter({});
|
||||||
|
const options: RouterConfigOptions = {
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routeParamList: {},
|
||||||
|
routeGetIdList: {
|
||||||
|
baz: ({ params }) => params?.foo,
|
||||||
|
bar: ({ params }) => params?.foo,
|
||||||
|
qux: ({ params }) => params?.test,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { test: 'a' } },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { foo: 'a' } },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
StackActions.push('bar', { foo: 'a' }),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toEqual({
|
||||||
|
stale: false,
|
||||||
|
type: 'stack',
|
||||||
|
key: 'root',
|
||||||
|
index: 2,
|
||||||
|
routeNames: ['baz', 'bar', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { test: 'a' } },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { foo: 'a' } },
|
||||||
|
{ key: 'bar-test', name: 'bar', params: { foo: 'a' } },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('merges params on navigate to an existing screen', () => {
|
it('merges params on navigate to an existing screen', () => {
|
||||||
const router = StackRouter({});
|
const router = StackRouter({});
|
||||||
const options: RouterConfigOptions = {
|
const options: RouterConfigOptions = {
|
||||||
|
|||||||
@@ -708,6 +708,57 @@ it('handles navigate action', () => {
|
|||||||
).toBe(null);
|
).toBe(null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("doesn't navigate to nonexistent screen", () => {
|
||||||
|
const router = TabRouter({});
|
||||||
|
const options: RouterConfigOptions = {
|
||||||
|
routeNames: ['baz', 'bar'],
|
||||||
|
routeParamList: {},
|
||||||
|
routeGetIdList: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
history: [{ type: 'route', key: 'bar' }],
|
||||||
|
},
|
||||||
|
CommonActions.navigate('foo', { answer: 42 }),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
history: [{ type: 'route', key: 'bar' }],
|
||||||
|
},
|
||||||
|
CommonActions.navigate({
|
||||||
|
name: 'foo',
|
||||||
|
key: 'test',
|
||||||
|
params: { answer: 42 },
|
||||||
|
}),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
it('handles jump to action', () => {
|
it('handles jump to action', () => {
|
||||||
const router = TabRouter({});
|
const router = TabRouter({});
|
||||||
const options: RouterConfigOptions = {
|
const options: RouterConfigOptions = {
|
||||||
@@ -750,6 +801,34 @@ it('handles jump to action', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("doesn't jump to nonexistent screen", () => {
|
||||||
|
const router = TabRouter({});
|
||||||
|
const options: RouterConfigOptions = {
|
||||||
|
routeNames: ['baz', 'bar'],
|
||||||
|
routeParamList: {},
|
||||||
|
routeGetIdList: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForAction(
|
||||||
|
{
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
key: 'root',
|
||||||
|
index: 1,
|
||||||
|
routeNames: ['baz', 'bar'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'baz', name: 'baz' },
|
||||||
|
{ key: 'bar', name: 'bar' },
|
||||||
|
],
|
||||||
|
history: [{ type: 'route', key: 'bar' }],
|
||||||
|
},
|
||||||
|
TabActions.jumpTo('foo', { answer: 42 }),
|
||||||
|
options
|
||||||
|
)
|
||||||
|
).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
it('handles back action with backBehavior: history', () => {
|
it('handles back action with backBehavior: history', () => {
|
||||||
const router = TabRouter({ backBehavior: 'history' });
|
const router = TabRouter({ backBehavior: 'history' });
|
||||||
const options: RouterConfigOptions = {
|
const options: RouterConfigOptions = {
|
||||||
|
|||||||
@@ -3,6 +3,55 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [5.14.4](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.14.3...@react-navigation/stack@5.14.4) (2021-04-04)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* check for screens enabled in ScreenContainer ([493956e](https://github.com/react-navigation/react-navigation/commit/493956ef717a03bd8c3533a2949434e83718c5e4))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.14.3](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.14.2...@react-navigation/stack@5.14.3) (2021-02-21)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.14.2](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.14.1...@react-navigation/stack@5.14.2) (2021-01-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix transparent modal on web ([38d6808](https://github.com/react-navigation/react-navigation/commit/38d680833e31e62736da19f79328aec553ced814))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [5.14.1](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.14.0...@react-navigation/stack@5.14.1) (2021-01-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.14.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.13.0...@react-navigation/stack@5.14.0) (2021-01-21)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add pressColor and pressOpacity props to drawerItem ([#8834](https://github.com/react-navigation/react-navigation/issues/8834)) ([bae4019](https://github.com/react-navigation/react-navigation/commit/bae4019995062c682f0213c121b7927ab8006c1e))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.13.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.8...@react-navigation/stack@5.13.0) (2021-01-14)
|
# [5.13.0](https://github.com/react-navigation/react-navigation/compare/@react-navigation/stack@5.12.8...@react-navigation/stack@5.13.0) (2021-01-14)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/stack",
|
"name": "@react-navigation/stack",
|
||||||
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
|
||||||
"version": "5.13.0",
|
"version": "5.14.4",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native-component",
|
"react-native-component",
|
||||||
"react-component",
|
"react-component",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/masked-view": "^0.1.10",
|
"@react-native-community/masked-view": "^0.1.10",
|
||||||
"@react-navigation/native": "^5.9.0",
|
"@react-navigation/native": "^5.9.4",
|
||||||
"@testing-library/react-native": "^7.1.0",
|
"@testing-library/react-native": "^7.1.0",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.53",
|
"@types/react": "^16.9.53",
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { BaseButton } from 'react-native-gesture-handler';
|
|||||||
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
||||||
|
|
||||||
type Props = React.ComponentProps<typeof BaseButton> & {
|
type Props = React.ComponentProps<typeof BaseButton> & {
|
||||||
activeOpacity: number;
|
pressOpacity: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useNativeDriver = Platform.OS !== 'web';
|
const useNativeDriver = Platform.OS !== 'web';
|
||||||
@@ -27,7 +27,7 @@ export default class BorderlessButton extends React.Component<Props> {
|
|||||||
overshootClamping: true,
|
overshootClamping: true,
|
||||||
restDisplacementThreshold: 0.01,
|
restDisplacementThreshold: 0.01,
|
||||||
restSpeedThreshold: 0.01,
|
restSpeedThreshold: 0.01,
|
||||||
toValue: active ? this.props.activeOpacity : 1,
|
toValue: active ? this.props.pressOpacity : 1,
|
||||||
useNativeDriver,
|
useNativeDriver,
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import type {
|
|||||||
Route,
|
Route,
|
||||||
StackNavigationState,
|
StackNavigationState,
|
||||||
} from '@react-navigation/native';
|
} from '@react-navigation/native';
|
||||||
|
import { screensEnabled } from 'react-native-screens';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
MaybeScreenContainer,
|
MaybeScreenContainer,
|
||||||
@@ -489,11 +490,13 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
|
const isScreensEnabled = screensEnabled?.() && detachInactiveScreens;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{isFloatHeaderAbsolute ? null : floatingHeader}
|
{isFloatHeaderAbsolute ? null : floatingHeader}
|
||||||
<MaybeScreenContainer
|
<MaybeScreenContainer
|
||||||
enabled={detachInactiveScreens}
|
enabled={isScreensEnabled}
|
||||||
style={styles.container}
|
style={styles.container}
|
||||||
onLayout={this.handleLayout}
|
onLayout={this.handleLayout}
|
||||||
>
|
>
|
||||||
@@ -508,7 +511,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
// For the old implementation, it stays the same it was
|
// For the old implementation, it stays the same it was
|
||||||
let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;
|
let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;
|
||||||
|
|
||||||
if (shouldUseActivityState) {
|
if (shouldUseActivityState || Platform.OS === 'web') {
|
||||||
if (index < self.length - activeScreensLimit - 1) {
|
if (index < self.length - activeScreensLimit - 1) {
|
||||||
// screen should be inactive because it is too deep in the stack
|
// screen should be inactive because it is too deep in the stack
|
||||||
isScreenActive = STATE_INACTIVE;
|
isScreenActive = STATE_INACTIVE;
|
||||||
@@ -613,7 +616,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
<MaybeScreen
|
<MaybeScreen
|
||||||
key={route.key}
|
key={route.key}
|
||||||
style={StyleSheet.absoluteFill}
|
style={StyleSheet.absoluteFill}
|
||||||
enabled={detachInactiveScreens}
|
enabled={isScreensEnabled}
|
||||||
active={isScreenActive}
|
active={isScreenActive}
|
||||||
pointerEvents="box-none"
|
pointerEvents="box-none"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { BaseButton } from 'react-native-gesture-handler';
|
|||||||
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
|
||||||
|
|
||||||
type Props = React.ComponentProps<typeof BaseButton> & {
|
type Props = React.ComponentProps<typeof BaseButton> & {
|
||||||
activeOpacity: number;
|
pressOpacity: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
const useNativeDriver = Platform.OS !== 'web';
|
const useNativeDriver = Platform.OS !== 'web';
|
||||||
@@ -27,7 +27,7 @@ export default class TouchableItem extends React.Component<Props> {
|
|||||||
overshootClamping: true,
|
overshootClamping: true,
|
||||||
restDisplacementThreshold: 0.01,
|
restDisplacementThreshold: 0.01,
|
||||||
restSpeedThreshold: 0.01,
|
restSpeedThreshold: 0.01,
|
||||||
toValue: active ? this.props.activeOpacity : 1,
|
toValue: active ? this.props.pressOpacity : 1,
|
||||||
useNativeDriver,
|
useNativeDriver,
|
||||||
}).start();
|
}).start();
|
||||||
|
|
||||||
|
|||||||
78
yarn.lock
78
yarn.lock
@@ -6575,6 +6575,11 @@ commander@^5.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae"
|
||||||
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
|
integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==
|
||||||
|
|
||||||
|
commander@^6.1.0:
|
||||||
|
version "6.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
|
||||||
|
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
|
||||||
|
|
||||||
commander@~2.13.0:
|
commander@~2.13.0:
|
||||||
version "2.13.0"
|
version "2.13.0"
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||||
@@ -9014,7 +9019,7 @@ extglob@^2.0.4:
|
|||||||
snapdragon "^0.8.1"
|
snapdragon "^0.8.1"
|
||||||
to-regex "^3.0.1"
|
to-regex "^3.0.1"
|
||||||
|
|
||||||
extract-zip@^2.0.0:
|
extract-zip@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a"
|
resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-2.0.1.tgz#663dca56fe46df890d5f131ef4a06d22bb8ba13a"
|
||||||
integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==
|
integrity sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==
|
||||||
@@ -10523,14 +10528,6 @@ https-proxy-agent@^2.2.3:
|
|||||||
agent-base "^4.3.0"
|
agent-base "^4.3.0"
|
||||||
debug "^3.1.0"
|
debug "^3.1.0"
|
||||||
|
|
||||||
https-proxy-agent@^3.0.0:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz#b8c286433e87602311b01c8ea34413d856a4af81"
|
|
||||||
integrity sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg==
|
|
||||||
dependencies:
|
|
||||||
agent-base "^4.3.0"
|
|
||||||
debug "^3.1.0"
|
|
||||||
|
|
||||||
https-proxy-agent@^5.0.0:
|
https-proxy-agent@^5.0.0:
|
||||||
version "5.0.0"
|
version "5.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2"
|
resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz#e2a90542abb68a762e0a0850f6c9edadfd8506b2"
|
||||||
@@ -12043,11 +12040,16 @@ join-component@^1.1.0:
|
|||||||
resolved "https://registry.yarnpkg.com/join-component/-/join-component-1.1.0.tgz#b8417b750661a392bee2c2537c68b2a9d4977cd5"
|
resolved "https://registry.yarnpkg.com/join-component/-/join-component-1.1.0.tgz#b8417b750661a392bee2c2537c68b2a9d4977cd5"
|
||||||
integrity sha1-uEF7dQZho5K+4sJTfGiyqdSXfNU=
|
integrity sha1-uEF7dQZho5K+4sJTfGiyqdSXfNU=
|
||||||
|
|
||||||
jpeg-js@^0.3.4, jpeg-js@^0.3.7:
|
jpeg-js@^0.3.4:
|
||||||
version "0.3.7"
|
version "0.3.7"
|
||||||
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.7.tgz#471a89d06011640592d314158608690172b1028d"
|
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.3.7.tgz#471a89d06011640592d314158608690172b1028d"
|
||||||
integrity sha512-9IXdWudL61npZjvLuVe/ktHiA41iE8qFyLB+4VDTblEsWBzeg8WQTlktdUK4CdncUqtUgUg0bbOmTE2bKBKaBQ==
|
integrity sha512-9IXdWudL61npZjvLuVe/ktHiA41iE8qFyLB+4VDTblEsWBzeg8WQTlktdUK4CdncUqtUgUg0bbOmTE2bKBKaBQ==
|
||||||
|
|
||||||
|
jpeg-js@^0.4.2:
|
||||||
|
version "0.4.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/jpeg-js/-/jpeg-js-0.4.3.tgz#6158e09f1983ad773813704be80680550eff977b"
|
||||||
|
integrity sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==
|
||||||
|
|
||||||
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
|
"js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0:
|
||||||
version "4.0.0"
|
version "4.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
|
||||||
@@ -13507,6 +13509,11 @@ mime@^2.4.1, mime@^2.4.4:
|
|||||||
resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.6.tgz#e5b407c90db442f2beb5b162373d07b69affa4d1"
|
resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.6.tgz#e5b407c90db442f2beb5b162373d07b69affa4d1"
|
||||||
integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==
|
integrity sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==
|
||||||
|
|
||||||
|
mime@^2.4.6:
|
||||||
|
version "2.5.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/mime/-/mime-2.5.2.tgz#6e3dc6cc2b9510643830e5f19d5cb753da5eeabe"
|
||||||
|
integrity sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==
|
||||||
|
|
||||||
mimic-fn@^1.0.0:
|
mimic-fn@^1.0.0:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
|
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022"
|
||||||
@@ -15185,28 +15192,24 @@ pkg-up@^2.0.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
find-up "^2.1.0"
|
find-up "^2.1.0"
|
||||||
|
|
||||||
playwright-core@=0.14.0:
|
playwright@^1.9.1:
|
||||||
version "0.14.0"
|
version "1.9.1"
|
||||||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-0.14.0.tgz#2d3d7eb4ccbc7ef45e36ddcead4a638c1d2c1313"
|
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.9.1.tgz#b4db35f69076b2dc91e347e58d81f2f391d1ed49"
|
||||||
integrity sha512-RttBQ23zOFw6Dyke9WUKnkmLCuMovvW2JiOJ+M3in0SPo5rDASDqG8evBPW6w0Y2RyRKYFB0yhjn5LQG2qIayQ==
|
integrity sha512-bZXnks4UGJZoqja6TqVEUG0IQ2liqYFcO1R4lT43aO4oDVTQtawEJjS+EqLYsAuniRFWVE87Cemus4fRQbyXMg==
|
||||||
dependencies:
|
dependencies:
|
||||||
|
commander "^6.1.0"
|
||||||
debug "^4.1.1"
|
debug "^4.1.1"
|
||||||
extract-zip "^2.0.0"
|
extract-zip "^2.0.1"
|
||||||
https-proxy-agent "^3.0.0"
|
https-proxy-agent "^5.0.0"
|
||||||
jpeg-js "^0.3.7"
|
jpeg-js "^0.4.2"
|
||||||
mime "^2.4.4"
|
mime "^2.4.6"
|
||||||
pngjs "^5.0.0"
|
pngjs "^5.0.0"
|
||||||
progress "^2.0.3"
|
progress "^2.0.3"
|
||||||
|
proper-lockfile "^4.1.1"
|
||||||
proxy-from-env "^1.1.0"
|
proxy-from-env "^1.1.0"
|
||||||
rimraf "^3.0.2"
|
rimraf "^3.0.2"
|
||||||
ws "^6.1.0"
|
stack-utils "^2.0.3"
|
||||||
|
ws "^7.3.1"
|
||||||
playwright@^0.14.0:
|
|
||||||
version "0.14.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-0.14.0.tgz#82a6daf593b978597285cacdd6dfc87f5d4333fb"
|
|
||||||
integrity sha512-bdRnA4hvcEGVoDDnIuyF1Oa4P+Z0GVCQGXFA70L4CX9XhL79K4ib75RFZ5xLpFtuD+cZiLoBgTkrSpel7HX8xw==
|
|
||||||
dependencies:
|
|
||||||
playwright-core "=0.14.0"
|
|
||||||
|
|
||||||
please-upgrade-node@^3.2.0:
|
please-upgrade-node@^3.2.0:
|
||||||
version "3.2.0"
|
version "3.2.0"
|
||||||
@@ -15797,6 +15800,15 @@ prop-types@^15.6.0, prop-types@^15.6.2, prop-types@^15.7.2:
|
|||||||
object-assign "^4.1.1"
|
object-assign "^4.1.1"
|
||||||
react-is "^16.8.1"
|
react-is "^16.8.1"
|
||||||
|
|
||||||
|
proper-lockfile@^4.1.1:
|
||||||
|
version "4.1.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/proper-lockfile/-/proper-lockfile-4.1.2.tgz#c8b9de2af6b2f1601067f98e01ac66baa223141f"
|
||||||
|
integrity sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==
|
||||||
|
dependencies:
|
||||||
|
graceful-fs "^4.2.4"
|
||||||
|
retry "^0.12.0"
|
||||||
|
signal-exit "^3.0.2"
|
||||||
|
|
||||||
proto-list@~1.2.1:
|
proto-list@~1.2.1:
|
||||||
version "1.2.4"
|
version "1.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
|
resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849"
|
||||||
@@ -17700,6 +17712,13 @@ stack-utils@^2.0.2:
|
|||||||
dependencies:
|
dependencies:
|
||||||
escape-string-regexp "^2.0.0"
|
escape-string-regexp "^2.0.0"
|
||||||
|
|
||||||
|
stack-utils@^2.0.3:
|
||||||
|
version "2.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.3.tgz#cd5f030126ff116b78ccb3c027fe302713b61277"
|
||||||
|
integrity sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw==
|
||||||
|
dependencies:
|
||||||
|
escape-string-regexp "^2.0.0"
|
||||||
|
|
||||||
stackframe@^1.1.1:
|
stackframe@^1.1.1:
|
||||||
version "1.2.0"
|
version "1.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.2.0.tgz#52429492d63c62eb989804c11552e3d22e779303"
|
resolved "https://registry.yarnpkg.com/stackframe/-/stackframe-1.2.0.tgz#52429492d63c62eb989804c11552e3d22e779303"
|
||||||
@@ -19841,7 +19860,7 @@ ws@^3.0.0:
|
|||||||
safe-buffer "~5.1.0"
|
safe-buffer "~5.1.0"
|
||||||
ultron "~1.1.0"
|
ultron "~1.1.0"
|
||||||
|
|
||||||
ws@^6.1.0, ws@^6.2.1:
|
ws@^6.2.1:
|
||||||
version "6.2.1"
|
version "6.2.1"
|
||||||
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
|
resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb"
|
||||||
integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==
|
integrity sha512-GIyAXC2cB7LjvpgMt9EKS2ldqr0MTrORaleiOno6TweZ6r3TKtoFQWay/2PceJ3RuBasOHzXNn5Lrw1X0bEjqA==
|
||||||
@@ -19853,6 +19872,11 @@ ws@^7, ws@^7.2.3:
|
|||||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8"
|
resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8"
|
||||||
integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==
|
integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==
|
||||||
|
|
||||||
|
ws@^7.3.1:
|
||||||
|
version "7.4.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.3.tgz#1f9643de34a543b8edb124bdcbc457ae55a6e5cd"
|
||||||
|
integrity sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==
|
||||||
|
|
||||||
xcode@^2.0.0, xcode@^2.1.0:
|
xcode@^2.0.0, xcode@^2.1.0:
|
||||||
version "2.1.0"
|
version "2.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/xcode/-/xcode-2.1.0.tgz#bab64a7e954bb50ca8d19da7e09531c65a43ecfe"
|
resolved "https://registry.yarnpkg.com/xcode/-/xcode-2.1.0.tgz#bab64a7e954bb50ca8d19da7e09531c65a43ecfe"
|
||||||
|
|||||||
Reference in New Issue
Block a user