Compare commits
16 Commits
@react-nav
...
@react-nav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c514542305 | ||
|
|
dcc5f99ecd | ||
|
|
adbeb292f5 | ||
|
|
543679f185 | ||
|
|
cbe240eae6 | ||
|
|
7f963a74bb | ||
|
|
572beae41b | ||
|
|
15fe3ebb51 | ||
|
|
31565d5576 | ||
|
|
2c31d1705c | ||
|
|
8f9a250958 | ||
|
|
87d28ca430 | ||
|
|
fa4411a14d | ||
|
|
77b757091c | ||
|
|
6b9b999c5b | ||
|
|
8c5f84094f |
|
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",
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ const createExpoWebpackConfigAsync = require('@expo/webpack-config');
|
|||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
||||||
|
|
||||||
|
const node_modules = path.resolve(__dirname, 'node_modules');
|
||||||
|
const packages = path.resolve(__dirname, '..', 'packages');
|
||||||
|
|
||||||
module.exports = async function(env, argv) {
|
module.exports = async function(env, argv) {
|
||||||
const config = await createExpoWebpackConfigAsync(env, argv);
|
const config = await createExpoWebpackConfigAsync(env, argv);
|
||||||
|
|
||||||
@@ -19,28 +22,15 @@ module.exports = async function(env, argv) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Object.assign(config.resolve.alias, {
|
Object.assign(config.resolve.alias, {
|
||||||
react: path.resolve(__dirname, 'node_modules', 'react'),
|
react: path.resolve(node_modules, 'react'),
|
||||||
'react-native': path.resolve(__dirname, 'node_modules', 'react-native-web'),
|
'react-native': path.resolve(node_modules, 'react-native-web'),
|
||||||
'react-native-web': path.resolve(
|
'react-native-web': path.resolve(node_modules, 'react-native-web'),
|
||||||
__dirname,
|
'@expo/vector-icons': path.resolve(node_modules, '@expo/vector-icons'),
|
||||||
'node_modules',
|
|
||||||
'react-native-web'
|
|
||||||
),
|
|
||||||
'react-native-reanimated': path.resolve(
|
|
||||||
__dirname,
|
|
||||||
'node_modules',
|
|
||||||
'react-native-reanimated-web'
|
|
||||||
),
|
|
||||||
'@expo/vector-icons/MaterialCommunityIcons': require.resolve(
|
|
||||||
'@expo/vector-icons/MaterialCommunityIcons'
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.readdirSync(path.join(__dirname, '..')).forEach(name => {
|
fs.readdirSync(packages).forEach(name => {
|
||||||
config.resolve.alias[`@react-navigation/${name}`] = path.resolve(
|
config.resolve.alias[`@react-navigation/${name}`] = path.resolve(
|
||||||
__dirname,
|
packages,
|
||||||
'..',
|
|
||||||
'packages',
|
|
||||||
name,
|
name,
|
||||||
'src'
|
'src'
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -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.32](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/bottom-tabs@5.0.0-alpha.31...@react-navigation/bottom-tabs@5.0.0-alpha.32) (2020-01-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [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)
|
# [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
|
**Note:** Version bump only for package @react-navigation/bottom-tabs
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"android",
|
"android",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.30",
|
"version": "5.0.0-alpha.32",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -33,8 +33,9 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||||
"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",
|
||||||
|
|||||||
@@ -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/compat@5.0.0-alpha.20...@react-navigation/compat@5.0.0-alpha.21) (2020-01-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/compat
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/compat@5.0.0-alpha.19...@react-navigation/compat@5.0.0-alpha.20) (2020-01-01)
|
# [5.0.0-alpha.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/compat@5.0.0-alpha.19...@react-navigation/compat@5.0.0-alpha.20) (2020-01-01)
|
||||||
|
|
||||||
**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.0.0-alpha.20",
|
"version": "5.0.0-alpha.21",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19"
|
"@react-navigation/routers": "^5.0.0-alpha.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^16.9.16",
|
"@types/react": "^16.9.16",
|
||||||
|
|||||||
@@ -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.0.0-alpha.34](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/drawer@5.0.0-alpha.33...@react-navigation/drawer@5.0.0-alpha.34) (2020-01-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [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)
|
# [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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"material",
|
"material",
|
||||||
"drawer"
|
"drawer"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.32",
|
"version": "5.0.0-alpha.34",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -34,8 +34,9 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||||
"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",
|
||||||
|
|||||||
@@ -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.29](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.28...@react-navigation/material-bottom-tabs@5.0.0-alpha.29) (2020-01-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.28](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.27...@react-navigation/material-bottom-tabs@5.0.0-alpha.28) (2020-01-01)
|
# [5.0.0-alpha.28](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-bottom-tabs@5.0.0-alpha.27...@react-navigation/material-bottom-tabs@5.0.0-alpha.28) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
**Note:** Version bump only for package @react-navigation/material-bottom-tabs
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"material",
|
"material",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.28",
|
"version": "5.0.0-alpha.29",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19"
|
"@react-navigation/routers": "^5.0.0-alpha.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.7.0",
|
"@react-native-community/bob": "^0.7.0",
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
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.27](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-top-tabs@5.0.0-alpha.26...@react-navigation/material-top-tabs@5.0.0-alpha.27) (2020-01-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add support for pager component ([dcc5f99](https://github.com/react-navigation/navigation-ex/commit/dcc5f99ecd495ad1903c9e99884e0d4e9b3994f1))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.26](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-top-tabs@5.0.0-alpha.25...@react-navigation/material-top-tabs@5.0.0-alpha.26) (2020-01-01)
|
# [5.0.0-alpha.26](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/material-top-tabs@5.0.0-alpha.25...@react-navigation/material-top-tabs@5.0.0-alpha.26) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
**Note:** Version bump only for package @react-navigation/material-top-tabs
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"material",
|
"material",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.26",
|
"version": "5.0.0-alpha.27",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||||
"color": "^3.1.2"
|
"color": "^3.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -113,9 +113,15 @@ export type MaterialTopTabNavigationConfig = Partial<
|
|||||||
| 'onSwipeEnd'
|
| 'onSwipeEnd'
|
||||||
| 'renderScene'
|
| 'renderScene'
|
||||||
| 'renderTabBar'
|
| 'renderTabBar'
|
||||||
|
| 'renderPager'
|
||||||
| 'renderLazyPlaceholder'
|
| 'renderLazyPlaceholder'
|
||||||
>
|
>
|
||||||
> & {
|
> & {
|
||||||
|
/**
|
||||||
|
* Function that returns a React element to use as the pager.
|
||||||
|
* The pager handles swipe gestures and page switching.
|
||||||
|
*/
|
||||||
|
pager?: React.ComponentProps<typeof TabView>['renderPager'];
|
||||||
/**
|
/**
|
||||||
* Function that returns a React element to render for routes that haven't been rendered yet.
|
* Function that returns a React element to render for routes that haven't been rendered yet.
|
||||||
* Receives an object containing the route as the prop.
|
* Receives an object containing the route as the prop.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { TabView, SceneRendererProps } from 'react-native-tab-view';
|
import { TabView, SceneRendererProps } from 'react-native-tab-view';
|
||||||
import { Route, useTheme } from '@react-navigation/native';
|
import { useTheme } from '@react-navigation/native';
|
||||||
import { TabNavigationState, TabActions } from '@react-navigation/routers';
|
import { TabNavigationState, TabActions } from '@react-navigation/routers';
|
||||||
|
|
||||||
import MaterialTopTabBar from './MaterialTopTabBar';
|
import MaterialTopTabBar from './MaterialTopTabBar';
|
||||||
@@ -19,6 +19,7 @@ type Props = MaterialTopTabNavigationConfig & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function MaterialTopTabView({
|
export default function MaterialTopTabView({
|
||||||
|
pager,
|
||||||
lazyPlaceholder,
|
lazyPlaceholder,
|
||||||
tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,
|
tabBar = (props: MaterialTopTabBarProps) => <MaterialTopTabBar {...props} />,
|
||||||
tabBarOptions,
|
tabBarOptions,
|
||||||
@@ -30,14 +31,6 @@ export default function MaterialTopTabView({
|
|||||||
}: Props) {
|
}: Props) {
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
|
|
||||||
const renderLazyPlaceholder = (props: { route: Route<string> }) => {
|
|
||||||
if (lazyPlaceholder != null) {
|
|
||||||
return lazyPlaceholder(props);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderTabBar = (props: SceneRendererProps) => {
|
const renderTabBar = (props: SceneRendererProps) => {
|
||||||
const route = state.routes[state.index];
|
const route = state.routes[state.index];
|
||||||
const options = descriptors[route.key].options;
|
const options = descriptors[route.key].options;
|
||||||
@@ -69,7 +62,8 @@ export default function MaterialTopTabView({
|
|||||||
renderScene={({ route }) => descriptors[route.key].render()}
|
renderScene={({ route }) => descriptors[route.key].render()}
|
||||||
navigationState={state}
|
navigationState={state}
|
||||||
renderTabBar={renderTabBar}
|
renderTabBar={renderTabBar}
|
||||||
renderLazyPlaceholder={renderLazyPlaceholder}
|
renderPager={pager}
|
||||||
|
renderLazyPlaceholder={lazyPlaceholder}
|
||||||
onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}
|
onSwipeStart={() => navigation.emit({ type: 'swipeStart' })}
|
||||||
onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}
|
onSwipeEnd={() => navigation.emit({ type: 'swipeEnd' })}
|
||||||
sceneContainerStyle={[
|
sceneContainerStyle={[
|
||||||
|
|||||||
@@ -3,6 +3,22 @@
|
|||||||
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.22](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/native-stack@5.0.0-alpha.21...@react-navigation/native-stack@5.0.0-alpha.22) (2020-01-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [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.22",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19"
|
"@react-navigation/routers": "^5.0.0-alpha.20"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.7.0",
|
"@react-native-community/bob": "^0.7.0",
|
||||||
|
|||||||
@@ -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,17 @@
|
|||||||
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.20](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/routers@5.0.0-alpha.19...@react-navigation/routers@5.0.0-alpha.20) (2020-01-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* preserve focused route in tab on changing screens list ([adbeb29](https://github.com/react-navigation/navigation-ex/commit/adbeb292f522be8d7a58dd3f84e560a6d83d01a8))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [5.0.0-alpha.19](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/routers@5.0.0-alpha.18...@react-navigation/routers@5.0.0-alpha.19) (2020-01-01)
|
# [5.0.0-alpha.19](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/routers@5.0.0-alpha.18...@react-navigation/routers@5.0.0-alpha.19) (2020-01-01)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/routers
|
**Note:** Version bump only for package @react-navigation/routers
|
||||||
|
|||||||
@@ -250,6 +250,89 @@ it('gets state on route names change', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('preserves focused route on route names change', () => {
|
||||||
|
const router = TabRouter({});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForRouteNamesChange(
|
||||||
|
{
|
||||||
|
index: 1,
|
||||||
|
key: 'tab-test',
|
||||||
|
routeKeyHistory: [],
|
||||||
|
routeNames: ['bar', 'baz', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'bar-test', name: 'bar' },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { answer: 42 } },
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||||
|
],
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
routeNames: ['qux', 'foo', 'fiz', 'baz'],
|
||||||
|
routeParamList: {
|
||||||
|
qux: { name: 'John' },
|
||||||
|
fiz: { fruit: 'apple' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
).toEqual({
|
||||||
|
index: 3,
|
||||||
|
key: 'tab-test',
|
||||||
|
routeKeyHistory: [],
|
||||||
|
routeNames: ['qux', 'foo', 'fiz', 'baz'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||||
|
{ key: 'foo-test', name: 'foo' },
|
||||||
|
{ key: 'fiz-test', name: 'fiz', params: { fruit: 'apple' } },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { answer: 42 } },
|
||||||
|
],
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('falls back to first route if route is removed on route names change', () => {
|
||||||
|
const router = TabRouter({});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
router.getStateForRouteNamesChange(
|
||||||
|
{
|
||||||
|
index: 1,
|
||||||
|
key: 'tab-test',
|
||||||
|
routeKeyHistory: [],
|
||||||
|
routeNames: ['bar', 'baz', 'qux'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'bar-test', name: 'bar' },
|
||||||
|
{ key: 'baz-test', name: 'baz', params: { answer: 42 } },
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||||
|
],
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
routeNames: ['qux', 'foo', 'fiz'],
|
||||||
|
routeParamList: {
|
||||||
|
qux: { name: 'John' },
|
||||||
|
fiz: { fruit: 'apple' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
).toEqual({
|
||||||
|
index: 0,
|
||||||
|
key: 'tab-test',
|
||||||
|
routeKeyHistory: [],
|
||||||
|
routeNames: ['qux', 'foo', 'fiz'],
|
||||||
|
routes: [
|
||||||
|
{ key: 'qux-test', name: 'qux', params: { name: 'Jane' } },
|
||||||
|
{ key: 'foo-test', name: 'foo' },
|
||||||
|
{ key: 'fiz-test', name: 'fiz', params: { fruit: 'apple' } },
|
||||||
|
],
|
||||||
|
stale: false,
|
||||||
|
type: 'tab',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('handles navigate action', () => {
|
it('handles navigate action', () => {
|
||||||
const router = TabRouter({});
|
const router = TabRouter({});
|
||||||
const options = {
|
const options = {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"react-native",
|
"react-native",
|
||||||
"react-navigation"
|
"react-navigation"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.19",
|
"version": "5.0.0-alpha.20",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -147,11 +147,16 @@ export default function TabRouter({
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const index = Math.max(
|
||||||
|
0,
|
||||||
|
routeNames.indexOf(state.routes[state.index].name)
|
||||||
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
routeNames,
|
routeNames,
|
||||||
routes,
|
routes,
|
||||||
index: Math.min(state.index, routes.length - 1),
|
index,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,39 @@
|
|||||||
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.51](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.50...@react-navigation/stack@5.0.0-alpha.51) (2020-01-05)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [5.0.0-alpha.50](https://github.com/react-navigation/navigation-ex/compare/@react-navigation/stack@5.0.0-alpha.49...@react-navigation/stack@5.0.0-alpha.50) (2020-01-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* keep screens for replace when animation is enabled ([7f963a7](https://github.com/react-navigation/navigation-ex/commit/7f963a74bb4d4b04134e917fe47e38e4d982afed))
|
||||||
|
* use gesture direction when using next screen's animation ([572beae](https://github.com/react-navigation/navigation-ex/commit/572beae41b326f3ef80bc2b790badf123e0071bc))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [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)
|
# [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)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"android",
|
"android",
|
||||||
"stack"
|
"stack"
|
||||||
],
|
],
|
||||||
"version": "5.0.0-alpha.48",
|
"version": "5.0.0-alpha.51",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -33,8 +33,9 @@
|
|||||||
"clean": "del lib"
|
"clean": "del lib"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^5.0.0-alpha.19",
|
"@react-navigation/routers": "^5.0.0-alpha.20",
|
||||||
"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>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
} from 'react-native-gesture-handler';
|
} from 'react-native-gesture-handler';
|
||||||
import { EdgeInsets } from 'react-native-safe-area-context';
|
import { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
import Color from 'color';
|
import Color from 'color';
|
||||||
import PointerEventsView from './PointerEventsView';
|
|
||||||
import StackGestureContext from '../../utils/StackGestureContext';
|
import StackGestureContext from '../../utils/StackGestureContext';
|
||||||
import StackCardAnimationContext from '../../utils/StackCardAnimationContext';
|
import StackCardAnimationContext from '../../utils/StackCardAnimationContext';
|
||||||
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
import getDistanceForDirection from '../../utils/getDistanceForDirection';
|
||||||
@@ -31,7 +30,6 @@ import {
|
|||||||
|
|
||||||
type Props = ViewProps & {
|
type Props = ViewProps & {
|
||||||
index: number;
|
index: number;
|
||||||
active: boolean;
|
|
||||||
closing?: boolean;
|
closing?: boolean;
|
||||||
next?: Animated.AnimatedInterpolation;
|
next?: Animated.AnimatedInterpolation;
|
||||||
current: Animated.AnimatedInterpolation;
|
current: Animated.AnimatedInterpolation;
|
||||||
@@ -158,13 +156,19 @@ export default class Card extends React.Component<Props> {
|
|||||||
const animation =
|
const animation =
|
||||||
spec.animation === 'spring' ? Animated.spring : Animated.timing;
|
spec.animation === 'spring' ? Animated.spring : Animated.timing;
|
||||||
|
|
||||||
|
this.setPointerEventsEnabled(!closing);
|
||||||
|
this.handleStartInteraction();
|
||||||
|
|
||||||
onTransitionStart?.({ closing: Boolean(closing) });
|
onTransitionStart?.({ closing: Boolean(closing) });
|
||||||
animation(gesture, {
|
animation(gesture, {
|
||||||
...spec.config,
|
...spec.config,
|
||||||
velocity,
|
velocity,
|
||||||
useNativeDriver: true,
|
|
||||||
toValue,
|
toValue,
|
||||||
|
useNativeDriver: true,
|
||||||
|
isInteraction: false,
|
||||||
}).start(({ finished }) => {
|
}).start(({ finished }) => {
|
||||||
|
this.handleEndInteraction();
|
||||||
|
|
||||||
if (finished) {
|
if (finished) {
|
||||||
if (closing) {
|
if (closing) {
|
||||||
onClose();
|
onClose();
|
||||||
@@ -191,6 +195,15 @@ export default class Card extends React.Component<Props> {
|
|||||||
return getDistanceForDirection(layout, gestureDirection);
|
return getDistanceForDirection(layout, gestureDirection);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private setPointerEventsEnabled = (enabled: boolean) => {
|
||||||
|
const pointerEvents = enabled ? 'box-none' : 'none';
|
||||||
|
|
||||||
|
this.content.current &&
|
||||||
|
this.content.current.setNativeProps({ pointerEvents });
|
||||||
|
};
|
||||||
|
|
||||||
|
private content = React.createRef<View>();
|
||||||
|
|
||||||
private handleStartInteraction = () => {
|
private handleStartInteraction = () => {
|
||||||
if (this.interactionHandle === undefined) {
|
if (this.interactionHandle === undefined) {
|
||||||
this.interactionHandle = InteractionManager.createInteractionHandle();
|
this.interactionHandle = InteractionManager.createInteractionHandle();
|
||||||
@@ -229,7 +242,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;
|
||||||
@@ -340,7 +352,6 @@ export default class Card extends React.Component<Props> {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
active,
|
|
||||||
styleInterpolator,
|
styleInterpolator,
|
||||||
index,
|
index,
|
||||||
current,
|
current,
|
||||||
@@ -442,15 +453,11 @@ export default class Card extends React.Component<Props> {
|
|||||||
pointerEvents="none"
|
pointerEvents="none"
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<PointerEventsView
|
<View ref={this.content} style={[styles.content, contentStyle]}>
|
||||||
active={active}
|
|
||||||
progress={current}
|
|
||||||
style={[styles.content, contentStyle]}
|
|
||||||
>
|
|
||||||
<StackCardAnimationContext.Provider value={animationContext}>
|
<StackCardAnimationContext.Provider value={animationContext}>
|
||||||
{children}
|
{children}
|
||||||
</StackCardAnimationContext.Provider>
|
</StackCardAnimationContext.Provider>
|
||||||
</PointerEventsView>
|
</View>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
</PanGestureHandler>
|
</PanGestureHandler>
|
||||||
</Animated.View>
|
</Animated.View>
|
||||||
|
|||||||
@@ -89,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 });
|
||||||
@@ -100,7 +104,7 @@ 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?.();
|
||||||
@@ -121,7 +125,6 @@ export default function CardContainer({
|
|||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
index={index}
|
index={index}
|
||||||
active={active}
|
|
||||||
gestureDirection={gestureDirection}
|
gestureDirection={gestureDirection}
|
||||||
layout={layout}
|
layout={layout}
|
||||||
insets={insets}
|
insets={insets}
|
||||||
|
|||||||
@@ -444,6 +444,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
: ({} as StackNavigationOptions);
|
: ({} as StackNavigationOptions);
|
||||||
|
|
||||||
let transitionConfig = {
|
let transitionConfig = {
|
||||||
|
gestureDirection,
|
||||||
transitionSpec,
|
transitionSpec,
|
||||||
cardStyleInterpolator,
|
cardStyleInterpolator,
|
||||||
headerStyleInterpolator,
|
headerStyleInterpolator,
|
||||||
@@ -461,6 +462,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
if (nextScene) {
|
if (nextScene) {
|
||||||
const {
|
const {
|
||||||
animationEnabled,
|
animationEnabled,
|
||||||
|
gestureDirection = defaultTransitionPreset.gestureDirection,
|
||||||
transitionSpec = defaultTransitionPreset.transitionSpec,
|
transitionSpec = defaultTransitionPreset.transitionSpec,
|
||||||
cardStyleInterpolator = animationEnabled === false
|
cardStyleInterpolator = animationEnabled === false
|
||||||
? forNoAnimationCard
|
? forNoAnimationCard
|
||||||
@@ -471,6 +473,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
: ({} as StackNavigationOptions);
|
: ({} as StackNavigationOptions);
|
||||||
|
|
||||||
transitionConfig = {
|
transitionConfig = {
|
||||||
|
gestureDirection,
|
||||||
transitionSpec,
|
transitionSpec,
|
||||||
cardStyleInterpolator,
|
cardStyleInterpolator,
|
||||||
headerStyleInterpolator,
|
headerStyleInterpolator,
|
||||||
@@ -527,7 +530,6 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
onTransitionEnd={onTransitionEnd}
|
onTransitionEnd={onTransitionEnd}
|
||||||
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
||||||
gestureVelocityImpact={gestureVelocityImpact}
|
gestureVelocityImpact={gestureVelocityImpact}
|
||||||
gestureDirection={gestureDirection}
|
|
||||||
{...transitionConfig}
|
{...transitionConfig}
|
||||||
/>
|
/>
|
||||||
</MaybeScreen>
|
</MaybeScreen>
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
import * as React from 'react';
|
|
||||||
import { Animated, View, ViewProps } from 'react-native';
|
|
||||||
|
|
||||||
type Props = ViewProps & {
|
|
||||||
active: boolean;
|
|
||||||
progress: Animated.AnimatedInterpolation;
|
|
||||||
children: React.ReactNode;
|
|
||||||
};
|
|
||||||
|
|
||||||
const TRUE = 1;
|
|
||||||
const FALSE = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Component that automatically computes the `pointerEvents` property
|
|
||||||
* whenever position changes.
|
|
||||||
*/
|
|
||||||
export default function PointerEventsView({ active, ...rest }: Props) {
|
|
||||||
const [pointerEventsEnabled] = React.useState(
|
|
||||||
() => new Animated.Value(active ? TRUE : FALSE)
|
|
||||||
);
|
|
||||||
|
|
||||||
const root = React.useRef<View | null>(null);
|
|
||||||
|
|
||||||
const setPointerEventsEnabled = React.useCallback((enabled: boolean) => {
|
|
||||||
const pointerEvents = enabled ? 'box-none' : 'none';
|
|
||||||
|
|
||||||
root.current && root.current.setNativeProps({ pointerEvents });
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
|
||||||
pointerEventsEnabled.setValue(active ? TRUE : FALSE);
|
|
||||||
setPointerEventsEnabled(active);
|
|
||||||
}, [active, pointerEventsEnabled, setPointerEventsEnabled]);
|
|
||||||
|
|
||||||
return <View ref={root} {...rest} />;
|
|
||||||
}
|
|
||||||
@@ -90,6 +90,12 @@ class StackView extends React.Component<Props, State> {
|
|||||||
| undefined;
|
| undefined;
|
||||||
const nextFocusedRoute = routes[routes.length - 1];
|
const nextFocusedRoute = routes[routes.length - 1];
|
||||||
|
|
||||||
|
const isAnimationEnabled = (key: string) => {
|
||||||
|
const descriptor = props.descriptors[key] || state.descriptors[key];
|
||||||
|
|
||||||
|
return descriptor ? descriptor.options.animationEnabled !== false : true;
|
||||||
|
};
|
||||||
|
|
||||||
if (
|
if (
|
||||||
previousFocusedRoute &&
|
previousFocusedRoute &&
|
||||||
previousFocusedRoute.key !== nextFocusedRoute.key
|
previousFocusedRoute.key !== nextFocusedRoute.key
|
||||||
@@ -97,21 +103,12 @@ class StackView extends React.Component<Props, State> {
|
|||||||
// We only need to animate routes if the focused route changed
|
// We only need to animate routes if the focused route changed
|
||||||
// Animating previous routes won't be visible coz the focused route is on top of everything
|
// Animating previous routes won't be visible coz the focused route is on top of everything
|
||||||
|
|
||||||
const isAnimationEnabled = (route: Route<string>) => {
|
|
||||||
const descriptor =
|
|
||||||
props.descriptors[route.key] || state.descriptors[route.key];
|
|
||||||
|
|
||||||
return descriptor
|
|
||||||
? descriptor.options.animationEnabled !== false
|
|
||||||
: true;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!previousRoutes.find(r => r.key === nextFocusedRoute.key)) {
|
if (!previousRoutes.find(r => r.key === nextFocusedRoute.key)) {
|
||||||
// A new route has come to the focus, we treat this as a push
|
// A new route has come to the focus, we treat this as a push
|
||||||
// A replace can also trigger this, the animation should look like push
|
// A replace can also trigger this, the animation should look like push
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isAnimationEnabled(nextFocusedRoute) &&
|
isAnimationEnabled(nextFocusedRoute.key) &&
|
||||||
!openingRouteKeys.includes(nextFocusedRoute.key)
|
!openingRouteKeys.includes(nextFocusedRoute.key)
|
||||||
) {
|
) {
|
||||||
// In this case, we need to animate pushing the focused route
|
// In this case, we need to animate pushing the focused route
|
||||||
@@ -151,7 +148,7 @@ class StackView extends React.Component<Props, State> {
|
|||||||
// The previously focused route was removed, we treat this as a pop
|
// The previously focused route was removed, we treat this as a pop
|
||||||
|
|
||||||
if (
|
if (
|
||||||
isAnimationEnabled(previousFocusedRoute) &&
|
isAnimationEnabled(previousFocusedRoute.key) &&
|
||||||
!closingRouteKeys.includes(previousFocusedRoute.key)
|
!closingRouteKeys.includes(previousFocusedRoute.key)
|
||||||
) {
|
) {
|
||||||
// Sometimes a route can be closed before the opening animation finishes
|
// Sometimes a route can be closed before the opening animation finishes
|
||||||
@@ -174,14 +171,15 @@ class StackView extends React.Component<Props, State> {
|
|||||||
// We don't know how to animate this
|
// We don't know how to animate this
|
||||||
}
|
}
|
||||||
} else if (replacingRouteKeys.length || closingRouteKeys.length) {
|
} else if (replacingRouteKeys.length || closingRouteKeys.length) {
|
||||||
// Keep the routes we are closing or replacing
|
// Keep the routes we are closing or replacing if animation is enabled for them
|
||||||
routes = routes.slice();
|
routes = routes.slice();
|
||||||
routes.splice(
|
routes.splice(
|
||||||
routes.length - 1,
|
routes.length - 1,
|
||||||
0,
|
0,
|
||||||
...state.routes.filter(
|
...state.routes.filter(({ key }) =>
|
||||||
({ key }) =>
|
isAnimationEnabled(key)
|
||||||
replacingRouteKeys.includes(key) || closingRouteKeys.includes(key)
|
? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key)
|
||||||
|
: false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
|
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"
|
||||||
|
|||||||