Compare commits

...

15 Commits

Author SHA1 Message Date
Satyajit Sahoo
7b353a4aea chore: publish
- @react-navigation/bottom-tabs@5.11.8
 - @react-navigation/compat@5.3.14
 - @react-navigation/core@5.15.2
 - @react-navigation/devtools@5.1.21
 - @react-navigation/drawer@5.12.4
 - @react-navigation/material-bottom-tabs@5.3.14
 - @react-navigation/material-top-tabs@5.3.14
 - @react-navigation/native@5.9.3
 - @react-navigation/routers@5.7.2
 - @react-navigation/stack@5.14.3
2021-02-21 16:09:01 +01:00
Satyajit Sahoo
3728390b60 fix: fix getId being called for incorrect routes. closes #9343 2021-02-21 15:55:03 +01:00
Satyajit Sahoo
a8342aaf3d fix: address breaking change in react-native for Linking 2021-02-21 15:49:58 +01:00
Satyajit Sahoo
860adbfd8b chore: publish
- @react-navigation/stack@5.14.2
2021-01-25 17:14:53 +01:00
Satyajit Sahoo
38d680833e fix: fix transparent modal on web 2021-01-25 17:13:24 +01:00
Satyajit Sahoo
cae115fc17 chore: publish
- @react-navigation/bottom-tabs@5.11.7
 - @react-navigation/drawer@5.12.3
2021-01-25 14:09:32 +01:00
Satyajit Sahoo
87b51476d0 fix: fix drawer screen content not being interactable on Android 2021-01-25 14:07:28 +01:00
Satyajit Sahoo
b1b211855f chore: publish
- @react-navigation/bottom-tabs@5.11.6
 - @react-navigation/drawer@5.12.2
2021-01-22 23:18:38 +01:00
Satyajit Sahoo
60fe0dbb0a fix: fix pointerEvents in ResourceSavingScene
fixes #9241, fixes #9242
2021-01-22 23:17:34 +01:00
Satyajit Sahoo
bb294b16f9 chore: publish
- @react-navigation/bottom-tabs@5.11.5
 - @react-navigation/compat@5.3.13
 - @react-navigation/drawer@5.12.1
 - @react-navigation/material-bottom-tabs@5.3.13
 - @react-navigation/material-top-tabs@5.3.13
 - @react-navigation/native@5.9.2
 - @react-navigation/stack@5.14.1
2021-01-22 13:45:06 +01:00
Satyajit Sahoo
4ca2d2d22b fix: normalize prefix when parsing. fixes #9081 2021-01-22 13:43:49 +01:00
Satyajit Sahoo
35747a6066 chore: publish
- @react-navigation/bottom-tabs@5.11.4
 - @react-navigation/compat@5.3.12
 - @react-navigation/core@5.15.1
 - @react-navigation/devtools@5.1.20
 - @react-navigation/drawer@5.12.0
 - @react-navigation/material-bottom-tabs@5.3.12
 - @react-navigation/material-top-tabs@5.3.12
 - @react-navigation/native@5.9.1
 - @react-navigation/routers@5.7.1
 - @react-navigation/stack@5.14.0
