Compare commits
14 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31565d5576 | ||
|
|
2c31d1705c | ||
|
|
8f9a250958 | ||
|
|
87d28ca430 | ||
|
|
fa4411a14d | ||
|
|
77b757091c | ||
|
|
6b9b999c5b | ||
|
|
8c5f84094f | ||
|
|
21709f7674 | ||
|
|
22742e4a7f | ||
|
|
3cd1aedcf4 | ||
|
|
797d3a798e | ||
|
|
59803f54d6 | ||
|
|
935659899f |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 98 KiB After Width: | Height: | Size: 94 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 900 B |
@@ -28,6 +28,7 @@
|
|||||||
"react-dom": "~16.9.0",
|
"react-dom": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "~1.5.0",
|
"react-native-gesture-handler": "~1.5.0",
|
||||||
|
"react-native-iphone-x-helper": "^1.2.1",
|
||||||
"react-native-paper": "^3.3.0",
|
"react-native-paper": "^3.3.0",
|
||||||
"react-native-reanimated": "^1.4.0",
|
"react-native-reanimated": "^1.4.0",
|
||||||
"react-native-safe-area-context": "^0.6.0",
|
"react-native-safe-area-context": "^0.6.0",
|
||||||
|
|||||||
@@ -3,6 +3,25 @@
|
|||||||
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.0.0-alpha.31](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.30...@react-navigation/bottom-tabs@5.0.0-alpha.31) (2020-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* provide initial values for safe area to prevent blank screen ([#238](https://github.com/react-navigation/navigation-ex/issues/238)) ([77b7570](https://github.com/react-navigation/navigation-ex/commit/77b757091c0451e20bca01138629669c7da544a8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.0.0-alpha.30](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.29...@react-navigation/bottom-tabs@5.0.0-alpha.30) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.29](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.28...@react-navigation/bottom-tabs@5.0.0-alpha.29) (2020-01-01)
|
# [5.0.0-alpha.29](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.28...@react-navigation/bottom-tabs@5.0.0-alpha.29) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"android",
|
"android",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.29",
|
"version": "5.0.0-alpha.31",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -34,7 +34,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||||
"color": "^3.1.2"
|
"color": "^3.1.2",
|
||||||
|
"react-native-iphone-x-helper": "^1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.7.0",
|
"@react-native-community/bob": "^0.7.0",
|
||||||
@@ -51,7 +52,7 @@
|
|||||||
"@react-navigation/native": "^5.0.0-alpha.0",
|
"@react-navigation/native": "^5.0.0-alpha.0",
|
||||||
"react": "*",
|
"react": "*",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-safe-area-context": "^0.3.6"
|
"react-native-safe-area-context": "^0.6.0"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
"source": "src",
|
"source": "src",
|
||||||
|
|||||||
@@ -3,6 +3,17 @@ import {
|
|||||||
SafeAreaProvider,
|
SafeAreaProvider,
|
||||||
SafeAreaConsumer,
|
SafeAreaConsumer,
|
||||||
} from 'react-native-safe-area-context';
|
} from 'react-native-safe-area-context';
|
||||||
|
import {
|
||||||
|
getStatusBarHeight,
|
||||||
|
getBottomSpace,
|
||||||
|
} from 'react-native-iphone-x-helper';
|
||||||
|
|
||||||
|
const initialSafeAreaInsets = {
|
||||||
|
top: getStatusBarHeight(true),
|
||||||
|
bottom: getBottomSpace(),
|
||||||
|
right: 0,
|
||||||
|
left: 0,
|
||||||
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -19,7 +30,11 @@ export default function SafeAreaProviderCompat({ children }: Props) {
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <SafeAreaProvider>{children}</SafeAreaProvider>;
|
return (
|
||||||
|
<SafeAreaProvider initialSafeAreaInsets={initialSafeAreaInsets}>
|
||||||
|
{children}
|
||||||
|
</SafeAreaProvider>
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
</SafeAreaConsumer>
|
</SafeAreaConsumer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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.0.0-alpha.33](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.32...@react-navigation/drawer@5.0.0-alpha.33) (2020-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* provide initial values for safe area to prevent blank screen ([#238](https://github.com/react-navigation/navigation-ex/issues/238)) ([77b7570](https://github.com/react-navigation/navigation-ex/commit/77b757091c0451e20bca01138629669c7da544a8))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add interaction handle to drawer ([#239](https://github.com/react-navigation/navigation-ex/issues/239)) ([fa4411a](https://github.com/react-navigation/navigation-ex/commit/fa4411a14dc4aae568794e4b884088e3276a2876))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.0.0-alpha.32](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.31...@react-navigation/drawer@5.0.0-alpha.32) (2020-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* pass backBehavior to the router in drawer. fixes [#230](https://github.com/react-navigation/navigation-ex/issues/230) ([3cd1aed](https://github.com/react-navigation/navigation-ex/commit/3cd1aedcf490a4c7962b2d36873d714637f3b9b0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.31](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.30...@react-navigation/drawer@5.0.0-alpha.31) (2020-01-01)
|
# [5.0.0-alpha.31](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.30...@react-navigation/drawer@5.0.0-alpha.31) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/drawer
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"material",
|
"material",
|
||||||
"drawer"
|
"drawer"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.31",
|
"version": "5.0.0-alpha.33",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -35,7 +35,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||||
"color": "^3.1.2"
|
"color": "^3.1.2",
|
||||||
|
"react-native-iphone-x-helper": "^1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.7.0",
|
"@react-native-community/bob": "^0.7.0",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ type Props = DefaultNavigatorOptions<DrawerNavigationOptions> &
|
|||||||
|
|
||||||
function DrawerNavigator({
|
function DrawerNavigator({
|
||||||
initialRouteName,
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
children,
|
children,
|
||||||
screenOptions,
|
screenOptions,
|
||||||
...rest
|
...rest
|
||||||
@@ -34,6 +35,7 @@ function DrawerNavigator({
|
|||||||
DrawerNavigationEventMap
|
DrawerNavigationEventMap
|
||||||
>(DrawerRouter, {
|
>(DrawerRouter, {
|
||||||
initialRouteName,
|
initialRouteName,
|
||||||
|
backBehavior,
|
||||||
children,
|
children,
|
||||||
screenOptions,
|
screenOptions,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
StatusBar,
|
StatusBar,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
View,
|
View,
|
||||||
|
InteractionManager,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import {
|
import {
|
||||||
PanGestureHandler,
|
PanGestureHandler,
|
||||||
@@ -161,9 +162,24 @@ export default class DrawerView extends React.PureComponent<Props> {
|
|||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.toggleStatusBar(false);
|
this.toggleStatusBar(false);
|
||||||
|
this.handleEndInteraction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleEndInteraction = () => {
|
||||||
|
if (this.interactionHandle !== undefined) {
|
||||||
|
InteractionManager.clearInteractionHandle(this.interactionHandle);
|
||||||
|
this.interactionHandle = undefined;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private handleStartInteraction = () => {
|
||||||
|
if (this.interactionHandle === undefined) {
|
||||||
|
this.interactionHandle = InteractionManager.createInteractionHandle();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private clock = new Clock();
|
private clock = new Clock();
|
||||||
|
private interactionHandle: number | undefined;
|
||||||
|
|
||||||
private isDrawerTypeFront = new Value<Binary>(
|
private isDrawerTypeFront = new Value<Binary>(
|
||||||
this.props.drawerType === 'front' ? TRUE : FALSE
|
this.props.drawerType === 'front' ? TRUE : FALSE
|
||||||
@@ -277,6 +293,7 @@ export default class DrawerView extends React.PureComponent<Props> {
|
|||||||
set(state.velocity, this.velocityX),
|
set(state.velocity, this.velocityX),
|
||||||
set(this.isOpen, isOpen),
|
set(this.isOpen, isOpen),
|
||||||
startClock(this.clock),
|
startClock(this.clock),
|
||||||
|
call([], this.handleStartInteraction),
|
||||||
set(this.manuallyTriggerSpring, FALSE),
|
set(this.manuallyTriggerSpring, FALSE),
|
||||||
]),
|
]),
|
||||||
spring(this.clock, state, { ...SPRING_CONFIG, toValue }),
|
spring(this.clock, state, { ...SPRING_CONFIG, toValue }),
|
||||||
@@ -290,6 +307,7 @@ export default class DrawerView extends React.PureComponent<Props> {
|
|||||||
stopClock(this.clock),
|
stopClock(this.clock),
|
||||||
call([this.isOpen], ([value]: readonly Binary[]) => {
|
call([this.isOpen], ([value]: readonly Binary[]) => {
|
||||||
const open = Boolean(value);
|
const open = Boolean(value);
|
||||||
|
this.handleEndInteraction();
|
||||||
|
|
||||||
if (open !== this.props.open) {
|
if (open !== this.props.open) {
|
||||||
// Sync drawer's state after animation finished
|
// Sync drawer's state after animation finished
|
||||||
@@ -358,6 +376,13 @@ export default class DrawerView extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
|
onChange(
|
||||||
|
this.gestureState,
|
||||||
|
cond(
|
||||||
|
eq(this.gestureState, State.ACTIVE),
|
||||||
|
call([], this.handleStartInteraction)
|
||||||
|
)
|
||||||
|
),
|
||||||
cond(
|
cond(
|
||||||
eq(this.gestureState, State.ACTIVE),
|
eq(this.gestureState, State.ACTIVE),
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -3,6 +3,17 @@ import {
|
|||||||
SafeAreaProvider,
|
SafeAreaProvider,
|
||||||
SafeAreaConsumer,
|
SafeAreaConsumer,
|
||||||
} from 'react-native-safe-area-context';
|
} from 'react-native-safe-area-context';
|
||||||
|
import {
|
||||||
|
getStatusBarHeight,
|
||||||
|
getBottomSpace,
|
||||||
|
} from 'react-native-iphone-x-helper';
|
||||||
|
|
||||||
|
const initialSafeAreaInsets = {
|
||||||
|
top: getStatusBarHeight(true),
|
||||||
|
bottom: getBottomSpace(),
|
||||||
|
right: 0,
|
||||||
|
left: 0,
|
||||||
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -19,7 +30,11 @@ export default function SafeAreaProviderCompat({ children }: Props) {
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <SafeAreaProvider>{children}</SafeAreaProvider>;
|
return (
|
||||||
|
<SafeAreaProvider initialSafeAreaInsets={initialSafeAreaInsets}>
|
||||||
|
{children}
|
||||||
|
</SafeAreaProvider>
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
</SafeAreaConsumer>
|
</SafeAreaConsumer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
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.0.0-alpha.21](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/native-stack@5.0.0-alpha.20...@react-navigation/native-stack@5.0.0-alpha.21) (2020-01-03)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/native-stack@5.0.0-alpha.19...@react-navigation/native-stack@5.0.0-alpha.20) (2020-01-01)
|
# [5.0.0-alpha.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/native-stack@5.0.0-alpha.19...@react-navigation/native-stack@5.0.0-alpha.20) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/native-stack
|
**Note:** Version bump only for package @react-navigation/native-stack
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation"
|
"react-navigation"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.20",
|
"version": "5.0.0-alpha.21",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export default function HeaderConfig(props: Props) {
|
|||||||
? headerTintColor
|
? headerTintColor
|
||||||
: colors.text
|
: colors.text
|
||||||
}
|
}
|
||||||
backTitle={headerBackTitleVisible ? headerBackTitle : ''}
|
backTitle={headerBackTitleVisible ? headerBackTitle : ' '}
|
||||||
backTitleFontFamily={headerBackTitleStyle.fontFamily}
|
backTitleFontFamily={headerBackTitleStyle.fontFamily}
|
||||||
backTitleFontSize={headerBackTitleStyle.fontSize}
|
backTitleFontSize={headerBackTitleStyle.fontSize}
|
||||||
color={headerTintColor !== undefined ? headerTintColor : colors.primary}
|
color={headerTintColor !== undefined ? headerTintColor : colors.primary}
|
||||||
|
|||||||
@@ -3,6 +3,31 @@
|
|||||||
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.0.0-alpha.49](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.48...@react-navigation/stack@5.0.0-alpha.49) (2020-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* dismiss keyboard on page change ([2c31d17](https://github.com/react-navigation/navigation-ex/commit/2c31d1705c4e5827b19b9cc7f3e5b05207c3238a))
|
||||||
|
* interaction manager in stack ([#237](https://github.com/react-navigation/navigation-ex/issues/237)) ([6b9b999](https://github.com/react-navigation/navigation-ex/commit/6b9b999c5b60a67ed683b84484928700d4260585))
|
||||||
|
* provide initial values for safe area to prevent blank screen ([#238](https://github.com/react-navigation/navigation-ex/issues/238)) ([77b7570](https://github.com/react-navigation/navigation-ex/commit/77b757091c0451e20bca01138629669c7da544a8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.0.0-alpha.48](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.47...@react-navigation/stack@5.0.0-alpha.48) (2020-01-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* improve gesture performance ([59803f5](https://github.com/react-navigation/navigation-ex/commit/59803f54d64f85c8e46c1ebc70613a70a812f53a))
|
||||||
|
* use native driver for gestures ([9356598](https://github.com/react-navigation/navigation-ex/commit/935659899f1d4084c601fbefea4a935f9b6ce087))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.47](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.46...@react-navigation/stack@5.0.0-alpha.47) (2020-01-01)
|
# [5.0.0-alpha.47](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.46...@react-navigation/stack@5.0.0-alpha.47) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/stack
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"android",
|
"android",
|
||||||
"stack"
|
"stack"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.47",
|
"version": "5.0.0-alpha.49",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -34,7 +34,8 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.19",
|
||||||
"color": "^3.1.2"
|
"color": "^3.1.2",
|
||||||
|
"react-native-iphone-x-helper": "^1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.7.0",
|
"@react-native-community/bob": "^0.7.0",
|
||||||
|
|||||||
@@ -11,9 +11,10 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default class KeyboardManager extends React.Component<Props> {
|
export default class KeyboardManager extends React.Component<Props> {
|
||||||
componentWillUnmount = () => {
|
componentWillUnmount() {
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
};
|
}
|
||||||
|
|
||||||
// Numeric id of the previously focused text input
|
// Numeric id of the previously focused text input
|
||||||
// When a gesture didn't change the tab, we can restore the focused input with this
|
// When a gesture didn't change the tab, we can restore the focused input with this
|
||||||
private previouslyFocusedTextInput: number | null = null;
|
private previouslyFocusedTextInput: number | null = null;
|
||||||
@@ -31,6 +32,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
if (!this.props.enabled) {
|
if (!this.props.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
const input = TextInput.State.currentlyFocusedField();
|
const input = TextInput.State.currentlyFocusedField();
|
||||||
@@ -49,6 +51,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
if (!this.props.enabled) {
|
if (!this.props.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
Keyboard.dismiss();
|
Keyboard.dismiss();
|
||||||
@@ -61,6 +64,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
if (!this.props.enabled) {
|
if (!this.props.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
// The page didn't change, we should restore the focus of text input
|
// The page didn't change, we should restore the focus of text input
|
||||||
|
|||||||
@@ -3,6 +3,17 @@ import {
|
|||||||
SafeAreaProvider,
|
SafeAreaProvider,
|
||||||
SafeAreaConsumer,
|
SafeAreaConsumer,
|
||||||
} from 'react-native-safe-area-context';
|
} from 'react-native-safe-area-context';
|
||||||
|
import {
|
||||||
|
getStatusBarHeight,
|
||||||
|
getBottomSpace,
|
||||||
|
} from 'react-native-iphone-x-helper';
|
||||||
|
|
||||||
|
const initialSafeAreaInsets = {
|
||||||
|
top: getStatusBarHeight(true),
|
||||||
|
bottom: getBottomSpace(),
|
||||||
|
right: 0,
|
||||||
|
left: 0,
|
||||||
|
};
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -19,7 +30,11 @@ export default function SafeAreaProviderCompat({ children }: Props) {
|
|||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <SafeAreaProvider>{children}</SafeAreaProvider>;
|
return (
|
||||||
|
<SafeAreaProvider initialSafeAreaInsets={initialSafeAreaInsets}>
|
||||||
|
{children}
|
||||||
|
</SafeAreaProvider>
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
</SafeAreaConsumer>
|
</SafeAreaConsumer>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -105,6 +105,11 @@ export default class Card extends React.Component<Props> {
|
|||||||
if (
|
if (
|
||||||
this.getAnimateToValue(this.props) !== this.getAnimateToValue(prevProps)
|
this.getAnimateToValue(this.props) !== this.getAnimateToValue(prevProps)
|
||||||
) {
|
) {
|
||||||
|
// We need to trigger the animation when route was closed
|
||||||
|
// Thr route might have been closed by a `POP` action or by a gesture
|
||||||
|
// When route was closed due to a gesture, the animation would've happened already
|
||||||
|
// It's still important to trigger the animation so that `onClose` is called
|
||||||
|
// If `onClose` is not called, cleanup step won't be performed for gestures
|
||||||
this.animate({ closing });
|
this.animate({ closing });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -132,7 +137,7 @@ export default class Card extends React.Component<Props> {
|
|||||||
closing,
|
closing,
|
||||||
velocity,
|
velocity,
|
||||||
}: {
|
}: {
|
||||||
closing: boolean | undefined;
|
closing?: boolean;
|
||||||
velocity?: number;
|
velocity?: number;
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
@@ -143,18 +148,28 @@ export default class Card extends React.Component<Props> {
|
|||||||
onTransitionStart,
|
onTransitionStart,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
|
const toValue = this.getAnimateToValue({
|
||||||
|
...this.props,
|
||||||
|
closing,
|
||||||
|
});
|
||||||
|
|
||||||
const spec = closing ? transitionSpec.close : transitionSpec.open;
|
const spec = closing ? transitionSpec.close : transitionSpec.open;
|
||||||
|
|
||||||
const animation =
|
const animation =
|
||||||
spec.animation === 'spring' ? Animated.spring : Animated.timing;
|
spec.animation === 'spring' ? Animated.spring : Animated.timing;
|
||||||
|
|
||||||
|
this.handleStartInteraction();
|
||||||
|
|
||||||
onTransitionStart?.({ closing: Boolean(closing) });
|
onTransitionStart?.({ closing: Boolean(closing) });
|
||||||
animation(gesture, {
|
animation(gesture, {
|
||||||
...spec.config,
|
...spec.config,
|
||||||
velocity,
|
velocity,
|
||||||
|
toValue,
|
||||||
useNativeDriver: true,
|
useNativeDriver: true,
|
||||||
toValue: this.getAnimateToValue(this.props),
|
isInteraction: false,
|
||||||
}).start(({ finished }) => {
|
}).start(({ finished }) => {
|
||||||
|
this.handleEndInteraction();
|
||||||
|
|
||||||
if (finished) {
|
if (finished) {
|
||||||
if (closing) {
|
if (closing) {
|
||||||
onClose();
|
onClose();
|
||||||
@@ -169,7 +184,11 @@ export default class Card extends React.Component<Props> {
|
|||||||
closing,
|
closing,
|
||||||
layout,
|
layout,
|
||||||
gestureDirection,
|
gestureDirection,
|
||||||
}: Props) => {
|
}: {
|
||||||
|
closing?: boolean;
|
||||||
|
layout: Layout;
|
||||||
|
gestureDirection: GestureDirection;
|
||||||
|
}) => {
|
||||||
if (!closing) {
|
if (!closing) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -215,7 +234,6 @@ export default class Card extends React.Component<Props> {
|
|||||||
break;
|
break;
|
||||||
case GestureState.END: {
|
case GestureState.END: {
|
||||||
this.isSwiping.setValue(FALSE);
|
this.isSwiping.setValue(FALSE);
|
||||||
this.handleEndInteraction();
|
|
||||||
|
|
||||||
let distance;
|
let distance;
|
||||||
let translation;
|
let translation;
|
||||||
@@ -376,15 +394,18 @@ export default class Card extends React.Component<Props> {
|
|||||||
} = interpolatedStyle;
|
} = interpolatedStyle;
|
||||||
|
|
||||||
const handleGestureEvent = gestureEnabled
|
const handleGestureEvent = gestureEnabled
|
||||||
? Animated.event([
|
? Animated.event(
|
||||||
{
|
[
|
||||||
nativeEvent:
|
{
|
||||||
gestureDirection === 'vertical' ||
|
nativeEvent:
|
||||||
gestureDirection === 'vertical-inverted'
|
gestureDirection === 'vertical' ||
|
||||||
? { translationY: gesture }
|
gestureDirection === 'vertical-inverted'
|
||||||
: { translationX: gesture },
|
? { translationY: gesture }
|
||||||
},
|
: { translationX: gesture },
|
||||||
])
|
},
|
||||||
|
],
|
||||||
|
{ useNativeDriver: true }
|
||||||
|
)
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const { backgroundColor } = StyleSheet.flatten(contentStyle || {});
|
const { backgroundColor } = StyleSheet.flatten(contentStyle || {});
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ type Props = TransitionPreset & {
|
|||||||
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
renderScene: (props: { route: Route<string> }) => React.ReactNode;
|
||||||
onOpenRoute: (props: { route: Route<string> }) => void;
|
onOpenRoute: (props: { route: Route<string> }) => void;
|
||||||
onCloseRoute: (props: { route: Route<string> }) => void;
|
onCloseRoute: (props: { route: Route<string> }) => void;
|
||||||
onGoBack: (props: { route: Route<string> }) => void;
|
|
||||||
onTransitionStart?: (
|
onTransitionStart?: (
|
||||||
props: { route: Route<string> },
|
props: { route: Route<string> },
|
||||||
closing: boolean
|
closing: boolean
|
||||||
@@ -73,7 +72,6 @@ export default function CardContainer({
|
|||||||
index,
|
index,
|
||||||
layout,
|
layout,
|
||||||
onCloseRoute,
|
onCloseRoute,
|
||||||
onGoBack,
|
|
||||||
onOpenRoute,
|
onOpenRoute,
|
||||||
onPageChangeCancel,
|
onPageChangeCancel,
|
||||||
onPageChangeConfirm,
|
onPageChangeConfirm,
|
||||||
@@ -91,6 +89,10 @@ export default function CardContainer({
|
|||||||
state,
|
state,
|
||||||
transitionSpec,
|
transitionSpec,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
React.useEffect(() => {
|
||||||
|
onPageChangeConfirm?.();
|
||||||
|
}, [active, onPageChangeConfirm]);
|
||||||
|
|
||||||
const handleOpen = () => {
|
const handleOpen = () => {
|
||||||
onTransitionEnd?.({ route: scene.route }, false);
|
onTransitionEnd?.({ route: scene.route }, false);
|
||||||
onOpenRoute({ route: scene.route });
|
onOpenRoute({ route: scene.route });
|
||||||
@@ -102,14 +104,13 @@ export default function CardContainer({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleTransitionStart = ({ closing }: { closing: boolean }) => {
|
const handleTransitionStart = ({ closing }: { closing: boolean }) => {
|
||||||
if (closing) {
|
if (active && closing) {
|
||||||
onPageChangeConfirm?.();
|
onPageChangeConfirm?.();
|
||||||
} else {
|
} else {
|
||||||
onPageChangeCancel?.();
|
onPageChangeCancel?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
onTransitionStart?.({ route: scene.route }, closing);
|
onTransitionStart?.({ route: scene.route }, closing);
|
||||||
closing && onGoBack({ route: scene.route });
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const insets = {
|
const insets = {
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ type Props = {
|
|||||||
routes: Route<string>[];
|
routes: Route<string>[];
|
||||||
openingRouteKeys: string[];
|
openingRouteKeys: string[];
|
||||||
closingRouteKeys: string[];
|
closingRouteKeys: string[];
|
||||||
onGoBack: (props: { route: Route<string> }) => void;
|
|
||||||
onOpenRoute: (props: { route: Route<string> }) => void;
|
onOpenRoute: (props: { route: Route<string> }) => void;
|
||||||
onCloseRoute: (props: { route: Route<string> }) => void;
|
onCloseRoute: (props: { route: Route<string> }) => void;
|
||||||
getPreviousRoute: (props: {
|
getPreviousRoute: (props: {
|
||||||
@@ -360,7 +359,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
closingRouteKeys,
|
closingRouteKeys,
|
||||||
onOpenRoute,
|
onOpenRoute,
|
||||||
onCloseRoute,
|
onCloseRoute,
|
||||||
onGoBack,
|
|
||||||
getPreviousRoute,
|
getPreviousRoute,
|
||||||
getGesturesEnabled,
|
getGesturesEnabled,
|
||||||
renderHeader,
|
renderHeader,
|
||||||
@@ -527,7 +525,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
onCloseRoute={onCloseRoute}
|
onCloseRoute={onCloseRoute}
|
||||||
onTransitionStart={onTransitionStart}
|
onTransitionStart={onTransitionStart}
|
||||||
onTransitionEnd={onTransitionEnd}
|
onTransitionEnd={onTransitionEnd}
|
||||||
onGoBack={onGoBack}
|
|
||||||
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
||||||
gestureVelocityImpact={gestureVelocityImpact}
|
gestureVelocityImpact={gestureVelocityImpact}
|
||||||
gestureDirection={gestureDirection}
|
gestureDirection={gestureDirection}
|
||||||
|
|||||||
@@ -266,18 +266,6 @@ class StackView extends React.Component<Props, State> {
|
|||||||
return <HeaderContainer {...props} />;
|
return <HeaderContainer {...props} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleGoBack = ({ route }: { route: Route<string> }) => {
|
|
||||||
const { state, navigation } = this.props;
|
|
||||||
|
|
||||||
// This event will trigger when a gesture ends
|
|
||||||
// We need to perform the transition before removing the route completely
|
|
||||||
navigation.dispatch({
|
|
||||||
...StackActions.pop(),
|
|
||||||
source: route.key,
|
|
||||||
target: state.key,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||||
this.setState(state => ({
|
this.setState(state => ({
|
||||||
routes: state.replacingRouteKeys.length
|
routes: state.replacingRouteKeys.length
|
||||||
@@ -290,15 +278,33 @@ class StackView extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private handleCloseRoute = ({ route }: { route: Route<string> }) => {
|
private handleCloseRoute = ({ route }: { route: Route<string> }) => {
|
||||||
// This event will trigger when the animation for closing the route ends
|
const { state, navigation } = this.props;
|
||||||
// In this case, we need to clean up any state tracking the route and pop it immediately
|
|
||||||
|
|
||||||
// @ts-ignore
|
if (state.routes.find(r => r.key === route.key)) {
|
||||||
this.setState(state => ({
|
// If a route exists in state, trigger a pop
|
||||||
routes: state.routes.filter(r => r.key !== route.key),
|
// This will happen in when the route was closed from the card component
|
||||||
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
|
// e.g. When the close animation triggered from a gesture ends
|
||||||
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key),
|
// For the cleanup, the card needs to call this function again from its componentDidUpdate
|
||||||
}));
|
navigation.dispatch({
|
||||||
|
...StackActions.pop(),
|
||||||
|
source: route.key,
|
||||||
|
target: state.key,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Otherwise, the animation was triggered due to a route removal
|
||||||
|
// In this case, we need to clean up any state tracking the route and pop it immediately
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
this.setState(state => ({
|
||||||
|
routes: state.routes.filter(r => r.key !== route.key),
|
||||||
|
openingRouteKeys: state.openingRouteKeys.filter(
|
||||||
|
key => key !== route.key
|
||||||
|
),
|
||||||
|
closingRouteKeys: state.closingRouteKeys.filter(
|
||||||
|
key => key !== route.key
|
||||||
|
),
|
||||||
|
}));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private handleTransitionStart = (
|
private handleTransitionStart = (
|
||||||
@@ -355,7 +361,6 @@ class StackView extends React.Component<Props, State> {
|
|||||||
routes={routes}
|
routes={routes}
|
||||||
openingRouteKeys={openingRouteKeys}
|
openingRouteKeys={openingRouteKeys}
|
||||||
closingRouteKeys={closingRouteKeys}
|
closingRouteKeys={closingRouteKeys}
|
||||||
onGoBack={this.handleGoBack}
|
|
||||||
onOpenRoute={this.handleOpenRoute}
|
onOpenRoute={this.handleOpenRoute}
|
||||||
onCloseRoute={this.handleCloseRoute}
|
onCloseRoute={this.handleCloseRoute}
|
||||||
onTransitionStart={this.handleTransitionStart}
|
onTransitionStart={this.handleTransitionStart}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 913 B |
@@ -13191,6 +13191,11 @@ react-native-gesture-handler@^1.5.0, react-native-gesture-handler@~1.5.0:
|
|||||||
invariant "^2.2.4"
|
invariant "^2.2.4"
|
||||||
prop-types "^15.7.2"
|
prop-types "^15.7.2"
|
||||||
|
|
||||||
|
react-native-iphone-x-helper@^1.2.1:
|
||||||
|
version "1.2.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.2.1.tgz#645e2ffbbb49e80844bb4cbbe34a126fda1e6772"
|
||||||
|
integrity sha512-/VbpIEp8tSNNHIvstuA3Swx610whci1Zpc9mqNkqn14DkMbw+ORviln2u0XyHG1kPvvwTNGZY6QpeFwxYaSdbQ==
|
||||||
|
|
||||||
react-native-paper@^3.3.0:
|
react-native-paper@^3.3.0:
|
||||||
version "3.3.0"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-3.3.0.tgz#c2a1e9b793b7063aa1848c1ce7db5719912e215a"
|
resolved "https://registry.yarnpkg.com/react-native-paper/-/react-native-paper-3.3.0.tgz#c2a1e9b793b7063aa1848c1ce7db5719912e215a"
|
||||||
|
|||||||