mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-01-12 22:51:18 +08:00
chore: upgrade depenendecies
This commit is contained in:
@@ -13,49 +13,50 @@
|
||||
"test": "jest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/vector-icons": "^10.2.0",
|
||||
"@react-native-community/masked-view": "^0.1.10",
|
||||
"@expo/vector-icons": "^10.0.0",
|
||||
"@react-native-community/masked-view": "0.1.10",
|
||||
"color": "^3.1.2",
|
||||
"expo": "^38.0.9",
|
||||
"expo-asset": "~8.1.7",
|
||||
"expo-blur": "~8.1.2",
|
||||
"expo-linking": "^1.0.3",
|
||||
"expo-updates": "~0.2.14",
|
||||
"expo": "^39.0.0",
|
||||
"expo-asset": "~8.2.0",
|
||||
"expo-blur": "~8.2.0",
|
||||
"expo-linking": "^1.0.4",
|
||||
"expo-updates": "~0.3.3",
|
||||
"koa": "^2.13.0",
|
||||
"react": "~16.9.0",
|
||||
"react-dom": "~16.9.0",
|
||||
"react-native": "~0.62.2",
|
||||
"react": "~16.13.1",
|
||||
"react-dom": "~16.13.1",
|
||||
"react-native": "~0.63.2",
|
||||
"react-native-appearance": "~0.3.3",
|
||||
"react-native-gesture-handler": "1.7.0",
|
||||
"react-native-paper": "^4.0.1",
|
||||
"react-native-reanimated": "~1.9.0",
|
||||
"react-native-safe-area-context": "~3.0.7",
|
||||
"react-native-screens": "^2.9.0",
|
||||
"react-native-gesture-handler": "~1.7.0",
|
||||
"react-native-paper": "^4.2.0",
|
||||
"react-native-reanimated": "~1.13.0",
|
||||
"react-native-safe-area-context": "3.1.4",
|
||||
"react-native-screens": "~2.10.1",
|
||||
"react-native-tab-view": "^2.15.1",
|
||||
"react-native-vector-icons": "^7.0.0",
|
||||
"react-native-web": "^0.11.7"
|
||||
"react-native-web": "^0.13.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/node": "^7.10.1",
|
||||
"@expo/webpack-config": "^0.12.21",
|
||||
"@types/cheerio": "^0.22.21",
|
||||
"@types/jest-dev-server": "^4.2.0",
|
||||
"@types/koa": "^2.11.3",
|
||||
"@types/koa": "^2.11.4",
|
||||
"@types/node-fetch": "^2.5.7",
|
||||
"@types/react": "~16.9.44",
|
||||
"@types/react": "~16.9.35",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
"@types/react-native": "~0.63.4",
|
||||
"@types/react-native": "~0.63.2",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"babel-preset-expo": "^8.2.3",
|
||||
"babel-preset-expo": "^8.3.0",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"expo-cli": "^3.23.1",
|
||||
"jest": "^26.2.2",
|
||||
"expo-cli": "^3.27.7",
|
||||
"jest": "^26.4.2",
|
||||
"jest-dev-server": "^4.4.0",
|
||||
"mock-require-assets": "^0.0.1",
|
||||
"node-fetch": "^2.6.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"nodemon": "^2.0.4",
|
||||
"playwright": "^0.14.0",
|
||||
"serve": "^11.3.0",
|
||||
"typescript": "~3.9.5"
|
||||
"typescript": "^4.0.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,13 +67,6 @@ type RootDrawerParamList = {
|
||||
Another: undefined;
|
||||
};
|
||||
|
||||
type RootStackParamList = {
|
||||
Home: undefined;
|
||||
NotFound: undefined;
|
||||
} & {
|
||||
[P in keyof typeof SCREENS]: undefined;
|
||||
};
|
||||
|
||||
const SCREENS = {
|
||||
SimpleStack: { title: 'Simple Stack', component: SimpleStack },
|
||||
ModalPresentationStack: {
|
||||
@@ -123,6 +116,13 @@ const SCREENS = {
|
||||
},
|
||||
};
|
||||
|
||||
type RootStackParamList = {
|
||||
Home: undefined;
|
||||
NotFound: undefined;
|
||||
} & {
|
||||
[P in keyof typeof SCREENS]: undefined;
|
||||
};
|
||||
|
||||
const Drawer = createDrawerNavigator<RootDrawerParamList>();
|
||||
const Stack = createStackNavigator<RootStackParamList>();
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin');
|
||||
|
||||
const node_modules = path.resolve(__dirname, '..', 'node_modules');
|
||||
const packages = path.resolve(__dirname, '..', 'packages');
|
||||
@@ -19,10 +17,6 @@ module.exports = async function (env, argv) {
|
||||
use: 'babel-loader',
|
||||
});
|
||||
|
||||
config.resolve.plugins = config.resolve.plugins.filter(
|
||||
(p) => !(p instanceof ModuleScopePlugin)
|
||||
);
|
||||
|
||||
Object.assign(config.resolve.alias, {
|
||||
'react': path.resolve(node_modules, 'react'),
|
||||
'react-native': path.resolve(node_modules, 'react-native-web'),
|
||||
|
||||
26
package.json
26
package.json
@@ -25,23 +25,23 @@
|
||||
"example": "yarn --cwd example"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/config-conventional": "^9.1.1",
|
||||
"@types/jest": "^26.0.8",
|
||||
"babel-jest": "^26.2.2",
|
||||
"@commitlint/config-conventional": "^11.0.0",
|
||||
"@types/jest": "^26.0.14",
|
||||
"babel-jest": "^26.3.0",
|
||||
"codecov": "^3.7.2",
|
||||
"commitlint": "^9.1.0",
|
||||
"eslint": "^7.6.0",
|
||||
"eslint-config-satya164": "^3.1.7",
|
||||
"husky": "^4.2.5",
|
||||
"jest": "^26.2.2",
|
||||
"commitlint": "^11.0.0",
|
||||
"eslint": "^7.9.0",
|
||||
"eslint-config-satya164": "^3.1.8",
|
||||
"husky": "^4.3.0",
|
||||
"jest": "^26.4.2",
|
||||
"lerna": "^3.22.1",
|
||||
"metro-react-native-babel-preset": "^0.61.0",
|
||||
"prettier": "^2.0.5",
|
||||
"typescript": "^3.9.7"
|
||||
"metro-react-native-babel-preset": "^0.63.0",
|
||||
"prettier": "^2.1.2",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"resolutions": {
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.62.2"
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.2"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
||||
@@ -42,16 +42,16 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@react-navigation/native": "^5.7.3",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/color": "^3.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@types/react-native": "^0.63.4",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-native": "^0.63.20",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.62.2",
|
||||
"react-native-safe-area-context": "~3.1.1",
|
||||
"react-native-screens": "^2.9.0",
|
||||
"typescript": "^3.9.7"
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.2",
|
||||
"react-native-safe-area-context": "3.1.4",
|
||||
"react-native-screens": "~2.10.1",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^5.0.5",
|
||||
|
||||
@@ -33,9 +33,9 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@react-navigation/native": "^5.7.3",
|
||||
"@types/react": "^16.9.44",
|
||||
"react": "~16.9.0",
|
||||
"typescript": "^3.9.7"
|
||||
"@types/react": "^16.9.49",
|
||||
"react": "~16.13.1",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^5.0.5",
|
||||
|
||||
@@ -12,7 +12,9 @@ export function navigate(
|
||||
params?: object,
|
||||
action?: never
|
||||
): NavigateActionType;
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export function navigate(options: NavigateActionPayload): NavigateActionType;
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export function navigate(
|
||||
options: string | NavigateActionPayload,
|
||||
params?: object,
|
||||
|
||||
@@ -44,14 +44,14 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-is": "^16.7.1",
|
||||
"@types/use-subscription": "^1.0.0",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react": "~16.13.1",
|
||||
"react-test-renderer": "~16.13.1",
|
||||
"typescript": "^3.9.7"
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*"
|
||||
|
||||
@@ -714,26 +714,22 @@ it('navigates to nested child in a navigator', () => {
|
||||
|
||||
expect(element).toMatchInlineSnapshot(`"[foo-a, undefined]"`);
|
||||
|
||||
act(
|
||||
() =>
|
||||
navigation.current &&
|
||||
navigation.current.navigate('bar', {
|
||||
screen: 'bar-b',
|
||||
params: { test: 42 },
|
||||
})
|
||||
act(() =>
|
||||
navigation.current?.navigate('bar', {
|
||||
screen: 'bar-b',
|
||||
params: { test: 42 },
|
||||
})
|
||||
);
|
||||
|
||||
expect(element).toMatchInlineSnapshot(
|
||||
`"[bar-b, {\\"some\\":\\"stuff\\",\\"test\\":42}]"`
|
||||
);
|
||||
|
||||
act(
|
||||
() =>
|
||||
navigation.current &&
|
||||
navigation.current.navigate('bar', {
|
||||
screen: 'bar-a',
|
||||
params: { whoa: 'test' },
|
||||
})
|
||||
act(() =>
|
||||
navigation.current?.navigate('bar', {
|
||||
screen: 'bar-a',
|
||||
params: { whoa: 'test' },
|
||||
})
|
||||
);
|
||||
|
||||
expect(element).toMatchInlineSnapshot(
|
||||
@@ -855,13 +851,11 @@ it('navigates to nested child in a navigator with initial: false', () => {
|
||||
type: 'test',
|
||||
});
|
||||
|
||||
act(
|
||||
() =>
|
||||
navigation.current &&
|
||||
navigation.current.navigate('bar', {
|
||||
screen: 'bar-b',
|
||||
params: { test: 42 },
|
||||
})
|
||||
act(() =>
|
||||
navigation.current?.navigate('bar', {
|
||||
screen: 'bar-b',
|
||||
params: { test: 42 },
|
||||
})
|
||||
);
|
||||
|
||||
expect(first).toMatchInlineSnapshot(
|
||||
@@ -962,14 +956,12 @@ it('navigates to nested child in a navigator with initial: false', () => {
|
||||
type: 'test',
|
||||
});
|
||||
|
||||
act(
|
||||
() =>
|
||||
navigation.current &&
|
||||
navigation.current.navigate('bar', {
|
||||
screen: 'bar-b',
|
||||
params: { test: 42 },
|
||||
initial: false,
|
||||
})
|
||||
act(() =>
|
||||
navigation.current?.navigate('bar', {
|
||||
screen: 'bar-b',
|
||||
params: { test: 42 },
|
||||
initial: false,
|
||||
})
|
||||
);
|
||||
|
||||
expect(second).toMatchInlineSnapshot(`"[bar-b, {\\"test\\":42}]"`);
|
||||
|
||||
@@ -570,10 +570,7 @@ const createRouteObjects = (
|
||||
const value = allParams![p];
|
||||
|
||||
if (value) {
|
||||
acc[key] =
|
||||
config.parse && config.parse[key]
|
||||
? config.parse[key](value)
|
||||
: value;
|
||||
acc[key] = config.parse?.[key] ? config.parse[key](value) : value;
|
||||
}
|
||||
|
||||
return acc;
|
||||
|
||||
@@ -69,7 +69,7 @@ export default function useEventEmitter<T extends Record<string, any>>(
|
||||
// Copy the current list of callbacks in case they are mutated during execution
|
||||
const callbacks =
|
||||
target !== undefined
|
||||
? items[target] && items[target].slice()
|
||||
? items[target]?.slice()
|
||||
: ([] as Listeners)
|
||||
.concat(...Object.keys(items).map((t) => items[t]))
|
||||
.filter((cb, i, self) => self.lastIndexOf(cb) === i);
|
||||
|
||||
@@ -95,7 +95,7 @@ const getRouteConfigsFromChildren = <
|
||||
throw new Error(
|
||||
`A navigator can only contain 'Screen' components as its direct children (found '${
|
||||
// @ts-expect-error: child can be any type and we're accessing it safely, but TS doesn't understand it
|
||||
child.type && child.type.name ? child.type.name : String(child)
|
||||
child.type?.name ? child.type.name : String(child)
|
||||
}')`
|
||||
);
|
||||
}, []);
|
||||
|
||||
@@ -41,12 +41,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/deep-equal": "^1.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@types/react": "^16.9.49",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"typescript": "^3.9.7"
|
||||
"react": "~16.13.1",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*"
|
||||
|
||||
@@ -47,17 +47,17 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@react-navigation/native": "^5.7.3",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@types/react-native": "^0.63.4",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-native": "^0.63.20",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.62.2",
|
||||
"react-native-gesture-handler": "^1.7.0",
|
||||
"react-native-reanimated": "1.9.0",
|
||||
"react-native-safe-area-context": "~3.1.1",
|
||||
"react-native-screens": "^2.9.0",
|
||||
"typescript": "^3.9.7"
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.2",
|
||||
"react-native-gesture-handler": "~1.7.0",
|
||||
"react-native-reanimated": "~1.13.0",
|
||||
"react-native-safe-area-context": "3.1.4",
|
||||
"react-native-screens": "~2.10.1",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^5.0.5",
|
||||
|
||||
@@ -43,16 +43,16 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@react-navigation/native": "^5.7.3",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@types/react-native": "^0.63.4",
|
||||
"@types/react-native-vector-icons": "^6.4.5",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-native": "^0.63.20",
|
||||
"@types/react-native-vector-icons": "^6.4.6",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.62.2",
|
||||
"react-native-paper": "^4.0.1",
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.2",
|
||||
"react-native-paper": "^4.2.0",
|
||||
"react-native-vector-icons": "^7.0.0",
|
||||
"typescript": "^3.9.7"
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^5.0.5",
|
||||
|
||||
@@ -46,16 +46,16 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@react-navigation/native": "^5.7.3",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@types/react-native": "^0.63.4",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-native": "^0.63.20",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.62.2",
|
||||
"react-native-gesture-handler": "^1.7.0",
|
||||
"react-native-reanimated": "1.9.0",
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.2",
|
||||
"react-native-gesture-handler": "~1.7.0",
|
||||
"react-native-reanimated": "~1.13.0",
|
||||
"react-native-tab-view": "^2.15.1",
|
||||
"typescript": "^3.9.7"
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-navigation/native": "^5.0.5",
|
||||
|
||||
@@ -42,15 +42,15 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-dom": "^16.9.8",
|
||||
"@types/react-native": "^0.63.4",
|
||||
"@types/react-native": "^0.63.20",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react": "~16.13.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-native": "~0.62.2",
|
||||
"typescript": "^3.9.7"
|
||||
"react-native": "~0.63.2",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "*",
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"devDependencies": {
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"del-cli": "^3.0.1",
|
||||
"typescript": "^3.9.7"
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"@react-native-community/bob": {
|
||||
"source": "src",
|
||||
|
||||
@@ -43,7 +43,9 @@ export function navigate(
|
||||
| { key: string; params?: object }
|
||||
| { name: string; key?: string; params?: object }
|
||||
): Action;
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export function navigate(name: string, params?: object): Action;
|
||||
// eslint-disable-next-line no-redeclare
|
||||
export function navigate(...args: any): Action {
|
||||
if (typeof args[0] === 'string') {
|
||||
return { type: 'NAVIGATE', payload: { name: args[0], params: args[1] } };
|
||||
|
||||
@@ -47,17 +47,17 @@
|
||||
"@react-native-community/bob": "^0.16.2",
|
||||
"@react-native-community/masked-view": "^0.1.10",
|
||||
"@react-navigation/native": "^5.7.3",
|
||||
"@testing-library/react-native": "^7.0.1",
|
||||
"@testing-library/react-native": "^7.0.2",
|
||||
"@types/color": "^3.0.1",
|
||||
"@types/react": "^16.9.44",
|
||||
"@types/react-native": "^0.63.4",
|
||||
"@types/react": "^16.9.49",
|
||||
"@types/react-native": "^0.63.20",
|
||||
"del-cli": "^3.0.1",
|
||||
"react": "~16.9.0",
|
||||
"react-native": "~0.62.2",
|
||||
"react-native-gesture-handler": "^1.7.0",
|
||||
"react-native-safe-area-context": "~3.1.1",
|
||||
"react-native-screens": "^2.9.0",
|
||||
"typescript": "^3.9.7"
|
||||
"react": "~16.13.1",
|
||||
"react-native": "~0.63.2",
|
||||
"react-native-gesture-handler": "~1.7.0",
|
||||
"react-native-safe-area-context": "3.1.4",
|
||||
"react-native-screens": "~2.10.1",
|
||||
"typescript": "^4.0.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-native-community/masked-view": ">= 0.1.0",
|
||||
|
||||
@@ -57,8 +57,7 @@ function StackNavigator({
|
||||
|
||||
React.useEffect(
|
||||
() =>
|
||||
navigation.addListener &&
|
||||
navigation.addListener('tabPress', (e) => {
|
||||
navigation.addListener?.('tabPress', (e) => {
|
||||
const isFocused = navigation.isFocused();
|
||||
|
||||
// Run the operation in the next frame so we're sure all listeners have been run
|
||||
|
||||
@@ -17,7 +17,7 @@ export default class KeyboardManager extends React.Component<Props> {
|
||||
|
||||
// Numeric id of the previously focused text input
|
||||
// When a gesture didn't change the tab, we can restore the focused input with this
|
||||
private previouslyFocusedTextInput: number | null = null;
|
||||
private previouslyFocusedTextInput: any | null = null;
|
||||
private startTimestamp: number = 0;
|
||||
private keyboardTimeout: any;
|
||||
|
||||
@@ -35,10 +35,8 @@ export default class KeyboardManager extends React.Component<Props> {
|
||||
|
||||
this.clearKeyboardTimeout();
|
||||
|
||||
// @ts-expect-error: currentlyFocusedInput is pretty new, so not in the type definitions
|
||||
const input = TextInput.State.currentlyFocusedInput
|
||||
? // @ts-expect-error
|
||||
TextInput.State.currentlyFocusedInput()
|
||||
const input: any = TextInput.State.currentlyFocusedInput
|
||||
? TextInput.State.currentlyFocusedInput()
|
||||
: TextInput.State.currentlyFocusedField();
|
||||
|
||||
// When a page change begins, blur the currently focused input
|
||||
|
||||
Reference in New Issue
Block a user