mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-18 18:08:17 +08:00
Compare commits
18 Commits
react-navi
...
react-navi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7656b35ee8 | ||
|
|
597aa51fad | ||
|
|
a929933bde | ||
|
|
911d6bb2f4 | ||
|
|
5afc82b11a | ||
|
|
80c8c9d1de | ||
|
|
fd7c5ca9b2 | ||
|
|
72bbebc80e | ||
|
|
915861e601 | ||
|
|
8152ae1212 | ||
|
|
79125bfab9 | ||
|
|
44c390075f | ||
|
|
1c5e7a5ff2 | ||
|
|
cfc1bac4e1 | ||
|
|
c0fb54b5a2 | ||
|
|
5927f4287f | ||
|
|
37a664b433 | ||
|
|
8d0b61f1b7 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,6 +4,7 @@
|
|||||||
.idea
|
.idea
|
||||||
.expo
|
.expo
|
||||||
.gradle
|
.gradle
|
||||||
|
.history
|
||||||
|
|
||||||
local.properties
|
local.properties
|
||||||
|
|
||||||
|
|||||||
@@ -335,7 +335,7 @@ class MainScreen extends React.Component<any, State> {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{(Object.keys(ExampleInfo) as (keyof typeof ExampleInfo)[]).map(
|
{(Object.keys(ExampleInfo) as (keyof typeof ExampleInfo)[]).map(
|
||||||
routeName => (
|
(routeName) => (
|
||||||
<RectButton
|
<RectButton
|
||||||
key={routeName}
|
key={routeName}
|
||||||
underlayColor="#ccc"
|
underlayColor="#ccc"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
module.exports = function(api) {
|
module.exports = function (api) {
|
||||||
api.cache(true);
|
api.cache(true);
|
||||||
return {
|
return {
|
||||||
presets: ['babel-preset-expo'],
|
presets: ['babel-preset-expo'],
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ const modules = ['@expo/vector-icons']
|
|||||||
// List all packages under `packages/`
|
// List all packages under `packages/`
|
||||||
.readdirSync(packages)
|
.readdirSync(packages)
|
||||||
// Ignore hidden files such as .DS_Store
|
// Ignore hidden files such as .DS_Store
|
||||||
.filter(p => !p.startsWith('.'))
|
.filter((p) => !p.startsWith('.'))
|
||||||
.map(p => {
|
.map((p) => {
|
||||||
const pak = JSON.parse(
|
const pak = JSON.parse(
|
||||||
fs.readFileSync(path.join(packages, p, 'package.json'), 'utf8')
|
fs.readFileSync(path.join(packages, p, 'package.json'), 'utf8')
|
||||||
);
|
);
|
||||||
@@ -50,7 +50,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
server: {
|
server: {
|
||||||
enhanceMiddleware: middleware => {
|
enhanceMiddleware: (middleware) => {
|
||||||
return (req, res, next) => {
|
return (req, res, next) => {
|
||||||
// When an asset is imported outside the project root, it has wrong path on Android
|
// When an asset is imported outside the project root, it has wrong path on Android
|
||||||
// This happens for the back button in stack, so we fix the path to correct one
|
// This happens for the back button in stack, so we fix the path to correct one
|
||||||
|
|||||||
@@ -8,9 +8,9 @@
|
|||||||
"ios": "expo start --ios"
|
"ios": "expo start --ios"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.8.4",
|
"@babel/runtime": "^7.8.7",
|
||||||
"@expo/vector-icons": "^10.0.6",
|
"@expo/vector-icons": "^10.0.6",
|
||||||
"@react-native-community/masked-view": "0.1.6",
|
"@react-native-community/masked-view": "0.1.7",
|
||||||
"expo": "^36.0.0",
|
"expo": "^36.0.0",
|
||||||
"expo-asset": "~8.0.0",
|
"expo-asset": "~8.0.0",
|
||||||
"expo-barcode-scanner": "^8.0.0",
|
"expo-barcode-scanner": "^8.0.0",
|
||||||
@@ -21,16 +21,16 @@
|
|||||||
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
|
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
|
||||||
"react-native-gesture-handler": "~1.6.0",
|
"react-native-gesture-handler": "~1.6.0",
|
||||||
"react-native-iphone-x-helper": "^1.2.1",
|
"react-native-iphone-x-helper": "^1.2.1",
|
||||||
"react-native-maps": "0.26.1",
|
"react-native-maps": "0.27.0",
|
||||||
"react-native-paper": "^3.4.0",
|
"react-native-paper": "^3.4.0",
|
||||||
"react-native-reanimated": "~1.7.0",
|
"react-native-reanimated": "~1.7.0",
|
||||||
"react-native-safe-area-context": "0.7.3",
|
"react-native-safe-area-context": "0.7.3",
|
||||||
"react-native-screens": "2.0.0-beta.10",
|
"react-native-screens": "2.3.0",
|
||||||
"react-native-webview": "8.1.2",
|
"react-native-webview": "8.1.2",
|
||||||
"react-navigation-header-buttons": "^3.0.5"
|
"react-navigation-header-buttons": "^3.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-plugin-module-resolver": "^4.0.0",
|
"babel-plugin-module-resolver": "^4.0.0",
|
||||||
"expo-cli": "^3.13.1"
|
"expo-cli": "^3.13.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ const CustomTabBar = ({
|
|||||||
const { routes } = navigation.state;
|
const { routes } = navigation.state;
|
||||||
return (
|
return (
|
||||||
<SafeAreaView style={styles.tabContainer}>
|
<SafeAreaView style={styles.tabContainer}>
|
||||||
{routes.map(route => (
|
{routes.map((route) => (
|
||||||
<BorderlessButton
|
<BorderlessButton
|
||||||
onPress={() => navigation.navigate(route.routeName)}
|
onPress={() => navigation.navigate(route.routeName)}
|
||||||
style={styles.tab}
|
style={styles.tab}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ const ContainerWithButtons = withNavigation(
|
|||||||
const MapScreen = () => (
|
const MapScreen = () => (
|
||||||
<ContainerWithButtons>
|
<ContainerWithButtons>
|
||||||
<DrawerGestureContext.Consumer>
|
<DrawerGestureContext.Consumer>
|
||||||
{ref => (
|
{(ref) => (
|
||||||
<NativeViewGestureHandler waitFor={ref}>
|
<NativeViewGestureHandler waitFor={ref}>
|
||||||
<MapView style={{ flex: 1 }} />
|
<MapView style={{ flex: 1 }} />
|
||||||
</NativeViewGestureHandler>
|
</NativeViewGestureHandler>
|
||||||
@@ -60,7 +60,7 @@ MapScreen.navigationOptions = {
|
|||||||
const WebViewScreen = () => (
|
const WebViewScreen = () => (
|
||||||
<ContainerWithButtons>
|
<ContainerWithButtons>
|
||||||
<DrawerGestureContext.Consumer>
|
<DrawerGestureContext.Consumer>
|
||||||
{ref => (
|
{(ref) => (
|
||||||
<NativeViewGestureHandler waitFor={ref}>
|
<NativeViewGestureHandler waitFor={ref}>
|
||||||
<WebView
|
<WebView
|
||||||
style={{ flex: 1 }}
|
style={{ flex: 1 }}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const BarCodeScreenBase = (
|
|||||||
<BarCodeScanner
|
<BarCodeScanner
|
||||||
onBarCodeScanned={
|
onBarCodeScanned={
|
||||||
props.isFocused
|
props.isFocused
|
||||||
? data => {
|
? (data) => {
|
||||||
console.log('scanned...');
|
console.log('scanned...');
|
||||||
props.navigation.navigate('Info', { data });
|
props.navigation.navigate('Info', { data });
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ BarCodeScreenBase.navigationOptions = {
|
|||||||
|
|
||||||
const BarCodeScreen = withNavigationFocus(BarCodeScreenBase);
|
const BarCodeScreen = withNavigationFocus(BarCodeScreenBase);
|
||||||
|
|
||||||
const InfoScreen: NavigationStackScreenComponent = props => {
|
const InfoScreen: NavigationStackScreenComponent = (props) => {
|
||||||
return (
|
return (
|
||||||
<View style={{ flex: 1 }}>
|
<View style={{ flex: 1 }}>
|
||||||
<Text>{JSON.stringify(props.navigation.getParam('data'))}</Text>
|
<Text>{JSON.stringify(props.navigation.getParam('data'))}</Text>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class ListScreen extends React.Component<
|
|||||||
state = { isInverted: false };
|
state = { isInverted: false };
|
||||||
|
|
||||||
onSwitch = () =>
|
onSwitch = () =>
|
||||||
this.setState(prevState => ({ isInverted: !prevState.isInverted }));
|
this.setState((prevState) => ({ isInverted: !prevState.isInverted }));
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ const DrawerContents = ({
|
|||||||
<Animated.View style={{ transform: [{ translateX }] }}>
|
<Animated.View style={{ transform: [{ translateX }] }}>
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<SafeAreaView forceInset={{ top: 'always' }}>
|
<SafeAreaView forceInset={{ top: 'always' }}>
|
||||||
{navigation.state.routes.map(route => (
|
{navigation.state.routes.map((route) => (
|
||||||
<DrawerItem
|
<DrawerItem
|
||||||
key={route.key}
|
key={route.key}
|
||||||
navigation={descriptors[route.key].navigation}
|
navigation={descriptors[route.key].navigation}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class RightDrawer extends Component<DrawerContentComponentProps> {
|
|||||||
<ScrollView
|
<ScrollView
|
||||||
style={{ height: '100%', width: '100%', backgroundColor: '#333333' }}
|
style={{ height: '100%', width: '100%', backgroundColor: '#333333' }}
|
||||||
>
|
>
|
||||||
{this.state.categories.map(key => {
|
{this.state.categories.map((key) => {
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={key.n}
|
key={key.n}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export default function PhotoGrid({ id }: { id: string }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<NavigationAwareScrollView contentContainerStyle={styles.content}>
|
<NavigationAwareScrollView contentContainerStyle={styles.content}>
|
||||||
{PHOTOS.map(uri => (
|
{PHOTOS.map((uri) => (
|
||||||
<View key={uri} style={styles.item}>
|
<View key={uri} style={styles.item}>
|
||||||
<Image source={{ uri }} style={styles.photo} />
|
<Image source={{ uri }} style={styles.photo} />
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ const ListScreen = (props: NavigationStackScreenProps) => (
|
|||||||
|
|
||||||
const AnotherScreen = () => (
|
const AnotherScreen = () => (
|
||||||
<CardAnimationContext.Consumer>
|
<CardAnimationContext.Consumer>
|
||||||
{value => {
|
{(value) => {
|
||||||
const scale = value
|
const scale = value
|
||||||
? value.current.progress.interpolate({
|
? value.current.progress.interpolate({
|
||||||
inputRange: [0, 1],
|
inputRange: [0, 1],
|
||||||
@@ -67,7 +67,7 @@ const YetAnotherScreen = () => (
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CardAnimationContext.Consumer>
|
<CardAnimationContext.Consumer>
|
||||||
{value => (
|
{(value) => (
|
||||||
<Animated.Text
|
<Animated.Text
|
||||||
style={{
|
style={{
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
@@ -84,7 +84,7 @@ const YetAnotherScreen = () => (
|
|||||||
)}
|
)}
|
||||||
</CardAnimationContext.Consumer>
|
</CardAnimationContext.Consumer>
|
||||||
<CardAnimationContext.Consumer>
|
<CardAnimationContext.Consumer>
|
||||||
{value => (
|
{(value) => (
|
||||||
<Animated.Text
|
<Animated.Text
|
||||||
style={{
|
style={{
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const Drawer = createDrawerNavigator(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
contentComponent: props => <Menu {...props} />,
|
contentComponent: (props) => <Menu {...props} />,
|
||||||
navigationOptions: { title: 'Example' },
|
navigationOptions: { title: 'Example' },
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
NavigationStackScreenComponent,
|
NavigationStackScreenComponent,
|
||||||
} from 'react-navigation-stack';
|
} from 'react-navigation-stack';
|
||||||
|
|
||||||
const ListScreen: NavigationStackScreenComponent = function(props) {
|
const ListScreen: NavigationStackScreenComponent = function (props) {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -29,7 +29,7 @@ const ListScreen: NavigationStackScreenComponent = function(props) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const ModalDialogScreen: NavigationStackScreenComponent = function(props) {
|
const ModalDialogScreen: NavigationStackScreenComponent = function (props) {
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -27,12 +27,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
||||||
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
||||||
"@babel/preset-env": "^7.8.4",
|
"@babel/preset-env": "^7.8.7",
|
||||||
"@babel/preset-react": "^7.8.3",
|
"@babel/preset-react": "^7.8.3",
|
||||||
"@babel/preset-typescript": "^7.8.3",
|
"@babel/preset-typescript": "^7.8.3",
|
||||||
"@babel/runtime": "^7.8.4",
|
"@babel/runtime": "^7.8.7",
|
||||||
"@commitlint/config-conventional": "^8.3.4",
|
"@commitlint/config-conventional": "^8.3.4",
|
||||||
"@types/jest": "^25.1.2",
|
"@types/jest": "^25.1.4",
|
||||||
"commitlint": "^8.3.5",
|
"commitlint": "^8.3.5",
|
||||||
"core-js": "^3.6.4",
|
"core-js": "^3.6.4",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
"husky": "^4.2.1",
|
"husky": "^4.2.1",
|
||||||
"jest": "^25.1.0",
|
"jest": "^25.1.0",
|
||||||
"lerna": "^3.20.2",
|
"lerna": "^3.20.2",
|
||||||
"prettier": "^1.19.1",
|
"prettier": "^2.0.1",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
|||||||
@@ -3,6 +3,38 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [0.5.6](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.5...react-navigation-animated-switch@0.5.6) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.5](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.4...react-navigation-animated-switch@0.5.5) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.4](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.3...react-navigation-animated-switch@0.5.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [0.5.3](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.2...react-navigation-animated-switch@0.5.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.5.2](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.1...react-navigation-animated-switch@0.5.2) (2020-02-26)
|
## [0.5.2](https://github.com/react-navigation/react-navigation/compare/react-navigation-animated-switch@0.5.1...react-navigation-animated-switch@0.5.2) (2020-02-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation-animated-switch
|
**Note:** Version bump only for package react-navigation-animated-switch
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-animated-switch",
|
"name": "react-navigation-animated-switch",
|
||||||
"version": "0.5.2",
|
"version": "0.5.6",
|
||||||
"description": "Animated switch for React Navigation",
|
"description": "Animated switch for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "0.9.7",
|
"@react-native-community/bob": "0.10.0",
|
||||||
"@types/react": "16.9.22",
|
"@types/react": "16.9.23",
|
||||||
"@types/react-native": "0.61.17",
|
"@types/react-native": "0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-reanimated": "~1.7.0",
|
"react-native-reanimated": "~1.7.0",
|
||||||
"react-navigation": "^4.2.2",
|
"react-navigation": "^4.3.3",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -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.
|
||||||
|
|
||||||
|
## [3.7.1](https://github.com/react-navigation/react-navigation-core/compare/@react-navigation/core@3.7.0...@react-navigation/core@3.7.1) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/core
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [3.7.0](https://github.com/react-navigation/react-navigation-core/compare/@react-navigation/core@3.6.1...@react-navigation/core@3.7.0) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add prune option to pop action to match v5 behaviour ([5927f42](https://github.com/react-navigation/react-navigation-core/commit/5927f4287f5e1ab106537865523daa1c03b14b47))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.6.1](https://github.com/react-navigation/react-navigation-core/compare/@react-navigation/core@3.6.0...@react-navigation/core@3.6.1) (2020-02-24)
|
## [3.6.1](https://github.com/react-navigation/react-navigation-core/compare/@react-navigation/core@3.6.0...@react-navigation/core@3.6.1) (2020-02-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/core",
|
"name": "@react-navigation/core",
|
||||||
"version": "3.6.1",
|
"version": "3.7.1",
|
||||||
"description": "Core utilities for the react-navigation framework",
|
"description": "Core utilities for the react-navigation framework",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public",
|
||||||
|
"tag": "4.x"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-navigation",
|
"react-navigation",
|
||||||
@@ -36,11 +37,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hoist-non-react-statics": "^3.3.2",
|
"hoist-non-react-statics": "^3.3.2",
|
||||||
"path-to-regexp": "^1.8.0",
|
"path-to-regexp": "^1.8.0",
|
||||||
"query-string": "^6.11.0",
|
"query-string": "^6.11.1",
|
||||||
"react-is": "^16.8.6"
|
"react-is": "^16.13.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const StateUtils = {
|
|||||||
* Gets a route by key. If the route isn't found, returns `null`.
|
* Gets a route by key. If the route isn't found, returns `null`.
|
||||||
*/
|
*/
|
||||||
get(state, key) {
|
get(state, key) {
|
||||||
return state.routes.find(route => route.key === key) || null;
|
return state.routes.find((route) => route.key === key) || null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +21,7 @@ const StateUtils = {
|
|||||||
* routes of the navigation state, or -1 if it is not present.
|
* routes of the navigation state, or -1 if it is not present.
|
||||||
*/
|
*/
|
||||||
indexOf(state, key) {
|
indexOf(state, key) {
|
||||||
return state.routes.findIndex(route => route.key === key);
|
return state.routes.findIndex((route) => route.key === key);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,7 +29,7 @@ const StateUtils = {
|
|||||||
* routes of the navigation state.
|
* routes of the navigation state.
|
||||||
*/
|
*/
|
||||||
has(state, key) {
|
has(state, key) {
|
||||||
return !!state.routes.some(route => route.key === key);
|
return !!state.routes.some((route) => route.key === key);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import getChildEventSubscriber from '../getChildEventSubscriber';
|
|||||||
|
|
||||||
it('child action events only flow when focused', () => {
|
it('child action events only flow when focused', () => {
|
||||||
const parentSubscriber = jest.fn();
|
const parentSubscriber = jest.fn();
|
||||||
const emitParentAction = payload => {
|
const emitParentAction = (payload) => {
|
||||||
parentSubscriber.mock.calls.forEach(subs => {
|
parentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
@@ -52,8 +52,8 @@ it('child action events only flow when focused', () => {
|
|||||||
|
|
||||||
it('grandchildren subscription', () => {
|
it('grandchildren subscription', () => {
|
||||||
const grandParentSubscriber = jest.fn();
|
const grandParentSubscriber = jest.fn();
|
||||||
const emitGrandParentAction = payload => {
|
const emitGrandParentAction = (payload) => {
|
||||||
grandParentSubscriber.mock.calls.forEach(subs => {
|
grandParentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
@@ -119,8 +119,8 @@ it('grandchildren subscription', () => {
|
|||||||
|
|
||||||
it('grandchildren transitions', () => {
|
it('grandchildren transitions', () => {
|
||||||
const grandParentSubscriber = jest.fn();
|
const grandParentSubscriber = jest.fn();
|
||||||
const emitGrandParentAction = payload => {
|
const emitGrandParentAction = (payload) => {
|
||||||
grandParentSubscriber.mock.calls.forEach(subs => {
|
grandParentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
@@ -212,8 +212,8 @@ it('grandchildren transitions', () => {
|
|||||||
|
|
||||||
it('grandchildren pass through transitions', () => {
|
it('grandchildren pass through transitions', () => {
|
||||||
const grandParentSubscriber = jest.fn();
|
const grandParentSubscriber = jest.fn();
|
||||||
const emitGrandParentAction = payload => {
|
const emitGrandParentAction = (payload) => {
|
||||||
grandParentSubscriber.mock.calls.forEach(subs => {
|
grandParentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
@@ -305,8 +305,8 @@ it('grandchildren pass through transitions', () => {
|
|||||||
|
|
||||||
it('child focus with transition', () => {
|
it('child focus with transition', () => {
|
||||||
const parentSubscriber = jest.fn();
|
const parentSubscriber = jest.fn();
|
||||||
const emitParentAction = payload => {
|
const emitParentAction = (payload) => {
|
||||||
parentSubscriber.mock.calls.forEach(subs => {
|
parentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
@@ -398,8 +398,8 @@ it('child focus with transition', () => {
|
|||||||
|
|
||||||
it('child focus with immediate transition', () => {
|
it('child focus with immediate transition', () => {
|
||||||
const parentSubscriber = jest.fn();
|
const parentSubscriber = jest.fn();
|
||||||
const emitParentAction = payload => {
|
const emitParentAction = (payload) => {
|
||||||
parentSubscriber.mock.calls.forEach(subs => {
|
parentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
@@ -461,8 +461,8 @@ it('child focus with immediate transition', () => {
|
|||||||
|
|
||||||
const setupEventTest = (subscriptionKey, initialLastFocusEvent) => {
|
const setupEventTest = (subscriptionKey, initialLastFocusEvent) => {
|
||||||
const parentSubscriber = jest.fn();
|
const parentSubscriber = jest.fn();
|
||||||
const emitEvent = payload => {
|
const emitEvent = (payload) => {
|
||||||
parentSubscriber.mock.calls.forEach(subs => {
|
parentSubscriber.mock.calls.forEach((subs) => {
|
||||||
if (subs[0] === payload.type) {
|
if (subs[0] === payload.type) {
|
||||||
subs[1](payload);
|
subs[1](payload);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ it('getNavigation provides default action helpers', () => {
|
|||||||
it.skip('getNavigation provides router action helpers', () => {
|
it.skip('getNavigation provides router action helpers', () => {
|
||||||
const router = {
|
const router = {
|
||||||
getActionCreators: () => ({
|
getActionCreators: () => ({
|
||||||
foo: bar => ({ type: 'FooBarAction', bar }),
|
foo: (bar) => ({ type: 'FooBarAction', bar }),
|
||||||
}),
|
}),
|
||||||
getStateForAction(action, lastState = {}) {
|
getStateForAction(action, lastState = {}) {
|
||||||
return lastState;
|
return lastState;
|
||||||
|
|||||||
@@ -24,12 +24,12 @@ export default function getChildEventSubscriber(
|
|||||||
willBlurSubscribers,
|
willBlurSubscribers,
|
||||||
didBlurSubscribers,
|
didBlurSubscribers,
|
||||||
refocusSubscribers,
|
refocusSubscribers,
|
||||||
].forEach(set => set.clear());
|
].forEach((set) => set.clear());
|
||||||
|
|
||||||
upstreamSubscribers.forEach(subs => subs && subs.remove());
|
upstreamSubscribers.forEach((subs) => subs && subs.remove());
|
||||||
};
|
};
|
||||||
|
|
||||||
const getChildSubscribers = evtName => {
|
const getChildSubscribers = (evtName) => {
|
||||||
switch (evtName) {
|
switch (evtName) {
|
||||||
case 'action':
|
case 'action':
|
||||||
return actionSubscribers;
|
return actionSubscribers;
|
||||||
@@ -52,7 +52,7 @@ export default function getChildEventSubscriber(
|
|||||||
const payloadWithType = { ...payload, type };
|
const payloadWithType = { ...payload, type };
|
||||||
const subscribers = getChildSubscribers(type);
|
const subscribers = getChildSubscribers(type);
|
||||||
subscribers &&
|
subscribers &&
|
||||||
subscribers.forEach(subs => {
|
subscribers.forEach((subs) => {
|
||||||
subs(payloadWithType);
|
subs(payloadWithType);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -72,8 +72,8 @@ export default function getChildEventSubscriber(
|
|||||||
'action',
|
'action',
|
||||||
];
|
];
|
||||||
|
|
||||||
const upstreamSubscribers = upstreamEvents.map(eventName =>
|
const upstreamSubscribers = upstreamEvents.map((eventName) =>
|
||||||
addListener(eventName, payload => {
|
addListener(eventName, (payload) => {
|
||||||
if (eventName === 'refocus') {
|
if (eventName === 'refocus') {
|
||||||
emit(eventName, payload);
|
emit(eventName, payload);
|
||||||
return;
|
return;
|
||||||
@@ -89,8 +89,8 @@ export default function getChildEventSubscriber(
|
|||||||
|
|
||||||
const isChildFocused = focusKey === key;
|
const isChildFocused = focusKey === key;
|
||||||
const lastRoute =
|
const lastRoute =
|
||||||
lastRoutes && lastRoutes.find(route => route.key === key);
|
lastRoutes && lastRoutes.find((route) => route.key === key);
|
||||||
const newRoute = routes && routes.find(route => route.key === key);
|
const newRoute = routes && routes.find((route) => route.key === key);
|
||||||
const childPayload = {
|
const childPayload = {
|
||||||
context: `${key}:${action.type}_${payload.context || 'Root'}`,
|
context: `${key}:${action.type}_${payload.context || 'Root'}`,
|
||||||
state: newRoute,
|
state: newRoute,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import getChildRouter from './getChildRouter';
|
|||||||
import getNavigationActionCreators from './routers/getNavigationActionCreators';
|
import getNavigationActionCreators from './routers/getNavigationActionCreators';
|
||||||
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
import getChildrenNavigationCache from './getChildrenNavigationCache';
|
||||||
|
|
||||||
const createParamGetter = route => (paramName, defaultValue) => {
|
const createParamGetter = (route) => (paramName, defaultValue) => {
|
||||||
const params = route.params;
|
const params = route.params;
|
||||||
|
|
||||||
if (params && paramName in params) {
|
if (params && paramName in params) {
|
||||||
@@ -15,7 +15,7 @@ const createParamGetter = route => (paramName, defaultValue) => {
|
|||||||
|
|
||||||
function getChildNavigation(navigation, childKey, getCurrentParentNavigation) {
|
function getChildNavigation(navigation, childKey, getCurrentParentNavigation) {
|
||||||
const children = getChildrenNavigationCache(navigation);
|
const children = getChildrenNavigationCache(navigation);
|
||||||
const childRoute = navigation.state.routes.find(r => r.key === childKey);
|
const childRoute = navigation.state.routes.find((r) => r.key === childKey);
|
||||||
|
|
||||||
if (!childRoute) {
|
if (!childRoute) {
|
||||||
return null;
|
return null;
|
||||||
@@ -47,7 +47,7 @@ function getChildNavigation(navigation, childKey, getCurrentParentNavigation) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const actionHelpers = {};
|
const actionHelpers = {};
|
||||||
Object.keys(actionCreators).forEach(actionName => {
|
Object.keys(actionCreators).forEach((actionName) => {
|
||||||
actionHelpers[actionName] = (...args) => {
|
actionHelpers[actionName] = (...args) => {
|
||||||
const actionCreator = actionCreators[actionName];
|
const actionCreator = actionCreators[actionName];
|
||||||
const action = actionCreator(...args);
|
const action = actionCreator(...args);
|
||||||
@@ -91,7 +91,7 @@ function getChildNavigation(navigation, childKey, getCurrentParentNavigation) {
|
|||||||
actions: actionCreators,
|
actions: actionCreators,
|
||||||
getParam: createParamGetter(childRoute),
|
getParam: createParamGetter(childRoute),
|
||||||
|
|
||||||
getChildNavigation: grandChildKey =>
|
getChildNavigation: (grandChildKey) =>
|
||||||
getChildNavigation(children[childKey], grandChildKey, () => {
|
getChildNavigation(children[childKey], grandChildKey, () => {
|
||||||
const nav = getCurrentParentNavigation();
|
const nav = getCurrentParentNavigation();
|
||||||
return nav && nav.getChildNavigation(childKey);
|
return nav && nav.getChildNavigation(childKey);
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ export default function getChildrenNavigationCache(navigation) {
|
|||||||
|
|
||||||
let childrenNavigationCache =
|
let childrenNavigationCache =
|
||||||
navigation._childrenNavigation || (navigation._childrenNavigation = {});
|
navigation._childrenNavigation || (navigation._childrenNavigation = {});
|
||||||
let childKeys = navigation.state.routes.map(route => route.key);
|
let childKeys = navigation.state.routes.map((route) => route.key);
|
||||||
Object.keys(childrenNavigationCache).forEach(cacheKey => {
|
Object.keys(childrenNavigationCache).forEach((cacheKey) => {
|
||||||
if (!childKeys.includes(cacheKey) && !navigation.state.isTransitioning) {
|
if (!childKeys.includes(cacheKey) && !navigation.state.isTransitioning) {
|
||||||
delete childrenNavigationCache[cacheKey];
|
delete childrenNavigationCache[cacheKey];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ export default function getNavigation(
|
|||||||
state,
|
state,
|
||||||
dispatch,
|
dispatch,
|
||||||
getScreenProps,
|
getScreenProps,
|
||||||
getChildNavigation: childKey =>
|
getChildNavigation: (childKey) =>
|
||||||
getChildNavigation(navigation, childKey, getCurrentNavigation),
|
getChildNavigation(navigation, childKey, getCurrentNavigation),
|
||||||
isFocused: childKey => {
|
isFocused: (childKey) => {
|
||||||
const { routes, index } = getCurrentNavigation().state;
|
const { routes, index } = getCurrentNavigation().state;
|
||||||
if (childKey == null || routes[index].key === childKey) {
|
if (childKey == null || routes[index].key === childKey) {
|
||||||
return true;
|
return true;
|
||||||
@@ -48,7 +48,7 @@ export default function getNavigation(
|
|||||||
...actions,
|
...actions,
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(actionCreators).forEach(actionName => {
|
Object.keys(actionCreators).forEach((actionName) => {
|
||||||
navigation[actionName] = (...args) =>
|
navigation[actionName] = (...args) =>
|
||||||
navigation.dispatch(actionCreators[actionName](...args));
|
navigation.dispatch(actionCreators[actionName](...args));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { render, fireEvent } from 'react-native-testing-library';
|
|||||||
import { createAppContainer } from '@react-navigation/native';
|
import { createAppContainer } from '@react-navigation/native';
|
||||||
import createSwitchNavigator from '../createSwitchNavigator';
|
import createSwitchNavigator from '../createSwitchNavigator';
|
||||||
|
|
||||||
const getActiveRouteName = state => state.routes[state.index].routeName;
|
const getActiveRouteName = (state) => state.routes[state.index].routeName;
|
||||||
const createScreen = (routeName, nextRouteName) => props => (
|
const createScreen = (routeName, nextRouteName) => (props) => (
|
||||||
<View>
|
<View>
|
||||||
<Text testID="title">{routeName}</Text>
|
<Text testID="title">{routeName}</Text>
|
||||||
<Text testID={routeName + '-isFirstRoute'}>
|
<Text testID={routeName + '-isFirstRoute'}>
|
||||||
|
|||||||
@@ -5,33 +5,33 @@ export const RESET = 'Navigation/RESET';
|
|||||||
export const REPLACE = 'Navigation/REPLACE';
|
export const REPLACE = 'Navigation/REPLACE';
|
||||||
export const COMPLETE_TRANSITION = 'Navigation/COMPLETE_TRANSITION';
|
export const COMPLETE_TRANSITION = 'Navigation/COMPLETE_TRANSITION';
|
||||||
|
|
||||||
export const pop = payload => ({
|
export const pop = (payload) => ({
|
||||||
type: POP,
|
type: POP,
|
||||||
...payload,
|
...payload,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const popToTop = payload => ({
|
export const popToTop = (payload) => ({
|
||||||
type: POP_TO_TOP,
|
type: POP_TO_TOP,
|
||||||
...payload,
|
...payload,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const push = payload => ({
|
export const push = (payload) => ({
|
||||||
type: PUSH,
|
type: PUSH,
|
||||||
...payload,
|
...payload,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const reset = payload => ({
|
export const reset = (payload) => ({
|
||||||
type: RESET,
|
type: RESET,
|
||||||
key: null,
|
key: null,
|
||||||
...payload,
|
...payload,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const replace = payload => ({
|
export const replace = (payload) => ({
|
||||||
type: REPLACE,
|
type: REPLACE,
|
||||||
...payload,
|
...payload,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const completeTransition = payload => ({
|
export const completeTransition = (payload) => ({
|
||||||
type: COMPLETE_TRANSITION,
|
type: COMPLETE_TRANSITION,
|
||||||
preserveFocus: true,
|
preserveFocus: true,
|
||||||
...payload,
|
...payload,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
const routeNames = Object.keys(routeConfigs);
|
const routeNames = Object.keys(routeConfigs);
|
||||||
|
|
||||||
// Loop through routes and find child routers
|
// Loop through routes and find child routers
|
||||||
routeNames.forEach(routeName => {
|
routeNames.forEach((routeName) => {
|
||||||
// We're not using `getScreenForRouteName` here to preserve the lazy loading
|
// We're not using `getScreenForRouteName` here to preserve the lazy loading
|
||||||
// behaviour of routes. This means that routes with child routers must be
|
// behaviour of routes. This means that routes with child routers must be
|
||||||
// defined using a component directly or with an object with a screen prop.
|
// defined using a component directly or with an object with a screen prop.
|
||||||
@@ -152,7 +152,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
n,
|
n,
|
||||||
...params,
|
...params,
|
||||||
}),
|
}),
|
||||||
popToTop: params => StackActions.popToTop(params),
|
popToTop: (params) => StackActions.popToTop(params),
|
||||||
push: (routeName, params, action) =>
|
push: (routeName, params, action) =>
|
||||||
StackActions.push({
|
StackActions.push({
|
||||||
routeName,
|
routeName,
|
||||||
@@ -280,7 +280,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
|
|
||||||
// Before pushing a new route we first try to find one in the existing route stack
|
// Before pushing a new route we first try to find one in the existing route stack
|
||||||
// More information on this: https://github.com/react-navigation/rfcs/blob/master/text/0004-less-pushy-navigate.md
|
// More information on this: https://github.com/react-navigation/rfcs/blob/master/text/0004-less-pushy-navigate.md
|
||||||
const lastRouteIndex = state.routes.findIndex(r => {
|
const lastRouteIndex = state.routes.findIndex((r) => {
|
||||||
if (action.key) {
|
if (action.key) {
|
||||||
return r.key === action.key;
|
return r.key === action.key;
|
||||||
} else {
|
} else {
|
||||||
@@ -425,7 +425,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
if (action.key === undefined && state.routes.length) {
|
if (action.key === undefined && state.routes.length) {
|
||||||
routeIndex = state.routes.length - 1;
|
routeIndex = state.routes.length - 1;
|
||||||
} else {
|
} else {
|
||||||
routeIndex = state.routes.findIndex(r => r.key === action.key);
|
routeIndex = state.routes.findIndex((r) => r.key === action.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only replace if the key matches one of our routes
|
// Only replace if the key matches one of our routes
|
||||||
@@ -467,7 +467,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
|
|
||||||
if (action.type === NavigationActions.SET_PARAMS) {
|
if (action.type === NavigationActions.SET_PARAMS) {
|
||||||
const key = action.key;
|
const key = action.key;
|
||||||
const lastRoute = state.routes.find(route => route.key === key);
|
const lastRoute = state.routes.find((route) => route.key === key);
|
||||||
if (lastRoute) {
|
if (lastRoute) {
|
||||||
const params = {
|
const params = {
|
||||||
...lastRoute.params,
|
...lastRoute.params,
|
||||||
@@ -496,7 +496,7 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
routes: newStackActions.map(newStackAction => {
|
routes: newStackActions.map((newStackAction) => {
|
||||||
const router = childRouters[newStackAction.routeName];
|
const router = childRouters[newStackAction.routeName];
|
||||||
|
|
||||||
let childState = {};
|
let childState = {};
|
||||||
@@ -532,24 +532,43 @@ export default (routeConfigs, stackConfig = {}) => {
|
|||||||
action.type === NavigationActions.BACK ||
|
action.type === NavigationActions.BACK ||
|
||||||
action.type === StackActions.POP
|
action.type === StackActions.POP
|
||||||
) {
|
) {
|
||||||
const { key, n, immediate } = action;
|
const { key, n, immediate, prune } = action;
|
||||||
let backRouteIndex = state.index;
|
|
||||||
if (action.type === StackActions.POP && n != null) {
|
|
||||||
// determine the index to go back *from*. In this case, n=1 means to go
|
|
||||||
// back from state.index, as if it were a normal "BACK" action
|
|
||||||
backRouteIndex = Math.max(1, state.index - n + 1);
|
|
||||||
} else if (key) {
|
|
||||||
const backRoute = state.routes.find(route => route.key === key);
|
|
||||||
backRouteIndex = state.routes.indexOf(backRoute);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (backRouteIndex > 0) {
|
if (action.type === StackActions.POP && prune === false && key) {
|
||||||
return {
|
const index = state.routes.findIndex((r) => r.key === key);
|
||||||
...state,
|
const count = Math.max(index - (n == null ? 1 : n) + 1, 1);
|
||||||
routes: state.routes.slice(0, backRouteIndex),
|
const routes = state.routes
|
||||||
index: backRouteIndex - 1,
|
.slice(0, count)
|
||||||
isTransitioning: immediate !== true,
|
.concat(state.routes.slice(index + 1));
|
||||||
};
|
|
||||||
|
if (routes.length) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
routes,
|
||||||
|
index: routes.length - 1,
|
||||||
|
isTransitioning: immediate !== true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let backRouteIndex = state.index;
|
||||||
|
|
||||||
|
if (action.type === StackActions.POP && n != null) {
|
||||||
|
// determine the index to go back *from*. In this case, n=1 means to go
|
||||||
|
// back from state.index, as if it were a normal "BACK" action
|
||||||
|
backRouteIndex = Math.max(1, state.index - n + 1);
|
||||||
|
} else if (key) {
|
||||||
|
const backRoute = state.routes.find((route) => route.key === key);
|
||||||
|
backRouteIndex = state.routes.indexOf(backRoute);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (backRouteIndex > 0) {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
routes: state.routes.slice(0, backRouteIndex),
|
||||||
|
index: backRouteIndex - 1,
|
||||||
|
isTransitioning: immediate !== true,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,12 +30,12 @@ export default (routeConfigs, config = {}) => {
|
|||||||
if (initialRouteIndex === -1) {
|
if (initialRouteIndex === -1) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Invalid initialRouteName '${initialRouteName}'.` +
|
`Invalid initialRouteName '${initialRouteName}'.` +
|
||||||
`Should be one of ${order.map(n => `"${n}"`).join(', ')}`
|
`Should be one of ${order.map((n) => `"${n}"`).join(', ')}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const childRouters = {};
|
const childRouters = {};
|
||||||
order.forEach(routeName => {
|
order.forEach((routeName) => {
|
||||||
childRouters[routeName] = null;
|
childRouters[routeName] = null;
|
||||||
const screen = getScreenForRouteName(routeConfigs, routeName);
|
const screen = getScreenForRouteName(routeConfigs, routeName);
|
||||||
if (screen.router) {
|
if (screen.router) {
|
||||||
@@ -93,7 +93,7 @@ export default (routeConfigs, config = {}) => {
|
|||||||
if (action.type === NavigationActions.NAVIGATE) {
|
if (action.type === NavigationActions.NAVIGATE) {
|
||||||
nextRouteKeyHistory = [...nextRouteKeyHistory]; // copy
|
nextRouteKeyHistory = [...nextRouteKeyHistory]; // copy
|
||||||
const keyToAdd = nextState.routes[nextState.index].key;
|
const keyToAdd = nextState.routes[nextState.index].key;
|
||||||
nextRouteKeyHistory = nextRouteKeyHistory.filter(k => k !== keyToAdd); // dedup
|
nextRouteKeyHistory = nextRouteKeyHistory.filter((k) => k !== keyToAdd); // dedup
|
||||||
nextRouteKeyHistory.push(keyToAdd);
|
nextRouteKeyHistory.push(keyToAdd);
|
||||||
} else if (action.type === NavigationActions.BACK) {
|
} else if (action.type === NavigationActions.BACK) {
|
||||||
nextRouteKeyHistory = [...nextRouteKeyHistory]; // copy
|
nextRouteKeyHistory = [...nextRouteKeyHistory]; // copy
|
||||||
@@ -156,7 +156,7 @@ export default (routeConfigs, config = {}) => {
|
|||||||
// Merge any params from the action into all the child routes
|
// Merge any params from the action into all the child routes
|
||||||
const { params } = action;
|
const { params } = action;
|
||||||
if (params) {
|
if (params) {
|
||||||
state.routes = state.routes.map(route => ({
|
state.routes = state.routes.map((route) => ({
|
||||||
...route,
|
...route,
|
||||||
params: {
|
params: {
|
||||||
...route.params,
|
...route.params,
|
||||||
@@ -175,14 +175,14 @@ export default (routeConfigs, config = {}) => {
|
|||||||
) {
|
) {
|
||||||
const { params } = action;
|
const { params } = action;
|
||||||
const index = state.routes.findIndex(
|
const index = state.routes.findIndex(
|
||||||
route => route.routeName === action.routeName
|
(route) => route.routeName === action.routeName
|
||||||
);
|
);
|
||||||
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`There is no route named '${action.routeName}' in the navigator with the key '${action.key}'.\n` +
|
`There is no route named '${action.routeName}' in the navigator with the key '${action.key}'.\n` +
|
||||||
`Must be one of: ${state.routes
|
`Must be one of: ${state.routes
|
||||||
.map(route => `'${route.routeName}'`)
|
.map((route) => `'${route.routeName}'`)
|
||||||
.join(',')}`
|
.join(',')}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -305,7 +305,7 @@ export default (routeConfigs, config = {}) => {
|
|||||||
|
|
||||||
if (action.type === NavigationActions.SET_PARAMS) {
|
if (action.type === NavigationActions.SET_PARAMS) {
|
||||||
const key = action.key;
|
const key = action.key;
|
||||||
const lastRoute = state.routes.find(route => route.key === key);
|
const lastRoute = state.routes.find((route) => route.key === key);
|
||||||
if (lastRoute) {
|
if (lastRoute) {
|
||||||
const params = {
|
const params = {
|
||||||
...lastRoute.params,
|
...lastRoute.params,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ beforeEach(() => {
|
|||||||
_TESTING_ONLY_normalize_keys();
|
_TESTING_ONLY_normalize_keys();
|
||||||
});
|
});
|
||||||
|
|
||||||
const performRouterTest = createTestRouter => {
|
const performRouterTest = (createTestRouter) => {
|
||||||
const ListScreen = () => <div />;
|
const ListScreen = () => <div />;
|
||||||
|
|
||||||
const ProfileNavigator = () => <div />;
|
const ProfileNavigator = () => <div />;
|
||||||
@@ -584,7 +584,7 @@ it('Handles nested switch routers', () => {
|
|||||||
expect(action.action.routeName).toEqual('B');
|
expect(action.action.routeName).toEqual('B');
|
||||||
});
|
});
|
||||||
|
|
||||||
const performRouteNameAsPathDisabledTest = createTestRouter => {
|
const performRouteNameAsPathDisabledTest = (createTestRouter) => {
|
||||||
const BScreen = () => <div />;
|
const BScreen = () => <div />;
|
||||||
const NestedNavigator = () => <div />;
|
const NestedNavigator = () => <div />;
|
||||||
NestedNavigator.router = createTestRouter({
|
NestedNavigator.router = createTestRouter({
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const dummyEventSubscriber = () => ({
|
|||||||
remove: () => {},
|
remove: () => {},
|
||||||
});
|
});
|
||||||
|
|
||||||
Object.keys(ROUTERS).forEach(routerName => {
|
Object.keys(ROUTERS).forEach((routerName) => {
|
||||||
const Router = ROUTERS[routerName];
|
const Router = ROUTERS[routerName];
|
||||||
|
|
||||||
describe(`General router features - ${routerName}`, () => {
|
describe(`General router features - ${routerName}`, () => {
|
||||||
@@ -441,7 +441,7 @@ it('Inner actions are only unpacked if the current tab matches', () => {
|
|||||||
routes: [screenApreState],
|
routes: [screenApreState],
|
||||||
};
|
};
|
||||||
|
|
||||||
const comparable = state => {
|
const comparable = (state) => {
|
||||||
let result = {};
|
let result = {};
|
||||||
if (typeof state.routeName === 'string') {
|
if (typeof state.routeName === 'string') {
|
||||||
result = { ...result, routeName: state.routeName };
|
result = { ...result, routeName: state.routeName };
|
||||||
|
|||||||
@@ -562,6 +562,31 @@ describe('StackRouter', () => {
|
|||||||
expect(poppedState3.routes.length).toBe(1);
|
expect(poppedState3.routes.length).toBe(1);
|
||||||
expect(poppedState3.index).toBe(0);
|
expect(poppedState3.index).toBe(0);
|
||||||
expect(poppedState3.isTransitioning).toBe(true);
|
expect(poppedState3.isTransitioning).toBe(true);
|
||||||
|
|
||||||
|
const poppedState4 = TestRouter.getStateForAction(
|
||||||
|
StackActions.pop({ key: 'C', prune: false, immediate: true }),
|
||||||
|
state
|
||||||
|
);
|
||||||
|
expect(poppedState4.routes.length).toBe(3);
|
||||||
|
expect(poppedState4.index).toBe(2);
|
||||||
|
expect(poppedState4.isTransitioning).toBe(false);
|
||||||
|
expect(poppedState4.routes).toEqual([
|
||||||
|
{ key: 'A', routeName: 'foo' },
|
||||||
|
{ key: 'B', routeName: 'bar', params: { bazId: '321' } },
|
||||||
|
{ key: 'D', routeName: 'bar' },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const poppedState5 = TestRouter.getStateForAction(
|
||||||
|
StackActions.pop({ n: 2, key: 'C', prune: false }),
|
||||||
|
state
|
||||||
|
);
|
||||||
|
expect(poppedState5.routes.length).toBe(2);
|
||||||
|
expect(poppedState5.index).toBe(1);
|
||||||
|
expect(poppedState5.isTransitioning).toBe(true);
|
||||||
|
expect(poppedState5.routes).toEqual([
|
||||||
|
{ key: 'A', routeName: 'foo' },
|
||||||
|
{ key: 'D', routeName: 'bar' },
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('popToTop works as expected', () => {
|
it('popToTop works as expected', () => {
|
||||||
|
|||||||
@@ -775,7 +775,7 @@ describe('TabRouter', () => {
|
|||||||
routes: [screenApreState],
|
routes: [screenApreState],
|
||||||
};
|
};
|
||||||
|
|
||||||
const comparable = state => {
|
const comparable = (state) => {
|
||||||
let result = {};
|
let result = {};
|
||||||
if (typeof state.routeName === 'string') {
|
if (typeof state.routeName === 'string') {
|
||||||
result = { ...result, routeName: state.routeName };
|
result = { ...result, routeName: state.routeName };
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export const getRouterTestHelper = (router, options = defaultOptions) => {
|
|||||||
? undefined
|
? undefined
|
||||||
: router.getStateForAction({ type: NavigationActions.INIT });
|
: router.getStateForAction({ type: NavigationActions.INIT });
|
||||||
|
|
||||||
const applyAction = action => {
|
const applyAction = (action) => {
|
||||||
state = router.getStateForAction(action, state);
|
state = router.getStateForAction(action, state);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ export const getRouterTestHelper = (router, options = defaultOptions) => {
|
|||||||
...otherActionAttributes,
|
...otherActionAttributes,
|
||||||
});
|
});
|
||||||
|
|
||||||
const back = key =>
|
const back = (key) =>
|
||||||
applyAction({
|
applyAction({
|
||||||
type: NavigationActions.BACK,
|
type: NavigationActions.BACK,
|
||||||
key,
|
key,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default function getScreenForRouteName(routeConfigs, routeName) {
|
|||||||
throw new Error(
|
throw new Error(
|
||||||
`There is no route defined for key ${routeName}.\n` +
|
`There is no route defined for key ${routeName}.\n` +
|
||||||
`Must be one of: ${Object.keys(routeConfigs)
|
`Must be one of: ${Object.keys(routeConfigs)
|
||||||
.map(a => `'${a}'`)
|
.map((a) => `'${a}'`)
|
||||||
.join(',')}`
|
.join(',')}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const getParamsFromPath = (inputParams, pathMatch, pathMatchKeys) => {
|
|||||||
return params;
|
return params;
|
||||||
};
|
};
|
||||||
const getRestOfPath = (pathMatch, pathMatchKeys) => {
|
const getRestOfPath = (pathMatch, pathMatchKeys) => {
|
||||||
const rest = pathMatch[pathMatchKeys.findIndex(k => k.asterisk) + 1];
|
const rest = pathMatch[pathMatchKeys.findIndex((k) => k.asterisk) + 1];
|
||||||
return rest;
|
return rest;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ export const createPathParser = (
|
|||||||
let paths = [];
|
let paths = [];
|
||||||
|
|
||||||
// Build pathsByRouteNames, which includes a regex to match paths for each route. Keep in mind, the regex will pass for the route and all child routes. The code that uses pathsByRouteNames will need to also verify that the child router produces an action, in the case of isPathMatchable false (a null path).
|
// Build pathsByRouteNames, which includes a regex to match paths for each route. Keep in mind, the regex will pass for the route and all child routes. The code that uses pathsByRouteNames will need to also verify that the child router produces an action, in the case of isPathMatchable false (a null path).
|
||||||
Object.keys(childRouters).forEach(routeName => {
|
Object.keys(childRouters).forEach((routeName) => {
|
||||||
let pathPattern;
|
let pathPattern;
|
||||||
|
|
||||||
// First check for paths on the router, then check the route config
|
// First check for paths on the router, then check the route config
|
||||||
@@ -189,7 +189,7 @@ export const createPathParser = (
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
const getPathAndParamsForRoute = route => {
|
const getPathAndParamsForRoute = (route) => {
|
||||||
const { routeName, params } = route;
|
const { routeName, params } = route;
|
||||||
const childRouter = childRouters[routeName];
|
const childRouter = childRouters[routeName];
|
||||||
const { toPath, exactReKeys } = pathsByRouteNames[routeName];
|
const { toPath, exactReKeys } = pathsByRouteNames[routeName];
|
||||||
@@ -197,8 +197,8 @@ export const createPathParser = (
|
|||||||
const nonPathParams = {};
|
const nonPathParams = {};
|
||||||
if (params) {
|
if (params) {
|
||||||
Object.keys(params)
|
Object.keys(params)
|
||||||
.filter(paramName => !exactReKeys.find(k => k.name === paramName))
|
.filter((paramName) => !exactReKeys.find((k) => k.name === paramName))
|
||||||
.forEach(paramName => {
|
.forEach((paramName) => {
|
||||||
nonPathParams[paramName] = params[paramName];
|
nonPathParams[paramName] = params[paramName];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ function validateRouteConfigMap(routeConfigs) {
|
|||||||
'Please specify at least one route when configuring a navigator.'
|
'Please specify at least one route when configuring a navigator.'
|
||||||
);
|
);
|
||||||
|
|
||||||
routeNames.forEach(routeName => {
|
routeNames.forEach((routeName) => {
|
||||||
const routeConfig = routeConfigs[routeName];
|
const routeConfig = routeConfigs[routeName];
|
||||||
const screenComponent = getScreenComponent(routeConfig);
|
const screenComponent = getScreenComponent(routeConfig);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const deprecatedKeys = ['tabBar'];
|
|||||||
export default (screenOptions, route) => {
|
export default (screenOptions, route) => {
|
||||||
const keys = Object.keys(screenOptions);
|
const keys = Object.keys(screenOptions);
|
||||||
|
|
||||||
const deprecatedKey = keys.find(key => deprecatedKeys.includes(key));
|
const deprecatedKey = keys.find((key) => deprecatedKeys.includes(key));
|
||||||
|
|
||||||
if (typeof screenOptions.title === 'function') {
|
if (typeof screenOptions.title === 'function') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -54,7 +54,7 @@ export default (screenOptions, route) => {
|
|||||||
'{',
|
'{',
|
||||||
` ${deprecatedKey}: {`,
|
` ${deprecatedKey}: {`,
|
||||||
...Object.keys(screenOptions[deprecatedKey]).map(
|
...Object.keys(screenOptions[deprecatedKey]).map(
|
||||||
key => ` ${key}: ...,`
|
(key) => ` ${key}: ...,`
|
||||||
),
|
),
|
||||||
' },',
|
' },',
|
||||||
'}',
|
'}',
|
||||||
@@ -62,7 +62,7 @@ export default (screenOptions, route) => {
|
|||||||
'with:',
|
'with:',
|
||||||
'{',
|
'{',
|
||||||
...Object.keys(screenOptions[deprecatedKey]).map(
|
...Object.keys(screenOptions[deprecatedKey]).map(
|
||||||
key =>
|
(key) =>
|
||||||
` ${deprecatedKey + key[0].toUpperCase() + key.slice(1)}: ...,`
|
` ${deprecatedKey + key[0].toUpperCase() + key.slice(1)}: ...,`
|
||||||
),
|
),
|
||||||
'}',
|
'}',
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ function getSceneIndicesForInterpolationInputRange(props) {
|
|||||||
const isBack = !scenes[lastSceneIndexInScenes].isActive;
|
const isBack = !scenes[lastSceneIndexInScenes].isActive;
|
||||||
|
|
||||||
if (isBack) {
|
if (isBack) {
|
||||||
const currentSceneIndexInScenes = scenes.findIndex(item => item === scene);
|
const currentSceneIndexInScenes = scenes.findIndex(
|
||||||
const targetSceneIndexInScenes = scenes.findIndex(item => item.isActive);
|
(item) => item === scene
|
||||||
|
);
|
||||||
|
const targetSceneIndexInScenes = scenes.findIndex((item) => item.isActive);
|
||||||
const targetSceneIndex = scenes[targetSceneIndexInScenes].index;
|
const targetSceneIndex = scenes[targetSceneIndexInScenes].index;
|
||||||
const lastSceneIndex = scenes[lastSceneIndexInScenes].index;
|
const lastSceneIndex = scenes[lastSceneIndexInScenes].index;
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
* will remain to ensure logic does not differ in production.
|
* will remain to ensure logic does not differ in production.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
let validateFormat: (format?: string) => void = function() {};
|
let validateFormat: (format?: string) => void = function () {};
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
validateFormat = function(format?: string) {
|
validateFormat = function (format?: string) {
|
||||||
if (format === undefined) {
|
if (format === undefined) {
|
||||||
throw new Error('invariant requires an error message argument');
|
throw new Error('invariant requires an error message argument');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class NavigationEvents extends React.Component {
|
|||||||
// We register all navigation listeners on mount to ensure listener stability across re-render
|
// We register all navigation listeners on mount to ensure listener stability across re-render
|
||||||
// A former implementation was replacing (removing/adding) listeners on all update (if prop provided)
|
// A former implementation was replacing (removing/adding) listeners on all update (if prop provided)
|
||||||
// but there were issues (see https://github.com/react-navigation/react-navigation/issues/5058)
|
// but there were issues (see https://github.com/react-navigation/react-navigation/issues/5058)
|
||||||
EventNames.forEach(eventName => {
|
EventNames.forEach((eventName) => {
|
||||||
this.subscriptions[eventName] = this.props.navigation.addListener(
|
this.subscriptions[eventName] = this.props.navigation.addListener(
|
||||||
eventName,
|
eventName,
|
||||||
(...args) => {
|
(...args) => {
|
||||||
@@ -29,12 +29,12 @@ class NavigationEvents extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
EventNames.forEach(eventName => {
|
EventNames.forEach((eventName) => {
|
||||||
this.subscriptions[eventName].remove();
|
this.subscriptions[eventName].remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getPropListener = eventName => this.props[EventNameToPropName[eventName]];
|
getPropListener = (eventName) => this.props[EventNameToPropName[eventName]];
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -26,13 +26,15 @@ const createTestNavigationAndHelpers = () => {
|
|||||||
listeners[eventName].push(handler);
|
listeners[eventName].push(handler);
|
||||||
},
|
},
|
||||||
remove: (eventName, handler) => {
|
remove: (eventName, handler) => {
|
||||||
listeners[eventName] = listeners[eventName].filter(h => h !== handler);
|
listeners[eventName] = listeners[eventName].filter(
|
||||||
|
(h) => h !== handler
|
||||||
|
);
|
||||||
},
|
},
|
||||||
get: eventName => {
|
get: (eventName) => {
|
||||||
return listeners[eventName];
|
return listeners[eventName];
|
||||||
},
|
},
|
||||||
call: eventName => {
|
call: (eventName) => {
|
||||||
listeners[eventName].forEach(listener => listener());
|
listeners[eventName].forEach((listener) => listener());
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -8,14 +8,15 @@ export default function withNavigation(
|
|||||||
config = { forwardRef: true }
|
config = { forwardRef: true }
|
||||||
) {
|
) {
|
||||||
class ComponentWithNavigation extends React.Component {
|
class ComponentWithNavigation extends React.Component {
|
||||||
static displayName = `withNavigation(${Component.displayName ||
|
static displayName = `withNavigation(${
|
||||||
Component.name})`;
|
Component.displayName || Component.name
|
||||||
|
})`;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const navigationProp = this.props.navigation;
|
const navigationProp = this.props.navigation;
|
||||||
return (
|
return (
|
||||||
<NavigationContext.Consumer>
|
<NavigationContext.Consumer>
|
||||||
{navigationContext => {
|
{(navigationContext) => {
|
||||||
const navigation = navigationProp || navigationContext;
|
const navigation = navigationProp || navigationContext;
|
||||||
invariant(
|
invariant(
|
||||||
!!navigation,
|
!!navigation,
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import withNavigation from './withNavigation';
|
|||||||
|
|
||||||
export default function withNavigationFocus(Component) {
|
export default function withNavigationFocus(Component) {
|
||||||
class ComponentWithNavigationFocus extends React.Component {
|
class ComponentWithNavigationFocus extends React.Component {
|
||||||
static displayName = `withNavigationFocus(${Component.displayName ||
|
static displayName = `withNavigationFocus(${
|
||||||
Component.name})`;
|
Component.displayName || Component.name
|
||||||
|
})`;
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -25,7 +26,7 @@ export default function withNavigationFocus(Component) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
this.subscriptions.forEach(sub => sub.remove());
|
this.subscriptions.forEach((sub) => sub.remove());
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -3,6 +3,49 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
## [2.4.7](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.6...react-navigation-drawer@2.4.7) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.6](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.5...react-navigation-drawer@2.4.6) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.5](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.4...react-navigation-drawer@2.4.5) (2020-03-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't use react-native-screens on web ([44c3900](https://github.com/react-navigation/drawer/commit/44c390075f7b76664e09fd9a1a7926645133ebec)), closes [#7485](https://github.com/react-navigation/drawer/issues/7485)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.4](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.3...react-navigation-drawer@2.4.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.4.3](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.2...react-navigation-drawer@2.4.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.4.2](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.1...react-navigation-drawer@2.4.2) (2020-02-26)
|
## [2.4.2](https://github.com/react-navigation/drawer/compare/react-navigation-drawer@2.4.1...react-navigation-drawer@2.4.2) (2020-02-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation-drawer
|
**Note:** Version bump only for package react-navigation-drawer
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-drawer",
|
"name": "react-navigation-drawer",
|
||||||
"version": "2.4.2",
|
"version": "2.4.7",
|
||||||
"description": "Drawer navigator component for React Navigation",
|
"description": "Drawer navigator component for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -38,18 +38,18 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/react-navigation/drawer#readme",
|
"homepage": "https://github.com/react-navigation/drawer#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-lifecycles-compat": "^3.0.4",
|
"react-lifecycles-compat": "^3.0.4",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-reanimated": "^1.2.0",
|
"react-native-reanimated": "^1.2.0",
|
||||||
"react-native-screens": "^2.0.0-beta.10",
|
"react-native-screens": "^2.3.0",
|
||||||
"react-native-testing-library": "^1.12.0",
|
"react-native-testing-library": "^1.12.0",
|
||||||
"react-navigation": "^4.2.2",
|
"react-navigation": "^4.3.3",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": "^1.0.12",
|
"react-native-gesture-handler": "^1.0.12",
|
||||||
"react-native-reanimated": "^1.0.0",
|
"react-native-reanimated": "^1.0.0",
|
||||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha",
|
"react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0",
|
||||||
"react-navigation": "^4.1.1"
|
"react-navigation": "^4.1.1"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* @flow */
|
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Platform, StyleSheet, View } from 'react-native';
|
import { Platform, StyleSheet, View } from 'react-native';
|
||||||
import { Screen, screensEnabled } from 'react-native-screens';
|
import { Screen, screensEnabled } from 'react-native-screens';
|
||||||
@@ -10,21 +8,29 @@ type Props = {
|
|||||||
style?: any;
|
style?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FAR_FAR_AWAY = 3000; // this should be big enough to move the whole view out of its container
|
const FAR_FAR_AWAY = 30000; // this should be big enough to move the whole view out of its container
|
||||||
|
|
||||||
export default class ResourceSavingScene extends React.Component<Props> {
|
export default class ResourceSavingScene extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
if (screensEnabled?.()) {
|
// react-native-screens is buggy on web
|
||||||
|
if (screensEnabled?.() && Platform.OS !== 'web') {
|
||||||
const { isVisible, ...rest } = this.props;
|
const { isVisible, ...rest } = this.props;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isVisible, children, style, ...rest } = this.props;
|
const { isVisible, children, style, ...rest } = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[styles.container, style]}
|
style={[
|
||||||
|
styles.container,
|
||||||
|
Platform.OS === 'web'
|
||||||
|
? { display: isVisible ? 'flex' : 'none' }
|
||||||
|
: null,
|
||||||
|
style,
|
||||||
|
]}
|
||||||
collapsable={false}
|
collapsable={false}
|
||||||
removeClippedSubviews={
|
removeClippedSubviews={
|
||||||
// On iOS, set removeClippedSubviews to true only when not focused
|
// On iOS, set removeClippedSubviews to true only when not focused
|
||||||
|
|||||||
@@ -3,6 +3,38 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [2.2.6](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.5...react-navigation-material-bottom-tabs@2.2.6) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.2.5](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.4...react-navigation-material-bottom-tabs@2.2.5) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.2.4](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.3...react-navigation-material-bottom-tabs@2.2.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.2.3](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.2...react-navigation-material-bottom-tabs@2.2.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.2.2](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.1...react-navigation-material-bottom-tabs@2.2.2) (2020-02-26)
|
## [2.2.2](https://github.com/react-navigation/react-navigation-material-bottom-tabs/compare/react-navigation-material-bottom-tabs@2.2.1...react-navigation-material-bottom-tabs@2.2.2) (2020-02-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
**Note:** Version bump only for package react-navigation-material-bottom-tabs
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-material-bottom-tabs",
|
"name": "react-navigation-material-bottom-tabs",
|
||||||
"version": "2.2.2",
|
"version": "2.2.6",
|
||||||
"description": "Material Bottom Tab Navigation component for React Navigation",
|
"description": "Material Bottom Tab Navigation component for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"module": "lib/module/index.js",
|
"module": "lib/module/index.js",
|
||||||
@@ -38,17 +38,17 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/react-navigation/react-navigation-material-bottom-tabs#readme",
|
"homepage": "https://github.com/react-navigation/react-navigation-material-bottom-tabs#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@types/hoist-non-react-statics": "^3.3.1",
|
"@types/hoist-non-react-statics": "^3.3.1",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-paper": "^3.1.1",
|
"react-native-paper": "^3.1.1",
|
||||||
"react-native-reanimated": "^1.2.0",
|
"react-native-reanimated": "^1.2.0",
|
||||||
"react-navigation": "^4.2.2",
|
"react-navigation": "^4.3.3",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -3,6 +3,44 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [3.7.7](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.6...@react-navigation/native@3.7.7) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.7.6](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.5...@react-navigation/native@3.7.6) (2020-03-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't mix import and module.exports. closes [#7660](https://github.com/react-navigation/react-navigation-native/issues/7660) ([80c8c9d](https://github.com/react-navigation/react-navigation-native/commit/80c8c9d1dead57eab3b977a1eebf1e9f5f35cd1a))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.7.5](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.4...@react-navigation/native@3.7.5) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* downgrade react-native-safe-area-view ([cfc1bac](https://github.com/react-navigation/react-navigation-native/commit/cfc1bac4e153db4a4ba3f2a9033f77b53367fcbc)), closes [#7813](https://github.com/react-navigation/react-navigation-native/issues/7813)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [3.7.4](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.3...@react-navigation/native@3.7.4) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [3.7.3](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.0...@react-navigation/native@3.7.3) (2020-02-24)
|
## [3.7.3](https://github.com/react-navigation/react-navigation-native/compare/@react-navigation/native@3.7.0...@react-navigation/native@3.7.3) (2020-02-24)
|
||||||
|
|
||||||
**Note:** Version bump only for package @react-navigation/native
|
**Note:** Version bump only for package @react-navigation/native
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@react-navigation/native",
|
"name": "@react-navigation/native",
|
||||||
"version": "3.7.3",
|
"version": "3.7.7",
|
||||||
"description": "React Native support for React Navigation",
|
"description": "React Native support for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"react-native": "lib/module/index.js",
|
"react-native": "lib/module/index.js",
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
},
|
},
|
||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public",
|
||||||
|
"tag": "4.x"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"react-native",
|
"react-native",
|
||||||
@@ -38,14 +39,13 @@
|
|||||||
"react-native-safe-area-view": "^0.14.8"
|
"react-native-safe-area-view": "^0.14.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@react-navigation/core": "^3.6.1",
|
"@react-navigation/core": "^3.7.1",
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
"@types/react-test-renderer": "^16.9.2",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-screens": "^2.0.0-beta.10",
|
|
||||||
"react-test-renderer": "^16.9.2"
|
"react-test-renderer": "^16.9.2"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ const WrappedFlatList = React.forwardRef((props, ref) => (
|
|||||||
<FlatList
|
<FlatList
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
renderScrollComponent={props => (
|
renderScrollComponent={(props) => (
|
||||||
<WrappedScrollView {...propsMaybeWithRefreshControl(props)} />
|
<WrappedScrollView {...propsMaybeWithRefreshControl(props)} />
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
@@ -62,15 +62,14 @@ const WrappedSectionList = React.forwardRef((props, ref) => (
|
|||||||
<SectionList
|
<SectionList
|
||||||
ref={ref}
|
ref={ref}
|
||||||
{...props}
|
{...props}
|
||||||
renderScrollComponent={props => (
|
renderScrollComponent={(props) => (
|
||||||
<WrappedScrollView {...propsMaybeWithRefreshControl(props)} />
|
<WrappedScrollView {...propsMaybeWithRefreshControl(props)} />
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
export {
|
||||||
module.exports = {
|
WrappedScrollView as ScrollView,
|
||||||
ScrollView: WrappedScrollView,
|
WrappedFlatList as FlatList,
|
||||||
FlatList: WrappedFlatList,
|
WrappedSectionList as SectionList,
|
||||||
SectionList: WrappedSectionList,
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -274,7 +274,7 @@ describe('NavigationContainer', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// https://github.com/facebook/jest/issues/2157#issuecomment-279171856
|
// https://github.com/facebook/jest/issues/2157#issuecomment-279171856
|
||||||
const flushPromises = () => new Promise(resolve => setImmediate(resolve));
|
const flushPromises = () => new Promise((resolve) => setImmediate(resolve));
|
||||||
|
|
||||||
describe('state persistence', () => {
|
describe('state persistence', () => {
|
||||||
async function createPersistenceEnabledContainer(
|
async function createPersistenceEnabledContainer(
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ export default function createNavigationContainer(Component) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dispatchActions = () =>
|
const dispatchActions = () =>
|
||||||
this._actionEventSubscribers.forEach(subscriber =>
|
this._actionEventSubscribers.forEach((subscriber) =>
|
||||||
subscriber({
|
subscriber({
|
||||||
type: 'action',
|
type: 'action',
|
||||||
action,
|
action,
|
||||||
@@ -316,7 +316,7 @@ export default function createNavigationContainer(Component) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_persistNavigationState = async nav => {
|
_persistNavigationState = async (nav) => {
|
||||||
const { persistNavigationState } = this.props;
|
const { persistNavigationState } = this.props;
|
||||||
if (persistNavigationState) {
|
if (persistNavigationState) {
|
||||||
try {
|
try {
|
||||||
@@ -341,7 +341,7 @@ export default function createNavigationContainer(Component) {
|
|||||||
|
|
||||||
// Per-tick temporary storage for state.nav
|
// Per-tick temporary storage for state.nav
|
||||||
|
|
||||||
dispatch = action => {
|
dispatch = (action) => {
|
||||||
if (this.props.navigation) {
|
if (this.props.navigation) {
|
||||||
return this.props.navigation.dispatch(action);
|
return this.props.navigation.dispatch(action);
|
||||||
}
|
}
|
||||||
@@ -357,7 +357,7 @@ export default function createNavigationContainer(Component) {
|
|||||||
const navState = reducedState === null ? lastNavState : reducedState;
|
const navState = reducedState === null ? lastNavState : reducedState;
|
||||||
|
|
||||||
const dispatchActionEvents = () => {
|
const dispatchActionEvents = () => {
|
||||||
this._actionEventSubscribers.forEach(subscriber =>
|
this._actionEventSubscribers.forEach((subscriber) =>
|
||||||
subscriber({
|
subscriber({
|
||||||
type: 'action',
|
type: 'action',
|
||||||
action,
|
action,
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import { withNavigation } from '@react-navigation/core';
|
|||||||
export default function createNavigationAwareScrollable(Component) {
|
export default function createNavigationAwareScrollable(Component) {
|
||||||
const ComponentWithNavigationScrolling = withNavigation(
|
const ComponentWithNavigationScrolling = withNavigation(
|
||||||
class extends React.PureComponent<any> {
|
class extends React.PureComponent<any> {
|
||||||
static displayName = `withNavigationScrolling(${Component.displayName ||
|
static displayName = `withNavigationScrolling(${
|
||||||
Component.name})`;
|
Component.displayName || Component.name
|
||||||
|
})`;
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this._subscription = this.props.navigation.addListener(
|
this._subscription = this.props.navigation.addListener(
|
||||||
@@ -49,7 +50,7 @@ export default function createNavigationAwareScrollable(Component) {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Component
|
<Component
|
||||||
ref={view => {
|
ref={(view) => {
|
||||||
this._scrollRef = view;
|
this._scrollRef = view;
|
||||||
}}
|
}}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
@@ -60,10 +61,11 @@ export default function createNavigationAwareScrollable(Component) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
class NavigationAwareScrollable extends React.PureComponent<any> {
|
class NavigationAwareScrollable extends React.PureComponent<any> {
|
||||||
static displayName = `NavigationAwareScrollable(${Component.displayName ||
|
static displayName = `NavigationAwareScrollable(${
|
||||||
Component.name})`;
|
Component.displayName || Component.name
|
||||||
|
})`;
|
||||||
|
|
||||||
_captureRef = view => {
|
_captureRef = (view) => {
|
||||||
this._innerRef = view;
|
this._innerRef = view;
|
||||||
this.props.onRef && this.props.onRef(view);
|
this.props.onRef && this.props.onRef(view);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
export default function() {
|
export default function () {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
"This version of '@react-navigation/native' is not compatible with React Navigation 5. Make sure you install 5.x version of '@react-navigation/native'."
|
"This version of '@react-navigation/native' is not compatible with React Navigation 5. Make sure you install 5.x version of '@react-navigation/native'."
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
* will remain to ensure logic does not differ in production.
|
* will remain to ensure logic does not differ in production.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var validateFormat = function() {};
|
var validateFormat = function () {};
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
validateFormat = function(format) {
|
validateFormat = function (format) {
|
||||||
if (format === undefined) {
|
if (format === undefined) {
|
||||||
throw new Error('invariant requires an error message argument');
|
throw new Error('invariant requires an error message argument');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function invariant(condition, format, a, b, c, d, e, f) {
|
export default function invariant(condition, format, a, b, c, d, e, f) {
|
||||||
validateFormat(format);
|
validateFormat(format);
|
||||||
|
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
@@ -32,7 +32,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|||||||
var args = [a, b, c, d, e, f];
|
var args = [a, b, c, d, e, f];
|
||||||
var argIndex = 0;
|
var argIndex = 0;
|
||||||
error = new Error(
|
error = new Error(
|
||||||
format.replace(/%s/g, function() {
|
format.replace(/%s/g, function () {
|
||||||
return args[argIndex++];
|
return args[argIndex++];
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@@ -43,6 +43,3 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-commonjs
|
|
||||||
module.exports = invariant;
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import hoistNonReactStatic from 'hoist-non-react-statics';
|
|||||||
|
|
||||||
export const isOrientationLandscape = ({ width, height }) => width > height;
|
export const isOrientationLandscape = ({ width, height }) => width > height;
|
||||||
|
|
||||||
export default function(WrappedComponent) {
|
export default function (WrappedComponent) {
|
||||||
class withOrientation extends React.Component {
|
class withOrientation extends React.Component {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|||||||
@@ -3,6 +3,41 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
## [4.3.3](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.2...react-navigation@4.3.3) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [4.3.2](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.1...react-navigation@4.3.2) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [4.3.1](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.3.0...react-navigation@4.3.1) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [4.3.0](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.2.2...react-navigation@4.3.0) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add prune option to pop action to match v5 behaviour ([5927f42](https://github.com/react-navigation/react-navigation/commit/5927f4287f5e1ab106537865523daa1c03b14b47))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [4.2.2](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.2.1...react-navigation@4.2.2) (2020-02-26)
|
## [4.2.2](https://github.com/react-navigation/react-navigation/compare/react-navigation@4.2.1...react-navigation@4.2.2) (2020-02-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation",
|
"name": "react-navigation",
|
||||||
"version": "4.2.2",
|
"version": "4.3.3",
|
||||||
"description": "Routing and navigation for your React Native apps",
|
"description": "Routing and navigation for your React Native apps",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"types": "typescript/react-navigation.d.ts",
|
"types": "typescript/react-navigation.d.ts",
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
"react-native": "*"
|
"react-native": "*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^3.6.1",
|
"@react-navigation/core": "^3.7.1",
|
||||||
"@react-navigation/native": "^3.7.3"
|
"@react-navigation/native": "^3.7.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
"@types/react-test-renderer": "^16.9.2",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ export interface NavigationPopActionPayload {
|
|||||||
// n: the number of routes to pop of the stack
|
// n: the number of routes to pop of the stack
|
||||||
n?: number;
|
n?: number;
|
||||||
immediate?: boolean;
|
immediate?: boolean;
|
||||||
|
prune?: boolean;
|
||||||
key?: string;
|
key?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,57 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
## [2.3.5](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.4...react-navigation-stack@2.3.5) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.4](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.3...react-navigation-stack@2.3.4) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.3](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.2...react-navigation-stack@2.3.3) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.2](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.1...react-navigation-stack@2.3.2) (2020-03-19)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.3.1](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.3.0...react-navigation-stack@2.3.1) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-stack
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# [2.3.0](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.3...react-navigation-stack@2.3.0) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add prune option to pop action to match v5 behaviour ([5927f42](https://github.com/react-navigation/react-navigation-stack/commit/5927f4287f5e1ab106537865523daa1c03b14b47))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.2.3](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.2...react-navigation-stack@2.2.3) (2020-03-04)
|
## [2.2.3](https://github.com/react-navigation/react-navigation-stack/compare/react-navigation-stack@2.2.2...react-navigation-stack@2.2.3) (2020-03-04)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-stack",
|
"name": "react-navigation-stack",
|
||||||
"version": "2.2.3",
|
"version": "2.3.5",
|
||||||
"description": "Stack navigator component for React Navigation",
|
"description": "Stack navigator component for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"module": "lib/module/index.js",
|
"module": "lib/module/index.js",
|
||||||
@@ -43,20 +43,20 @@
|
|||||||
"react-native-iphone-x-helper": "^1.2.1"
|
"react-native-iphone-x-helper": "^1.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@react-native-community/masked-view": "^0.1.6",
|
"@react-native-community/masked-view": "^0.1.7",
|
||||||
"@react-navigation/stack": "^5.1.1",
|
"@react-navigation/stack": "^5.2.4",
|
||||||
"@types/color": "^3.0.1",
|
"@types/color": "^3.0.1",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"@types/react-test-renderer": "^16.9.2",
|
"@types/react-test-renderer": "^16.9.2",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.4",
|
"react-native": "~0.61.4",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-safe-area-context": "^0.7.3",
|
"react-native-safe-area-context": "^0.7.3",
|
||||||
"react-native-screens": "^2.0.0-beta.10",
|
"react-native-screens": "^2.3.0",
|
||||||
"react-navigation": "^4.2.2",
|
"react-navigation": "^4.3.3",
|
||||||
"react-test-renderer": "~16.9.0",
|
"react-test-renderer": "~16.9.0",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": "^1.5.0",
|
"react-native-gesture-handler": "^1.5.0",
|
||||||
"react-native-safe-area-context": "^0.6.0",
|
"react-native-safe-area-context": "^0.6.0",
|
||||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha.0 || ^2.0.0-alpha.20",
|
"react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0",
|
||||||
"react-navigation": "^4.1.1"
|
"react-navigation": "^4.1.1"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/index.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/index.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/index.tsx 2020-03-04 00:03:45.000000000 +0100
|
+++ src/vendor/index.tsx 2020-03-23 00:04:37.000000000 +0100
|
||||||
@@ -3,11 +3,6 @@
|
@@ -3,11 +3,6 @@
|
||||||
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
||||||
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
import * as TransitionPresets from './TransitionConfigs/TransitionPresets';
|
||||||
@@ -28,7 +28,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/index.tsx src/vendor/i
|
|||||||
StackHeaderTitleProps,
|
StackHeaderTitleProps,
|
||||||
StackCardInterpolatedStyle,
|
StackCardInterpolatedStyle,
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx src/vendor/navigators/createStackNavigator.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx src/vendor/navigators/createStackNavigator.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/navigators/createStackNavigator.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/navigators/createStackNavigator.tsx 1970-01-01 01:00:00.000000000 +0100
|
+++ src/vendor/navigators/createStackNavigator.tsx 1970-01-01 01:00:00.000000000 +0100
|
||||||
@@ -1,81 +0,0 @@
|
@@ -1,81 +0,0 @@
|
||||||
-import * as React from 'react';
|
-import * as React from 'react';
|
||||||
@@ -73,7 +73,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStack
|
|||||||
- React.useEffect(
|
- React.useEffect(
|
||||||
- () =>
|
- () =>
|
||||||
- navigation.addListener &&
|
- navigation.addListener &&
|
||||||
- navigation.addListener('tabPress', e => {
|
- navigation.addListener('tabPress', (e) => {
|
||||||
- const isFocused = navigation.isFocused();
|
- const isFocused = navigation.isFocused();
|
||||||
-
|
-
|
||||||
- // Run the operation in the next frame so we're sure all listeners have been run
|
- // Run the operation in the next frame so we're sure all listeners have been run
|
||||||
@@ -113,9 +113,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/navigators/createStack
|
|||||||
- typeof StackNavigator
|
- typeof StackNavigator
|
||||||
->(StackNavigator);
|
->(StackNavigator);
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/types.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/types.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/types.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/types.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -7,13 +7,28 @@
|
@@ -8,14 +8,28 @@
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
import { EdgeInsets } from 'react-native-safe-area-context';
|
import { EdgeInsets } from 'react-native-safe-area-context';
|
||||||
import {
|
import {
|
||||||
@@ -128,6 +128,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
- Route,
|
- Route,
|
||||||
- NavigationHelpers,
|
- NavigationHelpers,
|
||||||
- StackNavigationState,
|
- StackNavigationState,
|
||||||
|
- StackActionHelpers,
|
||||||
-} from '@react-navigation/native';
|
-} from '@react-navigation/native';
|
||||||
+ NavigationParams,
|
+ NavigationParams,
|
||||||
+ NavigationNavigateAction,
|
+ NavigationNavigateAction,
|
||||||
@@ -150,7 +151,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
|
|
||||||
export type StackNavigationEventMap = {
|
export type StackNavigationEventMap = {
|
||||||
/**
|
/**
|
||||||
@@ -26,42 +41,29 @@
|
@@ -28,22 +42,29 @@
|
||||||
transitionEnd: { data: { closing: boolean } };
|
transitionEnd: { data: { closing: boolean } };
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -158,8 +159,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
- ParamListBase,
|
- ParamListBase,
|
||||||
- StackNavigationEventMap
|
- StackNavigationEventMap
|
||||||
->;
|
->;
|
||||||
|
-
|
||||||
+export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
+export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
||||||
|
|
||||||
export type StackNavigationProp<
|
export type StackNavigationProp<
|
||||||
- ParamList extends ParamListBase,
|
- ParamList extends ParamListBase,
|
||||||
- RouteName extends keyof ParamList = string
|
- RouteName extends keyof ParamList = string
|
||||||
@@ -169,28 +170,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
- StackNavigationState,
|
- StackNavigationState,
|
||||||
- StackNavigationOptions,
|
- StackNavigationOptions,
|
||||||
- StackNavigationEventMap
|
- StackNavigationEventMap
|
||||||
-> & {
|
-> &
|
||||||
- /**
|
- StackActionHelpers<ParamList>;
|
||||||
- * Push a new screen onto the stack.
|
|
||||||
- *
|
|
||||||
- * @param name Name of the route for the tab.
|
|
||||||
- * @param [params] Params object for the route.
|
|
||||||
- */
|
|
||||||
- push<RouteName extends keyof ParamList>(
|
|
||||||
- ...args: ParamList[RouteName] extends undefined | any
|
|
||||||
- ? [RouteName] | [RouteName, ParamList[RouteName]]
|
|
||||||
- : [RouteName, ParamList[RouteName]]
|
|
||||||
- ): void;
|
|
||||||
-
|
|
||||||
- /**
|
|
||||||
- * Pop a screen from the stack.
|
|
||||||
- */
|
|
||||||
- pop(count?: number): void;
|
|
||||||
-
|
|
||||||
- /**
|
|
||||||
- * Pop to the first route in the stack, dismissing all other screens.
|
|
||||||
- */
|
|
||||||
- popToTop(): void;
|
|
||||||
+ State = NavigationRoute,
|
+ State = NavigationRoute,
|
||||||
+ Params = NavigationParams
|
+ Params = NavigationParams
|
||||||
+> = NavigationScreenProp<State, Params> & {
|
+> = NavigationScreenProp<State, Params> & {
|
||||||
@@ -211,10 +192,11 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
+ event: NavigationStackEventName,
|
+ event: NavigationStackEventName,
|
||||||
+ callback: NavigationEventCallback
|
+ callback: NavigationEventCallback
|
||||||
+ ) => NavigationEventSubscription;
|
+ ) => NavigationEventSubscription;
|
||||||
};
|
+};
|
||||||
|
|
||||||
export type Layout = { width: number; height: number };
|
export type Layout = { width: number; height: number };
|
||||||
@@ -237,24 +239,27 @@
|
|
||||||
|
@@ -218,24 +239,27 @@
|
||||||
/**
|
/**
|
||||||
* Navigation prop for the header.
|
* Navigation prop for the header.
|
||||||
*/
|
*/
|
||||||
@@ -248,7 +230,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
export type StackNavigationOptions = StackHeaderOptions &
|
export type StackNavigationOptions = StackHeaderOptions &
|
||||||
Partial<TransitionPreset> & {
|
Partial<TransitionPreset> & {
|
||||||
/**
|
/**
|
||||||
@@ -332,6 +337,8 @@
|
@@ -317,6 +341,8 @@
|
||||||
bottom?: number;
|
bottom?: number;
|
||||||
left?: number;
|
left?: number;
|
||||||
};
|
};
|
||||||
@@ -257,20 +239,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/types.tsx src/vendor/t
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type StackNavigationConfig = {
|
export type StackNavigationConfig = {
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/BorderlessButton.tsx src/vendor/views/BorderlessButton.tsx
|
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/BorderlessButton.tsx 2020-03-03 23:57:02.000000000 +0100
|
|
||||||
+++ src/vendor/views/BorderlessButton.tsx 2020-03-04 00:03:48.000000000 +0100
|
|
||||||
@@ -39,6 +39,7 @@
|
|
||||||
const { children, style, enabled, ...rest } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
+ // @ts-ignore
|
|
||||||
<AnimatedBaseButton
|
|
||||||
{...rest}
|
|
||||||
onActiveStateChange={this.handleActiveStateChange}
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/vendor/views/Header/Header.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx src/vendor/views/Header/Header.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/Header.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Header/Header.tsx 2020-03-04 00:04:05.000000000 +0100
|
+++ src/vendor/views/Header/Header.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -1,12 +1,14 @@
|
@@ -1,12 +1,14 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
-import { StackActions } from '@react-navigation/native';
|
-import { StackActions } from '@react-navigation/native';
|
||||||
@@ -350,8 +321,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/Header.ts
|
|||||||
+
|
+
|
||||||
+export default Header;
|
+export default Header;
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx src/vendor/views/Header/HeaderBackButton.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx src/vendor/views/Header/HeaderBackButton.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackButton.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/views/Header/HeaderBackButton.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -8,9 +8,9 @@
|
@@ -8,9 +8,9 @@
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
LayoutChangeEvent,
|
LayoutChangeEvent,
|
||||||
@@ -364,8 +335,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
|||||||
|
|
||||||
type Props = StackHeaderLeftButtonProps;
|
type Props = StackHeaderLeftButtonProps;
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx src/vendor/views/Header/HeaderBackground.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx src/vendor/views/Header/HeaderBackground.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBackground.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/views/Header/HeaderBackground.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -1,6 +1,6 @@
|
@@ -1,6 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
|
import { Animated, StyleSheet, Platform, ViewProps } from 'react-native';
|
||||||
@@ -375,8 +346,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderBac
|
|||||||
type Props = ViewProps & {
|
type Props = ViewProps & {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx src/vendor/views/Header/HeaderContainer.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx src/vendor/views/Header/HeaderContainer.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderContainer.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/views/Header/HeaderContainer.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -1,11 +1,6 @@
|
@@ -1,11 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
import { View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||||
@@ -428,8 +399,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderCon
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx src/vendor/views/Header/HeaderSegment.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx src/vendor/views/Header/HeaderSegment.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSegment.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/views/Header/HeaderSegment.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -8,7 +8,7 @@
|
@@ -8,7 +8,7 @@
|
||||||
ViewStyle,
|
ViewStyle,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
@@ -449,24 +420,20 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderSeg
|
|||||||
};
|
};
|
||||||
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx src/vendor/views/Header/HeaderTitle.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx src/vendor/views/Header/HeaderTitle.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Header/HeaderTitle.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/views/Header/HeaderTitle.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -1,8 +1,8 @@
|
@@ -1,6 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
-import { Animated, StyleSheet, Platform, TextProps } from 'react-native';
|
import { Animated, StyleSheet, Platform } from 'react-native';
|
||||||
-import { useTheme } from '@react-navigation/native';
|
-import { useTheme } from '@react-navigation/native';
|
||||||
+import { Animated, StyleSheet, Platform } from 'react-native';
|
|
||||||
+import useTheme from '../../../utils/useTheme';
|
+import useTheme from '../../../utils/useTheme';
|
||||||
|
|
||||||
-type Props = TextProps & {
|
type Props = React.ComponentProps<typeof Animated.Text> & {
|
||||||
+type Props = React.ComponentProps<typeof Animated.Text> & {
|
|
||||||
tintColor?: string;
|
tintColor?: string;
|
||||||
children?: string;
|
|
||||||
};
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/vendor/views/Stack/Card.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx src/vendor/views/Stack/Card.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/Card.tsx 2020-03-04 00:03:48.000000000 +0100
|
+++ src/vendor/views/Stack/Card.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -133,7 +133,7 @@
|
@@ -138,7 +138,7 @@
|
||||||
|
|
||||||
private interactionHandle: number | undefined;
|
private interactionHandle: number | undefined;
|
||||||
|
|
||||||
@@ -475,18 +442,9 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/Card.tsx s
|
|||||||
|
|
||||||
private animate = ({
|
private animate = ({
|
||||||
closing,
|
closing,
|
||||||
@@ -507,7 +507,7 @@
|
|
||||||
) : null}
|
|
||||||
<View
|
|
||||||
ref={this.contentRef}
|
|
||||||
- style={[styles.content, contentStyle]}
|
|
||||||
+ style={[styles.content, contentStyle] as any}
|
|
||||||
>
|
|
||||||
<StackGestureRefContext.Provider value={this.gestureRef}>
|
|
||||||
<CardAnimationContext.Provider value={animationContext}>
|
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx src/vendor/views/Stack/CardContainer.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx src/vendor/views/Stack/CardContainer.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardContainer.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/CardContainer.tsx 2020-03-04 13:24:38.000000000 +0100
|
+++ src/vendor/views/Stack/CardContainer.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -1,10 +1,16 @@
|
@@ -1,10 +1,16 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
import { Animated, View, StyleSheet, StyleProp, ViewStyle } from 'react-native';
|
||||||
@@ -506,7 +464,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
|
|
||||||
type Props = TransitionPreset & {
|
type Props = TransitionPreset & {
|
||||||
index: number;
|
index: number;
|
||||||
@@ -35,6 +41,7 @@
|
@@ -36,6 +42,7 @@
|
||||||
closing: boolean
|
closing: boolean
|
||||||
) => void;
|
) => void;
|
||||||
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
onTransitionEnd?: (props: { route: Route<string> }, closing: boolean) => void;
|
||||||
@@ -514,7 +472,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
onPageChangeStart?: () => void;
|
onPageChangeStart?: () => void;
|
||||||
onPageChangeConfirm?: () => void;
|
onPageChangeConfirm?: () => void;
|
||||||
onPageChangeCancel?: () => void;
|
onPageChangeCancel?: () => void;
|
||||||
@@ -81,6 +88,7 @@
|
@@ -83,6 +90,7 @@
|
||||||
layout,
|
layout,
|
||||||
onCloseRoute,
|
onCloseRoute,
|
||||||
onOpenRoute,
|
onOpenRoute,
|
||||||
@@ -522,7 +480,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
onPageChangeCancel,
|
onPageChangeCancel,
|
||||||
onPageChangeConfirm,
|
onPageChangeConfirm,
|
||||||
onPageChangeStart,
|
onPageChangeStart,
|
||||||
@@ -150,6 +158,9 @@
|
@@ -152,6 +160,9 @@
|
||||||
};
|
};
|
||||||
}, [pointerEvents, scene.progress.next]);
|
}, [pointerEvents, scene.progress.next]);
|
||||||
|
|
||||||
@@ -532,7 +490,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
index={index}
|
index={index}
|
||||||
@@ -180,7 +191,7 @@
|
@@ -183,7 +194,7 @@
|
||||||
? { marginTop: headerHeight }
|
? { marginTop: headerHeight }
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
@@ -542,8 +500,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardContai
|
|||||||
>
|
>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx src/vendor/views/Stack/CardStack.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx src/vendor/views/Stack/CardStack.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/CardStack.tsx 2020-03-04 13:31:28.000000000 +0100
|
+++ src/vendor/views/Stack/CardStack.tsx 2020-03-23 00:04:40.000000000 +0100
|
||||||
@@ -9,9 +9,8 @@
|
@@ -9,9 +9,8 @@
|
||||||
ViewProps,
|
ViewProps,
|
||||||
} from 'react-native';
|
} from 'react-native';
|
||||||
@@ -571,7 +529,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
onTransitionStart: (
|
onTransitionStart: (
|
||||||
props: { route: Route<string> },
|
props: { route: Route<string> },
|
||||||
closing: boolean
|
closing: boolean
|
||||||
@@ -371,6 +372,7 @@
|
@@ -383,6 +384,7 @@
|
||||||
renderHeader,
|
renderHeader,
|
||||||
renderScene,
|
renderScene,
|
||||||
headerMode,
|
headerMode,
|
||||||
@@ -579,7 +537,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
onTransitionStart,
|
onTransitionStart,
|
||||||
onTransitionEnd,
|
onTransitionEnd,
|
||||||
onPageChangeStart,
|
onPageChangeStart,
|
||||||
@@ -546,6 +548,7 @@
|
@@ -560,6 +562,7 @@
|
||||||
renderScene={renderScene}
|
renderScene={renderScene}
|
||||||
onOpenRoute={onOpenRoute}
|
onOpenRoute={onOpenRoute}
|
||||||
onCloseRoute={onCloseRoute}
|
onCloseRoute={onCloseRoute}
|
||||||
@@ -588,8 +546,8 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/CardStack.
|
|||||||
onTransitionEnd={onTransitionEnd}
|
onTransitionEnd={onTransitionEnd}
|
||||||
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
gestureEnabled={index !== 0 && getGesturesEnabled({ route })}
|
||||||
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx src/vendor/views/Stack/StackView.tsx
|
diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx src/vendor/views/Stack/StackView.tsx
|
||||||
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-03-03 23:57:02.000000000 +0100
|
--- ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.tsx 2020-03-23 00:04:17.000000000 +0100
|
||||||
+++ src/vendor/views/Stack/StackView.tsx 2020-03-04 13:24:28.000000000 +0100
|
+++ src/vendor/views/Stack/StackView.tsx 2020-03-23 00:07:11.000000000 +0100
|
||||||
@@ -4,9 +4,9 @@
|
@@ -4,9 +4,9 @@
|
||||||
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
||||||
import {
|
import {
|
||||||
@@ -655,10 +613,10 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
+
|
+
|
||||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||||
+ this.handleTransitionComplete({ route });
|
+ this.handleTransitionComplete({ route });
|
||||||
this.setState(state => ({
|
this.setState((state) => ({
|
||||||
routes: state.replacingRouteKeys.length
|
routes: state.replacingRouteKeys.length
|
||||||
? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key))
|
? state.routes.filter((r) => !state.replacingRouteKeys.includes(r.key))
|
||||||
@@ -315,12 +340,17 @@
|
@@ -319,12 +344,17 @@
|
||||||
// If a route exists in state, trigger a pop
|
// If a route exists in state, trigger a pop
|
||||||
// This will happen in when the route was closed from the card component
|
// This will happen in when the route was closed from the card component
|
||||||
// e.g. When the close animation triggered from a gesture ends
|
// e.g. When the close animation triggered from a gesture ends
|
||||||
@@ -668,20 +626,20 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
- target: state.key,
|
- target: state.key,
|
||||||
- });
|
- });
|
||||||
+ // @ts-ignore
|
+ // @ts-ignore
|
||||||
+ navigation.dispatch(StackActions.pop({ key: route.key }));
|
+ navigation.dispatch(StackActions.pop({ key: route.key, prune: false }));
|
||||||
} else {
|
} else {
|
||||||
+ // While closing route we need to point to the previous one assuming that
|
+ // While closing route we need to point to the previous one assuming that
|
||||||
+ // this previous one in routes array
|
+ // this previous one in routes array
|
||||||
+ const index = this.state.routes.findIndex(r => r.key === route.key);
|
+ const index = this.state.routes.findIndex((r) => r.key === route.key);
|
||||||
+
|
+
|
||||||
+ this.handleTransitionComplete({
|
+ this.handleTransitionComplete({
|
||||||
+ route: this.state.routes[Math.max(index - 1, 0)],
|
+ route: this.state.routes[Math.max(index - 1, 0)],
|
||||||
+ });
|
+ });
|
||||||
+
|
+
|
||||||
// We need to clean up any state tracking the route and pop it immediately
|
// We need to clean up any state tracking the route and pop it immediately
|
||||||
this.setState(state => ({
|
this.setState((state) => ({
|
||||||
routes: state.routes.filter(r => r.key !== route.key),
|
routes: state.routes.filter((r) => r.key !== route.key),
|
||||||
@@ -337,22 +367,24 @@
|
@@ -341,22 +371,24 @@
|
||||||
private handleTransitionStart = (
|
private handleTransitionStart = (
|
||||||
{ route }: { route: Route<string> },
|
{ route }: { route: Route<string> },
|
||||||
closing: boolean
|
closing: boolean
|
||||||
@@ -718,7 +676,7 @@ diff -Naur ../../node_modules/@react-navigation/stack/src/views/Stack/StackView.
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
@@ -391,6 +423,7 @@
|
@@ -395,6 +427,7 @@
|
||||||
closingRouteKeys={closingRouteKeys}
|
closingRouteKeys={closingRouteKeys}
|
||||||
onOpenRoute={this.handleOpenRoute}
|
onOpenRoute={this.handleOpenRoute}
|
||||||
onCloseRoute={this.handleCloseRoute}
|
onCloseRoute={this.handleCloseRoute}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function createStackNavigator(
|
|||||||
return createNavigator(
|
return createNavigator(
|
||||||
// TODO: don't have time to fix it right now
|
// TODO: don't have time to fix it right now
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
navigatorProps => <StackView {...navigatorProps} />,
|
(navigatorProps) => <StackView {...navigatorProps} />,
|
||||||
router,
|
router,
|
||||||
stackConfig
|
stackConfig
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export default function validateDeprecatedConfig(
|
|||||||
) {
|
) {
|
||||||
let result = options;
|
let result = options;
|
||||||
|
|
||||||
Object.keys(validations).forEach(name => {
|
Object.keys(validations).forEach((name) => {
|
||||||
if (name in config) {
|
if (name in config) {
|
||||||
const { compat, message } = validations[name];
|
const { compat, message } = validations[name];
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ const shownWarnings: string[] = [];
|
|||||||
|
|
||||||
const validations: Validation[] = [
|
const validations: Validation[] = [
|
||||||
{
|
{
|
||||||
check: o => typeof o.headerForceInset === 'object',
|
check: (o) => typeof o.headerForceInset === 'object',
|
||||||
deprecated: 'headerForceInset',
|
deprecated: 'headerForceInset',
|
||||||
updated: 'safeAreaInsets',
|
updated: 'safeAreaInsets',
|
||||||
compat: o => {
|
compat: (o) => {
|
||||||
const { headerForceInset, ...rest } = o;
|
const { headerForceInset, ...rest } = o;
|
||||||
|
|
||||||
let safeAreaInsets: Partial<EdgeInsets> | undefined = {
|
let safeAreaInsets: Partial<EdgeInsets> | undefined = {
|
||||||
@@ -55,20 +55,20 @@ const validations: Validation[] = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
check: o => o.gesturesEnabled !== undefined,
|
check: (o) => o.gesturesEnabled !== undefined,
|
||||||
deprecated: 'gesturesEnabled',
|
deprecated: 'gesturesEnabled',
|
||||||
updated: 'gestureEnabled',
|
updated: 'gestureEnabled',
|
||||||
compat: o => {
|
compat: (o) => {
|
||||||
const { gesturesEnabled, ...rest } = o;
|
const { gesturesEnabled, ...rest } = o;
|
||||||
|
|
||||||
return { ...rest, gestureEnabled: gesturesEnabled };
|
return { ...rest, gestureEnabled: gesturesEnabled };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
check: o => o.header === null,
|
check: (o) => o.header === null,
|
||||||
deprecated: 'header: null',
|
deprecated: 'header: null',
|
||||||
updated: 'headerShown: false',
|
updated: 'headerShown: false',
|
||||||
compat: o => {
|
compat: (o) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const { header, ...rest } = o;
|
const { header, ...rest } = o;
|
||||||
|
|
||||||
@@ -76,26 +76,26 @@ const validations: Validation[] = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
check: o => o.header != null && typeof o.header !== 'function',
|
check: (o) => o.header != null && typeof o.header !== 'function',
|
||||||
deprecated: 'header: <SomeElement />',
|
deprecated: 'header: <SomeElement />',
|
||||||
updated: 'header: () => <SomeElement />',
|
updated: 'header: () => <SomeElement />',
|
||||||
compat: o => ({ ...o, header: () => o.header }),
|
compat: (o) => ({ ...o, header: () => o.header }),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
check: o =>
|
check: (o) =>
|
||||||
o.headerTitle !== undefined &&
|
o.headerTitle !== undefined &&
|
||||||
typeof o.headerTitle !== 'string' &&
|
typeof o.headerTitle !== 'string' &&
|
||||||
typeof o.headerTitle !== 'function',
|
typeof o.headerTitle !== 'function',
|
||||||
deprecated: 'headerTitle: <SomeElement />',
|
deprecated: 'headerTitle: <SomeElement />',
|
||||||
updated: 'headerTitle: () => <SomeElement />',
|
updated: 'headerTitle: () => <SomeElement />',
|
||||||
compat: o => ({ ...o, headerTitle: () => o.headerTitle }),
|
compat: (o) => ({ ...o, headerTitle: () => o.headerTitle }),
|
||||||
},
|
},
|
||||||
...['headerLeft', 'headerRight', 'headerBackground', 'headerBackImage'].map(
|
...['headerLeft', 'headerRight', 'headerBackground', 'headerBackImage'].map(
|
||||||
(p): Validation => ({
|
(p): Validation => ({
|
||||||
check: (o: any) => o[p] !== undefined && typeof o[p] !== 'function',
|
check: (o: any) => o[p] !== undefined && typeof o[p] !== 'function',
|
||||||
deprecated: `${p}: <SomeElement />`,
|
deprecated: `${p}: <SomeElement />`,
|
||||||
updated: `${p}: () => <SomeElement />`,
|
updated: `${p}: () => <SomeElement />`,
|
||||||
compat: o => ({ ...o, [p]: () => o[p] }),
|
compat: (o) => ({ ...o, [p]: () => o[p] }),
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
@@ -108,7 +108,7 @@ export default function validateDeprecatedOptions(
|
|||||||
const warnings: Validation[] = [];
|
const warnings: Validation[] = [];
|
||||||
|
|
||||||
// Validate options to show warnings for deprecations
|
// Validate options to show warnings for deprecations
|
||||||
validations.forEach(v => {
|
validations.forEach((v) => {
|
||||||
if (v.check(options)) {
|
if (v.check(options)) {
|
||||||
result = v.compat(result);
|
result = v.compat(result);
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ export default function validateDeprecatedOptions(
|
|||||||
console.warn(
|
console.warn(
|
||||||
`Deprecation in 'navigationOptions':\n${warnings
|
`Deprecation in 'navigationOptions':\n${warnings
|
||||||
.map(
|
.map(
|
||||||
v =>
|
(v) =>
|
||||||
`- '${v.deprecated}' will be removed in a future version. Use '${v.updated}' instead`
|
`- '${v.deprecated}' will be removed in a future version. Use '${v.updated}' instead`
|
||||||
)
|
)
|
||||||
.join('\n')}`
|
.join('\n')}`
|
||||||
|
|||||||
10
packages/stack/src/vendor/types.tsx
vendored
10
packages/stack/src/vendor/types.tsx
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import {
|
import {
|
||||||
Animated,
|
Animated,
|
||||||
StyleProp,
|
StyleProp,
|
||||||
@@ -42,7 +43,6 @@ export type StackNavigationEventMap = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
export type StackNavigationHelpers = NavigationProp<NavigationStackState>;
|
||||||
|
|
||||||
export type StackNavigationProp<
|
export type StackNavigationProp<
|
||||||
State = NavigationRoute,
|
State = NavigationRoute,
|
||||||
Params = NavigationParams
|
Params = NavigationParams
|
||||||
@@ -124,7 +124,7 @@ export type StackHeaderOptions = {
|
|||||||
/**
|
/**
|
||||||
* Style object for the title component.
|
* Style object for the title component.
|
||||||
*/
|
*/
|
||||||
headerTitleStyle?: StyleProp<TextStyle>;
|
headerTitleStyle?: React.ComponentProps<typeof Animated.Text>['style'];
|
||||||
/**
|
/**
|
||||||
* Style object for the container of the `headerTitle` component, for example to add padding.
|
* Style object for the container of the `headerTitle` component, for example to add padding.
|
||||||
* By default, `headerTitleContainerStyle` is with an absolute position style and offsets both `left` and `right`.
|
* By default, `headerTitleContainerStyle` is with an absolute position style and offsets both `left` and `right`.
|
||||||
@@ -284,6 +284,10 @@ export type StackNavigationOptions = StackHeaderOptions &
|
|||||||
* Defaults to `true` on Android and `false` on iOS.
|
* Defaults to `true` on Android and `false` on iOS.
|
||||||
*/
|
*/
|
||||||
cardOverlayEnabled?: boolean;
|
cardOverlayEnabled?: boolean;
|
||||||
|
/**
|
||||||
|
* Function that returns a React Element to display as a overlay for the card.
|
||||||
|
*/
|
||||||
|
cardOverlay?: (props: { style: StyleProp<ViewStyle> }) => React.ReactNode;
|
||||||
/**
|
/**
|
||||||
* Style object for the card in stack.
|
* Style object for the card in stack.
|
||||||
* You can provide a custom background color to use instead of the default background here.
|
* You can provide a custom background color to use instead of the default background here.
|
||||||
@@ -437,7 +441,7 @@ export type StackHeaderTitleProps = {
|
|||||||
/**
|
/**
|
||||||
* Style object for the title element.
|
* Style object for the title element.
|
||||||
*/
|
*/
|
||||||
style?: StyleProp<TextStyle>;
|
style?: React.ComponentProps<typeof Animated.Text>['style'];
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TransitionSpec =
|
export type TransitionSpec =
|
||||||
|
|||||||
2
packages/stack/src/vendor/utils/debounce.tsx
vendored
2
packages/stack/src/vendor/utils/debounce.tsx
vendored
@@ -4,7 +4,7 @@ export default function debounce<T extends (...args: any[]) => void>(
|
|||||||
): T {
|
): T {
|
||||||
let timeout: NodeJS.Timeout | number | undefined;
|
let timeout: NodeJS.Timeout | number | undefined;
|
||||||
|
|
||||||
return function(this: any, ...args) {
|
return function (this: any, ...args) {
|
||||||
if (!timeout) {
|
if (!timeout) {
|
||||||
// eslint-disable-next-line babel/no-invalid-this
|
// eslint-disable-next-line babel/no-invalid-this
|
||||||
func.apply(this, args);
|
func.apply(this, args);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default class BorderlessButton extends React.Component<Props> {
|
|||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.onActiveStateChange && this.props.onActiveStateChange(active);
|
this.props.onActiveStateChange?.(active);
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ export default function HeaderContainer({
|
|||||||
<View
|
<View
|
||||||
onLayout={
|
onLayout={
|
||||||
onContentHeightChange
|
onContentHeightChange
|
||||||
? e =>
|
? (e) =>
|
||||||
onContentHeightChange({
|
onContentHeightChange({
|
||||||
route: scene.route,
|
route: scene.route,
|
||||||
height: e.nativeEvent.layout.height,
|
height: e.nativeEvent.layout.height,
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ type State = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const warnIfHeaderStylesDefined = (styles: Record<string, any>) => {
|
const warnIfHeaderStylesDefined = (styles: Record<string, any>) => {
|
||||||
Object.keys(styles).forEach(styleProp => {
|
Object.keys(styles).forEach((styleProp) => {
|
||||||
const value = styles[styleProp];
|
const value = styles[styleProp];
|
||||||
|
|
||||||
if (styleProp === 'position' && value === 'absolute') {
|
if (styleProp === 'position' && value === 'absolute') {
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
android: {
|
android: {
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: '500',
|
fontFamily: 'sans-serif-medium',
|
||||||
|
fontWeight: 'normal',
|
||||||
},
|
},
|
||||||
default: {
|
default: {
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { TextInput, Keyboard } from 'react-native';
|
import { TextInput } from 'react-native';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
@@ -54,7 +54,11 @@ export default class KeyboardManager extends React.Component<Props> {
|
|||||||
|
|
||||||
this.clearKeyboardTimeout();
|
this.clearKeyboardTimeout();
|
||||||
|
|
||||||
Keyboard.dismiss();
|
const input = this.previouslyFocusedTextInput;
|
||||||
|
|
||||||
|
if (input) {
|
||||||
|
TextInput.State.blurTextInput(input);
|
||||||
|
}
|
||||||
|
|
||||||
// Cleanup the ID on successful page change
|
// Cleanup the ID on successful page change
|
||||||
this.previouslyFocusedTextInput = null;
|
this.previouslyFocusedTextInput = null;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type Props = {
|
|||||||
export default function SafeAreaProviderCompat({ children }: Props) {
|
export default function SafeAreaProviderCompat({ children }: Props) {
|
||||||
return (
|
return (
|
||||||
<SafeAreaConsumer>
|
<SafeAreaConsumer>
|
||||||
{insets => {
|
{(insets) => {
|
||||||
if (insets) {
|
if (insets) {
|
||||||
// If we already have insets, don't wrap the stack in another safe area provider
|
// If we already have insets, don't wrap the stack in another safe area provider
|
||||||
// This avoids an issue with updates at the cost of potentially incorrect values
|
// This avoids an issue with updates at the cost of potentially incorrect values
|
||||||
|
|||||||
103
packages/stack/src/vendor/views/Stack/Card.tsx
vendored
103
packages/stack/src/vendor/views/Stack/Card.tsx
vendored
@@ -44,6 +44,7 @@ type Props = ViewProps & {
|
|||||||
onGestureCanceled?: () => void;
|
onGestureCanceled?: () => void;
|
||||||
onGestureEnd?: () => void;
|
onGestureEnd?: () => void;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
overlay: (props: { style: StyleProp<ViewStyle> }) => React.ReactNode;
|
||||||
overlayEnabled: boolean;
|
overlayEnabled: boolean;
|
||||||
shadowEnabled: boolean;
|
shadowEnabled: boolean;
|
||||||
gestureEnabled: boolean;
|
gestureEnabled: boolean;
|
||||||
@@ -80,6 +81,10 @@ export default class Card extends React.Component<Props> {
|
|||||||
shadowEnabled: true,
|
shadowEnabled: true,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
|
gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
|
||||||
|
overlay: ({ style }: { style: StyleProp<ViewStyle> }) =>
|
||||||
|
style ? (
|
||||||
|
<Animated.View pointerEvents="none" style={[styles.overlay, style]} />
|
||||||
|
) : null,
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@@ -267,7 +272,9 @@ export default class Card extends React.Component<Props> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const closing =
|
const closing =
|
||||||
Math.abs(translation + velocity * gestureVelocityImpact) >
|
(translation + velocity) *
|
||||||
|
gestureVelocityImpact *
|
||||||
|
getInvertedMultiplier(gestureDirection) >
|
||||||
distance / 2
|
distance / 2
|
||||||
? velocity !== 0 || translation !== 0
|
? velocity !== 0 || translation !== 0
|
||||||
: false;
|
: false;
|
||||||
@@ -409,6 +416,7 @@ export default class Card extends React.Component<Props> {
|
|||||||
next,
|
next,
|
||||||
layout,
|
layout,
|
||||||
insets,
|
insets,
|
||||||
|
overlay,
|
||||||
overlayEnabled,
|
overlayEnabled,
|
||||||
shadowEnabled,
|
shadowEnabled,
|
||||||
gestureEnabled,
|
gestureEnabled,
|
||||||
@@ -470,55 +478,54 @@ export default class Card extends React.Component<Props> {
|
|||||||
: false;
|
: false;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View pointerEvents="box-none" {...rest}>
|
<CardAnimationContext.Provider value={animationContext}>
|
||||||
{overlayEnabled && overlayStyle ? (
|
<View pointerEvents="box-none" {...rest}>
|
||||||
|
{overlayEnabled ? (
|
||||||
|
<View style={StyleSheet.absoluteFill}>
|
||||||
|
{overlay({ style: overlayStyle })}
|
||||||
|
</View>
|
||||||
|
) : null}
|
||||||
<Animated.View
|
<Animated.View
|
||||||
pointerEvents="none"
|
style={[styles.container, containerStyle, customContainerStyle]}
|
||||||
style={[styles.overlay, overlayStyle]}
|
pointerEvents="box-none"
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
<Animated.View
|
|
||||||
style={[styles.container, containerStyle, customContainerStyle]}
|
|
||||||
pointerEvents="box-none"
|
|
||||||
>
|
|
||||||
<PanGestureHandler
|
|
||||||
ref={this.gestureRef}
|
|
||||||
enabled={layout.width !== 0 && gestureEnabled}
|
|
||||||
onGestureEvent={handleGestureEvent}
|
|
||||||
onHandlerStateChange={this.handleGestureStateChange}
|
|
||||||
{...this.gestureActivationCriteria()}
|
|
||||||
>
|
>
|
||||||
<Animated.View style={[styles.container, cardStyle]}>
|
<PanGestureHandler
|
||||||
{shadowEnabled && shadowStyle && !isTransparent ? (
|
ref={this.gestureRef}
|
||||||
<Animated.View
|
enabled={layout.width !== 0 && gestureEnabled}
|
||||||
style={[
|
onGestureEvent={handleGestureEvent}
|
||||||
styles.shadow,
|
onHandlerStateChange={this.handleGestureStateChange}
|
||||||
gestureDirection === 'horizontal'
|
{...this.gestureActivationCriteria()}
|
||||||
? [styles.shadowHorizontal, styles.shadowLeft]
|
>
|
||||||
: gestureDirection === 'horizontal-inverted'
|
<Animated.View style={[styles.container, cardStyle]}>
|
||||||
? [styles.shadowHorizontal, styles.shadowRight]
|
{shadowEnabled && shadowStyle && !isTransparent ? (
|
||||||
: gestureDirection === 'vertical'
|
<Animated.View
|
||||||
? [styles.shadowVertical, styles.shadowTop]
|
style={[
|
||||||
: [styles.shadowVertical, styles.shadowBottom],
|
styles.shadow,
|
||||||
shadowStyle,
|
gestureDirection === 'horizontal'
|
||||||
]}
|
? [styles.shadowHorizontal, styles.shadowLeft]
|
||||||
pointerEvents="none"
|
: gestureDirection === 'horizontal-inverted'
|
||||||
/>
|
? [styles.shadowHorizontal, styles.shadowRight]
|
||||||
) : null}
|
: gestureDirection === 'vertical'
|
||||||
<View
|
? [styles.shadowVertical, styles.shadowTop]
|
||||||
ref={this.contentRef}
|
: [styles.shadowVertical, styles.shadowBottom],
|
||||||
style={[styles.content, contentStyle] as any}
|
shadowStyle,
|
||||||
>
|
]}
|
||||||
<StackGestureRefContext.Provider value={this.gestureRef}>
|
pointerEvents="none"
|
||||||
<CardAnimationContext.Provider value={animationContext}>
|
/>
|
||||||
|
) : null}
|
||||||
|
<View
|
||||||
|
ref={this.contentRef}
|
||||||
|
style={[styles.content, contentStyle]}
|
||||||
|
>
|
||||||
|
<StackGestureRefContext.Provider value={this.gestureRef}>
|
||||||
{children}
|
{children}
|
||||||
</CardAnimationContext.Provider>
|
</StackGestureRefContext.Provider>
|
||||||
</StackGestureRefContext.Provider>
|
</View>
|
||||||
</View>
|
</Animated.View>
|
||||||
</Animated.View>
|
</PanGestureHandler>
|
||||||
</PanGestureHandler>
|
</Animated.View>
|
||||||
</Animated.View>
|
</View>
|
||||||
</View>
|
</CardAnimationContext.Provider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,7 +539,7 @@ const styles = StyleSheet.create({
|
|||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
overlay: {
|
overlay: {
|
||||||
...StyleSheet.absoluteFillObject,
|
flex: 1,
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
},
|
},
|
||||||
shadow: {
|
shadow: {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ type Props = TransitionPreset & {
|
|||||||
safeAreaInsetRight: number;
|
safeAreaInsetRight: number;
|
||||||
safeAreaInsetBottom: number;
|
safeAreaInsetBottom: number;
|
||||||
safeAreaInsetLeft: number;
|
safeAreaInsetLeft: number;
|
||||||
|
cardOverlay?: (props: { style: StyleProp<ViewStyle> }) => React.ReactNode;
|
||||||
cardOverlayEnabled?: boolean;
|
cardOverlayEnabled?: boolean;
|
||||||
cardShadowEnabled?: boolean;
|
cardShadowEnabled?: boolean;
|
||||||
cardStyle?: StyleProp<ViewStyle>;
|
cardStyle?: StyleProp<ViewStyle>;
|
||||||
@@ -65,6 +66,7 @@ const EPSILON = 0.1;
|
|||||||
|
|
||||||
function CardContainer({
|
function CardContainer({
|
||||||
active,
|
active,
|
||||||
|
cardOverlay,
|
||||||
cardOverlayEnabled,
|
cardOverlayEnabled,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
cardStyle,
|
cardStyle,
|
||||||
@@ -173,6 +175,7 @@ function CardContainer({
|
|||||||
closing={closing}
|
closing={closing}
|
||||||
onOpen={handleOpen}
|
onOpen={handleOpen}
|
||||||
onClose={handleClose}
|
onClose={handleClose}
|
||||||
|
overlay={cardOverlay}
|
||||||
overlayEnabled={cardOverlayEnabled}
|
overlayEnabled={cardOverlayEnabled}
|
||||||
shadowEnabled={cardShadowEnabled}
|
shadowEnabled={cardShadowEnabled}
|
||||||
onTransitionStart={handleTransitionStart}
|
onTransitionStart={handleTransitionStart}
|
||||||
|
|||||||
@@ -76,9 +76,6 @@ type State = {
|
|||||||
|
|
||||||
const EPSILON = 0.01;
|
const EPSILON = 0.01;
|
||||||
|
|
||||||
const dimensions = Dimensions.get('window');
|
|
||||||
const layout = { width: dimensions.width, height: dimensions.height };
|
|
||||||
|
|
||||||
const MaybeScreenContainer = ({
|
const MaybeScreenContainer = ({
|
||||||
enabled,
|
enabled,
|
||||||
...rest
|
...rest
|
||||||
@@ -161,7 +158,16 @@ const getProgressFromGesture = (
|
|||||||
layout: Layout,
|
layout: Layout,
|
||||||
descriptor?: StackDescriptor
|
descriptor?: StackDescriptor
|
||||||
) => {
|
) => {
|
||||||
const distance = getDistanceFromOptions(mode, layout, descriptor);
|
const distance = getDistanceFromOptions(
|
||||||
|
mode,
|
||||||
|
{
|
||||||
|
// Make sure that we have a non-zero distance, otherwise there will be incorrect progress
|
||||||
|
// This causes blank screen on web if it was previously inside container with display: none
|
||||||
|
width: Math.max(1, layout.width),
|
||||||
|
height: Math.max(1, layout.height),
|
||||||
|
},
|
||||||
|
descriptor
|
||||||
|
);
|
||||||
|
|
||||||
if (distance > 0) {
|
if (distance > 0) {
|
||||||
return gesture.interpolate({
|
return gesture.interpolate({
|
||||||
@@ -291,19 +297,25 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
state: State = {
|
constructor(props: Props) {
|
||||||
routes: [],
|
super(props);
|
||||||
scenes: [],
|
|
||||||
gestures: {},
|
const { height = 0, width = 0 } = Dimensions.get('window');
|
||||||
layout,
|
|
||||||
descriptors: this.props.descriptors,
|
this.state = {
|
||||||
// Used when card's header is null and mode is float to make transition
|
routes: [],
|
||||||
// between screens with headers and those without headers smooth.
|
scenes: [],
|
||||||
// This is not a great heuristic here. We don't know synchronously
|
gestures: {},
|
||||||
// on mount what the header height is so we have just used the most
|
layout: { height, width },
|
||||||
// common cases here.
|
descriptors: this.props.descriptors,
|
||||||
headerHeights: {},
|
// Used when card's header is null and mode is float to make transition
|
||||||
};
|
// between screens with headers and those without headers smooth.
|
||||||
|
// This is not a great heuristic here. We don't know synchronously
|
||||||
|
// on mount what the header height is so we have just used the most
|
||||||
|
// common cases here.
|
||||||
|
headerHeights: {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private handleLayout = (e: LayoutChangeEvent) => {
|
private handleLayout = (e: LayoutChangeEvent) => {
|
||||||
const { height, width } = e.nativeEvent.layout;
|
const { height, width } = e.nativeEvent.layout;
|
||||||
@@ -403,9 +415,9 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
left = insets.left,
|
left = insets.left,
|
||||||
} = focusedOptions.safeAreaInsets || {};
|
} = focusedOptions.safeAreaInsets || {};
|
||||||
|
|
||||||
// Screens is buggy on iOS, so we don't enable it there
|
// Screens is buggy on iOS and web, so we only enable it on Android
|
||||||
// For modals, usually we want the screen underneath to be visible, so also disable it there
|
// For modals, usually we want the screen underneath to be visible, so also disable it there
|
||||||
const isScreensEnabled = Platform.OS !== 'ios' && mode !== 'modal';
|
const isScreensEnabled = Platform.OS === 'android' && mode !== 'modal';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
@@ -433,6 +445,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
headerTransparent,
|
headerTransparent,
|
||||||
cardShadowEnabled,
|
cardShadowEnabled,
|
||||||
cardOverlayEnabled,
|
cardOverlayEnabled,
|
||||||
|
cardOverlay,
|
||||||
cardStyle,
|
cardStyle,
|
||||||
animationEnabled,
|
animationEnabled,
|
||||||
gestureResponseDistance,
|
gestureResponseDistance,
|
||||||
@@ -530,6 +543,7 @@ export default class CardStack extends React.Component<Props, State> {
|
|||||||
safeAreaInsetRight={safeAreaInsetRight}
|
safeAreaInsetRight={safeAreaInsetRight}
|
||||||
safeAreaInsetBottom={safeAreaInsetBottom}
|
safeAreaInsetBottom={safeAreaInsetBottom}
|
||||||
safeAreaInsetLeft={safeAreaInsetLeft}
|
safeAreaInsetLeft={safeAreaInsetLeft}
|
||||||
|
cardOverlay={cardOverlay}
|
||||||
cardOverlayEnabled={cardOverlayEnabled}
|
cardOverlayEnabled={cardOverlayEnabled}
|
||||||
cardShadowEnabled={cardShadowEnabled}
|
cardShadowEnabled={cardShadowEnabled}
|
||||||
cardStyle={cardStyle}
|
cardStyle={cardStyle}
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ export default 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
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
@@ -130,17 +130,17 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];
|
openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];
|
||||||
|
|
||||||
closingRouteKeys = closingRouteKeys.filter(
|
closingRouteKeys = closingRouteKeys.filter(
|
||||||
key => key !== nextFocusedRoute.key
|
(key) => key !== nextFocusedRoute.key
|
||||||
);
|
);
|
||||||
replacingRouteKeys = replacingRouteKeys.filter(
|
replacingRouteKeys = replacingRouteKeys.filter(
|
||||||
key => key !== nextFocusedRoute.key
|
(key) => key !== nextFocusedRoute.key
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!routes.find(r => r.key === previousFocusedRoute.key)) {
|
if (!routes.find((r) => r.key === previousFocusedRoute.key)) {
|
||||||
// The previous focused route isn't present in state, we treat this as a replace
|
// The previous focused route isn't present in state, we treat this as a replace
|
||||||
|
|
||||||
openingRouteKeys = openingRouteKeys.filter(
|
openingRouteKeys = openingRouteKeys.filter(
|
||||||
key => key !== previousFocusedRoute.key
|
(key) => key !== previousFocusedRoute.key
|
||||||
);
|
);
|
||||||
|
|
||||||
if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {
|
if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {
|
||||||
@@ -153,7 +153,7 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
// But since user configured it to animate the old screen like a pop, we need to add this without animation
|
// But since user configured it to animate the old screen like a pop, we need to add this without animation
|
||||||
// So remove it from `openingRouteKeys` which will remove the animation
|
// So remove it from `openingRouteKeys` which will remove the animation
|
||||||
openingRouteKeys = openingRouteKeys.filter(
|
openingRouteKeys = openingRouteKeys.filter(
|
||||||
key => key !== nextFocusedRoute.key
|
(key) => key !== nextFocusedRoute.key
|
||||||
);
|
);
|
||||||
|
|
||||||
// Keep the route being removed at the end to animate it out
|
// Keep the route being removed at the end to animate it out
|
||||||
@@ -165,7 +165,7 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
];
|
];
|
||||||
|
|
||||||
closingRouteKeys = closingRouteKeys.filter(
|
closingRouteKeys = closingRouteKeys.filter(
|
||||||
key => key !== previousFocusedRoute.key
|
(key) => key !== previousFocusedRoute.key
|
||||||
);
|
);
|
||||||
|
|
||||||
// Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt
|
// Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt
|
||||||
@@ -176,7 +176,7 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!routes.find(r => r.key === previousFocusedRoute.key)) {
|
} else if (!routes.find((r) => r.key === previousFocusedRoute.key)) {
|
||||||
// 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 (
|
||||||
@@ -188,10 +188,10 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
// Sometimes a route can be closed before the opening animation finishes
|
// Sometimes a route can be closed before the opening animation finishes
|
||||||
// So we also need to remove it from the opening list
|
// So we also need to remove it from the opening list
|
||||||
openingRouteKeys = openingRouteKeys.filter(
|
openingRouteKeys = openingRouteKeys.filter(
|
||||||
key => key !== previousFocusedRoute.key
|
(key) => key !== previousFocusedRoute.key
|
||||||
);
|
);
|
||||||
replacingRouteKeys = replacingRouteKeys.filter(
|
replacingRouteKeys = replacingRouteKeys.filter(
|
||||||
key => key !== previousFocusedRoute.key
|
(key) => key !== previousFocusedRoute.key
|
||||||
);
|
);
|
||||||
|
|
||||||
// Keep a copy of route being removed in the state to be able to animate it
|
// Keep a copy of route being removed in the state to be able to animate it
|
||||||
@@ -273,13 +273,13 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
private getPreviousRoute = ({ route }: { route: Route<string> }) => {
|
private getPreviousRoute = ({ route }: { route: Route<string> }) => {
|
||||||
const { closingRouteKeys, replacingRouteKeys } = this.state;
|
const { closingRouteKeys, replacingRouteKeys } = this.state;
|
||||||
const routes = this.state.routes.filter(
|
const routes = this.state.routes.filter(
|
||||||
r =>
|
(r) =>
|
||||||
r.key === route.key ||
|
r.key === route.key ||
|
||||||
(!closingRouteKeys.includes(r.key) &&
|
(!closingRouteKeys.includes(r.key) &&
|
||||||
!replacingRouteKeys.includes(r.key))
|
!replacingRouteKeys.includes(r.key))
|
||||||
);
|
);
|
||||||
|
|
||||||
const index = routes.findIndex(r => r.key === route.key);
|
const index = routes.findIndex((r) => r.key === route.key);
|
||||||
|
|
||||||
return routes[index - 1];
|
return routes[index - 1];
|
||||||
};
|
};
|
||||||
@@ -323,12 +323,16 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
|
|
||||||
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
private handleOpenRoute = ({ route }: { route: Route<string> }) => {
|
||||||
this.handleTransitionComplete({ route });
|
this.handleTransitionComplete({ route });
|
||||||
this.setState(state => ({
|
this.setState((state) => ({
|
||||||
routes: state.replacingRouteKeys.length
|
routes: state.replacingRouteKeys.length
|
||||||
? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key))
|
? state.routes.filter((r) => !state.replacingRouteKeys.includes(r.key))
|
||||||
: state.routes,
|
: state.routes,
|
||||||
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
|
openingRouteKeys: state.openingRouteKeys.filter(
|
||||||
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key),
|
(key) => key !== route.key
|
||||||
|
),
|
||||||
|
closingRouteKeys: state.closingRouteKeys.filter(
|
||||||
|
(key) => key !== route.key
|
||||||
|
),
|
||||||
replacingRouteKeys: [],
|
replacingRouteKeys: [],
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
@@ -336,29 +340,29 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
private handleCloseRoute = ({ route }: { route: Route<string> }) => {
|
private handleCloseRoute = ({ route }: { route: Route<string> }) => {
|
||||||
const { state, navigation } = this.props;
|
const { state, navigation } = this.props;
|
||||||
|
|
||||||
if (state.routes.find(r => r.key === route.key)) {
|
if (state.routes.find((r) => r.key === route.key)) {
|
||||||
// If a route exists in state, trigger a pop
|
// If a route exists in state, trigger a pop
|
||||||
// This will happen in when the route was closed from the card component
|
// This will happen in when the route was closed from the card component
|
||||||
// e.g. When the close animation triggered from a gesture ends
|
// e.g. When the close animation triggered from a gesture ends
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
navigation.dispatch(StackActions.pop({ key: route.key }));
|
navigation.dispatch(StackActions.pop({ key: route.key, prune: false }));
|
||||||
} else {
|
} else {
|
||||||
// While closing route we need to point to the previous one assuming that
|
// While closing route we need to point to the previous one assuming that
|
||||||
// this previous one in routes array
|
// this previous one in routes array
|
||||||
const index = this.state.routes.findIndex(r => r.key === route.key);
|
const index = this.state.routes.findIndex((r) => r.key === route.key);
|
||||||
|
|
||||||
this.handleTransitionComplete({
|
this.handleTransitionComplete({
|
||||||
route: this.state.routes[Math.max(index - 1, 0)],
|
route: this.state.routes[Math.max(index - 1, 0)],
|
||||||
});
|
});
|
||||||
|
|
||||||
// We need to clean up any state tracking the route and pop it immediately
|
// We need to clean up any state tracking the route and pop it immediately
|
||||||
this.setState(state => ({
|
this.setState((state) => ({
|
||||||
routes: state.routes.filter(r => r.key !== route.key),
|
routes: state.routes.filter((r) => r.key !== route.key),
|
||||||
openingRouteKeys: state.openingRouteKeys.filter(
|
openingRouteKeys: state.openingRouteKeys.filter(
|
||||||
key => key !== route.key
|
(key) => key !== route.key
|
||||||
),
|
),
|
||||||
closingRouteKeys: state.closingRouteKeys.filter(
|
closingRouteKeys: state.closingRouteKeys.filter(
|
||||||
key => key !== route.key
|
(key) => key !== route.key
|
||||||
),
|
),
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -410,9 +414,9 @@ export default class StackView extends React.Component<Props, State> {
|
|||||||
<GestureHandlerWrapper style={styles.container}>
|
<GestureHandlerWrapper style={styles.container}>
|
||||||
<SafeAreaProviderCompat>
|
<SafeAreaProviderCompat>
|
||||||
<SafeAreaConsumer>
|
<SafeAreaConsumer>
|
||||||
{insets => (
|
{(insets) => (
|
||||||
<KeyboardManager enabled={keyboardHandlingEnabled !== false}>
|
<KeyboardManager enabled={keyboardHandlingEnabled !== false}>
|
||||||
{props => (
|
{(props) => (
|
||||||
<CardStack
|
<CardStack
|
||||||
mode={mode}
|
mode={mode}
|
||||||
insets={insets as EdgeInsets}
|
insets={insets as EdgeInsets}
|
||||||
|
|||||||
@@ -3,6 +3,52 @@
|
|||||||
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.
|
||||||
|
|
||||||
|
## [2.8.7](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.6...react-navigation-tabs@2.8.7) (2020-03-22)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.6](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.5...react-navigation-tabs@2.8.6) (2020-03-20)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.5](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.4...react-navigation-tabs@2.8.5) (2020-03-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* don't use react-native-screens on web ([44c3900](https://github.com/react-navigation/tabs/commit/44c390075f7b76664e09fd9a1a7926645133ebec)), closes [#7485](https://github.com/react-navigation/tabs/issues/7485)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.4](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.3...react-navigation-tabs@2.8.4) (2020-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* downgrade react-native-safe-area-view ([cfc1bac](https://github.com/react-navigation/tabs/commit/cfc1bac4e153db4a4ba3f2a9033f77b53367fcbc)), closes [#7813](https://github.com/react-navigation/tabs/issues/7813)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## [2.8.3](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.2...react-navigation-tabs@2.8.3) (2020-03-16)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package react-navigation-tabs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [2.8.2](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.1...react-navigation-tabs@2.8.2) (2020-02-26)
|
## [2.8.2](https://github.com/react-navigation/tabs/compare/react-navigation-tabs@2.8.1...react-navigation-tabs@2.8.2) (2020-02-26)
|
||||||
|
|
||||||
**Note:** Version bump only for package react-navigation-tabs
|
**Note:** Version bump only for package react-navigation-tabs
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "react-navigation-tabs",
|
"name": "react-navigation-tabs",
|
||||||
"version": "2.8.2",
|
"version": "2.8.7",
|
||||||
"description": "Tab Navigation components for React Navigation",
|
"description": "Tab Navigation components for React Navigation",
|
||||||
"main": "lib/commonjs/index.js",
|
"main": "lib/commonjs/index.js",
|
||||||
"module": "lib/module/index.js",
|
"module": "lib/module/index.js",
|
||||||
@@ -42,21 +42,21 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"hoist-non-react-statics": "^3.3.2",
|
"hoist-non-react-statics": "^3.3.2",
|
||||||
"react-lifecycles-compat": "^3.0.4",
|
"react-lifecycles-compat": "^3.0.4",
|
||||||
"react-native-safe-area-view": "^0.14.6",
|
"react-native-safe-area-view": "^0.14.8",
|
||||||
"react-native-tab-view": "^2.11.0"
|
"react-native-tab-view": "^2.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@react-native-community/bob": "^0.9.7",
|
"@react-native-community/bob": "^0.10.0",
|
||||||
"@types/hoist-non-react-statics": "^3.3.1",
|
"@types/hoist-non-react-statics": "^3.3.1",
|
||||||
"@types/react": "^16.9.22",
|
"@types/react": "^16.9.23",
|
||||||
"@types/react-native": "^0.61.17",
|
"@types/react-native": "^0.61.22",
|
||||||
"del-cli": "^3.0.0",
|
"del-cli": "^3.0.0",
|
||||||
"react": "~16.9.0",
|
"react": "~16.9.0",
|
||||||
"react-native": "~0.61.5",
|
"react-native": "~0.61.5",
|
||||||
"react-native-gesture-handler": "^1.6.0",
|
"react-native-gesture-handler": "^1.6.0",
|
||||||
"react-native-reanimated": "^1.2.0",
|
"react-native-reanimated": "^1.2.0",
|
||||||
"react-native-tab-view": "^2.13.0",
|
"react-native-tab-view": "^2.13.0",
|
||||||
"react-navigation": "^4.2.2",
|
"react-navigation": "^4.3.3",
|
||||||
"typescript": "~3.7.5"
|
"typescript": "~3.7.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-gesture-handler": "^1.0.0",
|
"react-native-gesture-handler": "^1.0.0",
|
||||||
"react-native-reanimated": "^1.0.0-alpha",
|
"react-native-reanimated": "^1.0.0-alpha",
|
||||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha",
|
"react-native-screens": ">=1.0.0 || >= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0",
|
||||||
"react-navigation": "^4.1.1"
|
"react-navigation": "^4.1.1"
|
||||||
},
|
},
|
||||||
"@react-native-community/bob": {
|
"@react-native-community/bob": {
|
||||||
|
|||||||
@@ -131,7 +131,9 @@ class TabNavigationView extends React.PureComponent<Props, State> {
|
|||||||
_jumpTo = (key: string) => {
|
_jumpTo = (key: string) => {
|
||||||
const { navigation, onIndexChange } = this.props;
|
const { navigation, onIndexChange } = this.props;
|
||||||
|
|
||||||
const index = navigation.state.routes.findIndex(route => route.key === key);
|
const index = navigation.state.routes.findIndex(
|
||||||
|
(route) => route.key === key
|
||||||
|
);
|
||||||
|
|
||||||
onIndexChange(index);
|
onIndexChange(index);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -134,12 +134,12 @@ class MaterialTabView extends React.PureComponent<Props> {
|
|||||||
renderTabBar={this.renderTabBar}
|
renderTabBar={this.renderTabBar}
|
||||||
renderLazyPlaceholder={
|
renderLazyPlaceholder={
|
||||||
lazyPlaceholderComponent !== undefined
|
lazyPlaceholderComponent !== undefined
|
||||||
? props => React.createElement(lazyPlaceholderComponent, props)
|
? (props) => React.createElement(lazyPlaceholderComponent, props)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
renderPager={
|
renderPager={
|
||||||
pagerComponent !== undefined
|
pagerComponent !== undefined
|
||||||
? props => React.createElement(pagerComponent, props)
|
? (props) => React.createElement(pagerComponent, props)
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Platform, StyleSheet, View } from 'react-native';
|
import { Platform, StyleSheet, View } from 'react-native';
|
||||||
|
|
||||||
import { Screen, screensEnabled } from 'react-native-screens';
|
import { Screen, screensEnabled } from 'react-native-screens';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@@ -9,12 +8,14 @@ type Props = {
|
|||||||
style?: any;
|
style?: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
const FAR_FAR_AWAY = 3000; // this should be big enough to move the whole view out of its container
|
const FAR_FAR_AWAY = 30000; // this should be big enough to move the whole view out of its container
|
||||||
|
|
||||||
export default class ResourceSavingScene extends React.Component<Props> {
|
export default class ResourceSavingScene extends React.Component<Props> {
|
||||||
render() {
|
render() {
|
||||||
if (screensEnabled?.()) {
|
// react-native-screens is buggy on web
|
||||||
|
if (screensEnabled?.() && Platform.OS !== 'web') {
|
||||||
const { isVisible, ...rest } = this.props;
|
const { isVisible, ...rest } = this.props;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
return <Screen active={isVisible ? 1 : 0} {...rest} />;
|
||||||
}
|
}
|
||||||
@@ -23,7 +24,13 @@ export default class ResourceSavingScene extends React.Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[styles.container, style, { opacity: isVisible ? 1 : 0 }]}
|
style={[
|
||||||
|
styles.container,
|
||||||
|
Platform.OS === 'web'
|
||||||
|
? { display: isVisible ? 'flex' : 'none' }
|
||||||
|
: null,
|
||||||
|
style,
|
||||||
|
]}
|
||||||
collapsable={false}
|
collapsable={false}
|
||||||
removeClippedSubviews={
|
removeClippedSubviews={
|
||||||
// On iOS, set removeClippedSubviews to true only when not focused
|
// On iOS, set removeClippedSubviews to true only when not focused
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const packages = path.join(__dirname, '..', 'packages');
|
|||||||
|
|
||||||
const invalid = [];
|
const invalid = [];
|
||||||
|
|
||||||
fs.readdirSync(packages).forEach(name => {
|
fs.readdirSync(packages).forEach((name) => {
|
||||||
const dir = path.join(packages, name);
|
const dir = path.join(packages, name);
|
||||||
|
|
||||||
if (fs.statSync(path.join(packages, name)).isDirectory()) {
|
if (fs.statSync(path.join(packages, name)).isDirectory()) {
|
||||||
@@ -26,6 +26,6 @@ fs.readdirSync(packages).forEach(name => {
|
|||||||
if (invalid.length) {
|
if (invalid.length) {
|
||||||
console.log(
|
console.log(
|
||||||
'Found invalid path to type definitions in the following packages:\n',
|
'Found invalid path to type definitions in the following packages:\n',
|
||||||
invalid.map(p => `- ${p.name} (${p.types})`).join('\n')
|
invalid.map((p) => `- ${p.name} (${p.types})`).join('\n')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user