2021-01-21 20:55:27 +01:00
Petra Daneva
bae4019995 feat: add pressColor and pressOpacity props to drawerItem (#8834)
Co-authored-by: Petra Daneva <p.daneva@dineout.bg>
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
2021-01-21 20:48:21 +01:00
sharifhh
d3a9639060 fix: fix StackRouter incorrectly handling invalid route if key is present 2021-01-21 20:38:19 +01:00
Satyajit Sahoo
d88cbcb52d fix: fix drawer and bottom tabs not being visible on web. closes #9225 2021-01-21 20:05:28 +01:00
34 changed files with 1074 additions and 144 deletions

View File

@@ -3,6 +3,55 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/bottom-tabs",
"description": "Bottom tab navigator following iOS design guidelines",
"version": "5.11.3",
"version": "5.11.8",
"keywords": [
"react-native-component",
"react-component",
@@ -40,7 +40,7 @@
"react-native-iphone-x-helper": "^1.3.0"
},
"devDependencies": {
"@react-navigation/native": "^5.9.0",
"@react-navigation/native": "^5.9.3",
"@testing-library/react-native": "^7.1.0",
"@types/color": "^3.0.1",
"@types/react": "^16.9.53",

View File

@@ -142,51 +142,49 @@ export default class BottomTabView extends React.Component<Props, State> {
return (
<NavigationHelpersContext.Provider value={navigation}>
<SafeAreaProviderCompat>
<View style={styles.container}>
<ScreenContainer
// @ts-ignore
enabled={detachInactiveScreens}
style={styles.pages}
>
{routes.map((route, index) => {
const descriptor = descriptors[route.key];
const { unmountOnBlur } = descriptor.options;
const isFocused = state.index === index;
<ScreenContainer
// @ts-ignore
enabled={detachInactiveScreens}
style={styles.container}
>
{routes.map((route, index) => {
const descriptor = descriptors[route.key];
const { unmountOnBlur } = descriptor.options;
const isFocused = state.index === index;
if (unmountOnBlur && !isFocused) {
return null;
}
if (unmountOnBlur && !isFocused) {
return null;
}
if (lazy && !loaded.includes(route.key) && !isFocused) {
// Don't render a screen if we've never navigated to it
return null;
}
if (lazy && !loaded.includes(route.key) && !isFocused) {
// Don't render a screen if we've never navigated to it
return null;
}
return (
<ResourceSavingScene
key={route.key}
style={StyleSheet.absoluteFill}
isVisible={isFocused}
enabled={detachInactiveScreens}
return (
<ResourceSavingScene
key={route.key}
style={StyleSheet.absoluteFill}
isVisible={isFocused}
enabled={detachInactiveScreens}
>
<SceneContent
isFocused={isFocused}
style={sceneContainerStyle}
>
<SceneContent
isFocused={isFocused}
style={sceneContainerStyle}
>
<BottomTabBarHeightContext.Provider value={tabBarHeight}>
{descriptor.render()}
</BottomTabBarHeightContext.Provider>
</SceneContent>
</ResourceSavingScene>
);
})}
</ScreenContainer>
<BottomTabBarHeightCallbackContext.Provider
value={this.handleTabBarHeightChange}
>
{this.renderTabBar()}
</BottomTabBarHeightCallbackContext.Provider>
</View>
<BottomTabBarHeightContext.Provider value={tabBarHeight}>
{descriptor.render()}
</BottomTabBarHeightContext.Provider>
</SceneContent>
</ResourceSavingScene>
);
})}
</ScreenContainer>
<BottomTabBarHeightCallbackContext.Provider
value={this.handleTabBarHeightChange}
>
{this.renderTabBar()}
</BottomTabBarHeightCallbackContext.Provider>
</SafeAreaProviderCompat>
</NavigationHelpersContext.Provider>
);
@@ -198,9 +196,6 @@ const styles = StyleSheet.create({
flex: 1,
overflow: 'hidden',
},
pages: {
flex: 1,
},
content: {
flex: 1,
},

View File

@@ -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 (
<View
// @ts-expect-error: hidden exists on web, but not in React Native
hidden={!isVisible}
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
}
style={[styles.container, style]}
// box-none doesn't seem to work properly on Android
pointerEvents={isVisible ? 'auto' : 'none'}
{...rest}
>
<View
style={
Platform.OS === 'web'
? null
: isVisible
? styles.attached
: styles.detached
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'}
style={isVisible ? styles.attached : styles.detached}
>
{children}
</View>

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)
**Note:** Version bump only for package @react-navigation/compat

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/compat",
"description": "Compatibility layer to write navigator definitions in static configuration format",
"version": "5.3.11",
"version": "5.3.14",
"license": "MIT",
"repository": {
"type": "git",
@@ -31,7 +31,7 @@
"clean": "del lib"
},
"devDependencies": {
"@react-navigation/native": "^5.9.0",
"@react-navigation/native": "^5.9.3",
"@types/react": "^16.9.53",
"react": "~16.13.1",
"react-native-builder-bob": "^0.17.0",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/core",
"description": "Core utilities for building navigators",
"version": "5.15.0",
"version": "5.15.2",
"keywords": [
"react",
"react-native",
@@ -35,7 +35,7 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/routers": "^5.7.0",
"@react-navigation/routers": "^5.7.2",
"escape-string-regexp": "^4.0.0",
"nanoid": "^3.1.15",
"query-string": "^6.13.6",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)
**Note:** Version bump only for package @react-navigation/devtools

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/devtools",
"description": "Developer tools for React Navigation",
"version": "5.1.19",
"version": "5.1.21",
"keywords": [
"react",
"react-native",
@@ -36,7 +36,7 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/core": "^5.15.0",
"@react-navigation/core": "^5.15.2",
"deep-equal": "^2.0.4"
},
"devDependencies": {

View File

@@ -3,6 +3,60 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/drawer",
"description": "Drawer navigator component with animated transitions and gesturess",
"version": "5.11.5",
"version": "5.12.4",
"keywords": [
"react-native-component",
"react-component",
@@ -45,7 +45,7 @@
"react-native-iphone-x-helper": "^1.3.0"
},
"devDependencies": {
"@react-navigation/native": "^5.9.0",
"@react-navigation/native": "^5.9.3",
"@testing-library/react-native": "^7.1.0",
"@types/react": "^16.9.53",
"@types/react-native": "^0.63.30",

View File

@@ -56,6 +56,20 @@ type Props = {
* Background color for item when its inactive.
*/
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.
*/
@@ -132,6 +146,8 @@ export default function DrawerItem(props: Props) {
inactiveBackgroundColor = 'transparent',
style,
onPress,
pressColor,
pressOpacity,
...rest
} = props;
@@ -159,6 +175,8 @@ export default function DrawerItem(props: Props) {
accessibilityState={{ selected: focused }}
// @ts-expect-error: keep for compatibility with older React Native versions
accessibilityStates={focused ? ['selected'] : []}
pressColor={pressColor}
pressOpacity={pressOpacity}
to={to}
>
<React.Fragment>

View File

@@ -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 (
<View
// @ts-expect-error: hidden exists on web, but not in React Native
hidden={!isVisible}
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
}
style={[styles.container, style]}
// box-none doesn't seem to work properly on Android
pointerEvents={isVisible ? 'auto' : 'none'}
{...rest}
>
<View
style={
Platform.OS === 'web'
? null
: isVisible
? styles.attached
: styles.detached
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'}
style={isVisible ? styles.attached : styles.detached}
>
{children}
</View>

View File

@@ -5,14 +5,14 @@ import { BaseButton } from 'react-native-gesture-handler';
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
type Props = React.ComponentProps<typeof BaseButton> & {
activeOpacity: number;
pressOpacity: number;
};
const useNativeDriver = Platform.OS !== 'web';
export default class TouchableItem extends React.Component<Props> {
static defaultProps = {
activeOpacity: 0.3,
pressOpacity: 0.3,
borderless: true,
enabled: true,
};
@@ -27,7 +27,7 @@ export default class TouchableItem extends React.Component<Props> {
overshootClamping: true,
restDisplacementThreshold: 0.01,
restSpeedThreshold: 0.01,
toValue: active ? this.props.activeOpacity : 1,
toValue: active ? this.props.pressOpacity : 1,
useNativeDriver,
}).start();

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/material-bottom-tabs",
"description": "Integration for bottom navigation component from react-native-paper",
"version": "5.3.11",
"version": "5.3.14",
"keywords": [
"react-native-component",
"react-component",
@@ -41,7 +41,7 @@
"clean": "del lib"
},
"devDependencies": {
"@react-navigation/native": "^5.9.0",
"@react-navigation/native": "^5.9.3",
"@testing-library/react-native": "^7.1.0",
"@types/react": "^16.9.53",
"@types/react-native": "^0.63.30",

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)
**Note:** Version bump only for package @react-navigation/material-top-tabs

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/material-top-tabs",
"description": "Integration for the animated tab view component from react-native-tab-view",
"version": "5.3.11",
"version": "5.3.14",
"keywords": [
"react-native-component",
"react-component",
@@ -44,7 +44,7 @@
"color": "^3.1.3"
},
"devDependencies": {
"@react-navigation/native": "^5.9.0",
"@react-navigation/native": "^5.9.3",
"@testing-library/react-native": "^7.1.0",
"@types/react": "^16.9.53",
"@types/react-native": "^0.63.30",

View File

@@ -3,6 +3,36 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/native",
"description": "React Native integration for React Navigation",
"version": "5.9.0",
"version": "5.9.3",
"keywords": [
"react-native",
"react-navigation",
@@ -37,7 +37,7 @@
"clean": "del lib"
},
"dependencies": {
"@react-navigation/core": "^5.15.0",
"@react-navigation/core": "^5.15.2",
"escape-string-regexp": "^4.0.0",
"nanoid": "^3.1.15"
},

View 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);
});

View 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;
}

View File

@@ -5,7 +5,7 @@ import {
getStateFromPath as getStateFromPathDefault,
NavigationContainerRef,
} from '@react-navigation/core';
import escapeStringRegexp from 'escape-string-regexp';
import extractPathFromURL from './extractPathFromURL';
import type { LinkingOptions } from './types';
type ResultState = ReturnType<typeof getStateFromPathDefault>;
@@ -30,9 +30,18 @@ export default function useLinking(
subscribe = (listener) => {
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,
getActionFromState = getActionFromStateDefault,
@@ -80,24 +89,6 @@ export default function useLinking(
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(() => {
let state: ResultState | undefined;
@@ -106,7 +97,9 @@ export default function useLinking(
if (url != null && typeof url !== 'string') {
return url.then((url) => {
const path = url ? extractPathFromURL(url) : null;
const path = url
? extractPathFromURL(prefixesRef.current, url)
: null;
return path
? 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
? getStateFromPathRef.current(path, configRef.current)
@@ -131,7 +124,7 @@ export default function useLinking(
};
return thenable as PromiseLike<ResultState | undefined>;
}, [extractPathFromURL]);
}, []);
React.useEffect(() => {
const listener = (url: string) => {
@@ -139,7 +132,7 @@ export default function useLinking(
return;
}
const path = extractPathFromURL(url);
const path = extractPathFromURL(prefixesRef.current, url);
const navigation = ref.current;
if (navigation && path) {
@@ -182,7 +175,7 @@ export default function useLinking(
};
return subscribe(listener);
}, [enabled, ref, subscribe, extractPathFromURL]);
}, [enabled, ref, subscribe]);
return {
getInitialState,

View File

@@ -3,6 +3,28 @@
All notable changes to this project will be documented in this file.
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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/routers",
"description": "Routers to help build custom navigators",
"version": "5.7.0",
"version": "5.7.2",
"keywords": [
"react",
"react-native",

View File

@@ -270,7 +270,9 @@ export default function StackRouter(options: StackRouterOptions) {
)
: id
? state.routes.find(
(route) => id === getId?.({ params: route.params })
(route) =>
route.name === action.payload.name &&
id === getId?.({ params: route.params })
)
: undefined;
@@ -349,10 +351,13 @@ export default function StackRouter(options: StackRouterOptions) {
case 'NAVIGATE':
if (
action.payload.key ||
(action.payload.name &&
state.routeNames.includes(action.payload.name))
action.payload.name !== undefined &&
!state.routeNames.includes(action.payload.name)
) {
return null;
}
if (action.payload.key || action.payload.name) {
// If the route already exists, navigate to that
let index = -1;
@@ -366,7 +371,9 @@ export default function StackRouter(options: StackRouterOptions) {
if (id) {
index = state.routes.findIndex(
(route) => id === getId?.({ params: route.params })
(route) =>
route.name === action.payload.name &&
id === getId?.({ params: route.params })
);
} else if (
(state.routes[state.index].name === action.payload.name &&

View File

@@ -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', () => {
const router = StackRouter({});
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', () => {
const router = StackRouter({});
const options: RouterConfigOptions = {
@@ -1045,6 +1136,58 @@ it('handles push action', () => {
).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', () => {
const router = StackRouter({});
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', () => {
const router = StackRouter({});
const options: RouterConfigOptions = {

View File

@@ -708,6 +708,57 @@ it('handles navigate action', () => {
).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', () => {
const router = TabRouter({});
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', () => {
const router = TabRouter({ backBehavior: 'history' });
const options: RouterConfigOptions = {

View File

@@ -3,6 +3,44 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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)

View File

@@ -1,7 +1,7 @@
{
"name": "@react-navigation/stack",
"description": "Stack navigator component for iOS and Android with animated transitions and gestures",
"version": "5.13.0",
"version": "5.14.3",
"keywords": [
"react-native-component",
"react-component",
@@ -45,7 +45,7 @@
},
"devDependencies": {
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.9.0",
"@react-navigation/native": "^5.9.3",
"@testing-library/react-native": "^7.1.0",
"@types/color": "^3.0.1",
"@types/react": "^16.9.53",

View File

@@ -5,7 +5,7 @@ import { BaseButton } from 'react-native-gesture-handler';
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
type Props = React.ComponentProps<typeof BaseButton> & {
activeOpacity: number;
pressOpacity: number;
};
const useNativeDriver = Platform.OS !== 'web';
@@ -27,7 +27,7 @@ export default class BorderlessButton extends React.Component<Props> {
overshootClamping: true,
restDisplacementThreshold: 0.01,
restSpeedThreshold: 0.01,
toValue: active ? this.props.activeOpacity : 1,
toValue: active ? this.props.pressOpacity : 1,
useNativeDriver,
}).start();
}

View File

@@ -508,7 +508,7 @@ export default class CardStack extends React.Component<Props, State> {
// For the old implementation, it stays the same it was
let isScreenActive: Animated.AnimatedInterpolation | 2 | 1 | 0 = 1;
if (shouldUseActivityState) {
if (shouldUseActivityState || Platform.OS === 'web') {
if (index < self.length - activeScreensLimit - 1) {
// screen should be inactive because it is too deep in the stack
isScreenActive = STATE_INACTIVE;

View File

@@ -5,7 +5,7 @@ import { BaseButton } from 'react-native-gesture-handler';
const AnimatedBaseButton = Animated.createAnimatedComponent(BaseButton);
type Props = React.ComponentProps<typeof BaseButton> & {
activeOpacity: number;
pressOpacity: number;
};
const useNativeDriver = Platform.OS !== 'web';
@@ -27,7 +27,7 @@ export default class TouchableItem extends React.Component<Props> {
overshootClamping: true,
restDisplacementThreshold: 0.01,
restSpeedThreshold: 0.01,
toValue: active ? this.props.activeOpacity : 1,
toValue: active ? this.props.pressOpacity : 1,
useNativeDriver,
}).start();