mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-29 04:45:19 +08:00
chore: upgrade depenendecies
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
presets: ['module:metro-react-native-babel-preset'],
|
||||
};
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
};
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
"name": "React Navigation Stack Example",
|
||||
"description": "Demonstrates the various capabilities of react-navigation-stack",
|
||||
"slug": "react-navigation-stack-demo",
|
||||
"sdkVersion": "33.0.0",
|
||||
"sdkVersion": "36.0.0",
|
||||
"version": "1.0.0",
|
||||
"primaryColor": "#2196f3"
|
||||
"primaryColor": "#2196f3",
|
||||
"platforms": [
|
||||
"android",
|
||||
"ios"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,45 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies, import/no-commonjs */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
|
||||
const path = require('path');
|
||||
const blacklist = require('metro-config/src/defaults/blacklist');
|
||||
const project = require('../package.json');
|
||||
const fs = require('fs');
|
||||
const escape = require('escape-string-regexp');
|
||||
const blacklist = require('metro-config/src/defaults/blacklist');
|
||||
|
||||
const projectDependencies = Object.keys({
|
||||
...project.dependencies,
|
||||
...project.peerDependencies,
|
||||
});
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const pak = JSON.parse(
|
||||
fs.readFileSync(path.join(root, 'package.json'), 'utf8')
|
||||
);
|
||||
|
||||
const modules = [
|
||||
'@babel/runtime',
|
||||
'@expo/vector-icons',
|
||||
...Object.keys({
|
||||
...pak.dependencies,
|
||||
...pak.peerDependencies,
|
||||
}),
|
||||
];
|
||||
|
||||
module.exports = {
|
||||
projectRoot: __dirname,
|
||||
watchFolders: [path.resolve(__dirname, '..')],
|
||||
watchFolders: [root],
|
||||
|
||||
resolver: {
|
||||
blacklistRE: blacklist([
|
||||
new RegExp(
|
||||
`^${escape(
|
||||
path.resolve(__dirname, 'node_modules', project.name)
|
||||
)}\\/.*$`
|
||||
),
|
||||
new RegExp(
|
||||
`^${escape(path.resolve(__dirname, '..', 'node_modules'))}\\/.*$`
|
||||
),
|
||||
new RegExp(`^${escape(path.join(root, 'node_modules'))}\\/.*$`),
|
||||
]),
|
||||
|
||||
providesModuleNodeModules: [
|
||||
'@expo/vector-icons',
|
||||
'@babel/runtime',
|
||||
...projectDependencies,
|
||||
],
|
||||
extraNodeModules: modules.reduce((acc, name) => {
|
||||
acc[name] = path.join(__dirname, 'node_modules', name);
|
||||
return acc;
|
||||
}, {}),
|
||||
},
|
||||
|
||||
transformer: {
|
||||
getTransformOptions: async () => ({
|
||||
transform: {
|
||||
experimentalImportSupport: false,
|
||||
inlineRequires: true,
|
||||
},
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,29 +9,30 @@
|
||||
"ios": "expo start --ios"
|
||||
},
|
||||
"dependencies": {
|
||||
"@expo/vector-icons": "^10.0.0",
|
||||
"@react-native-community/masked-view": "^0.1.1",
|
||||
"@expo/vector-icons": "^10.0.6",
|
||||
"@react-native-community/masked-view": "0.1.5",
|
||||
"@react-navigation/core": "^3.5.1",
|
||||
"@react-navigation/native": "^3.6.2",
|
||||
"expo": "^33.0.7",
|
||||
"expo-asset": "^5.0.1",
|
||||
"expo-blur": "~5.0.1",
|
||||
"expo-constants": "~5.0.1",
|
||||
"hoist-non-react-statics": "^3.3.0",
|
||||
"react": "16.8.3",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
|
||||
"expo": "^36.0.0",
|
||||
"expo-asset": "~8.0.0",
|
||||
"expo-blur": "~8.0.0",
|
||||
"expo-constants": "~8.0.0",
|
||||
"hoist-non-react-statics": "^3.3.1",
|
||||
"react": "16.9.0",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
|
||||
"react-native-gesture-handler": "~1.5.0",
|
||||
"react-native-iphone-x-helper": "^1.2.1",
|
||||
"react-native-paper": "^2.15.2",
|
||||
"react-navigation-drawer": "^2.0.1",
|
||||
"react-navigation-header-buttons": "^3.0.2",
|
||||
"react-navigation-stack": "^1.7.2",
|
||||
"react-navigation-tabs": "^1.2.0"
|
||||
"react-native-paper": "^3.4.0",
|
||||
"react-native-reanimated": "~1.4.0",
|
||||
"react-native-safe-area-context": "0.6.0",
|
||||
"react-native-screens": "2.0.0-alpha.12",
|
||||
"react-navigation-drawer": "^2.3.3",
|
||||
"react-navigation-header-buttons": "^3.0.4",
|
||||
"react-navigation-stack": "^2.0.4",
|
||||
"react-navigation-tabs": "^2.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-module-resolver": "^3.2.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"react-native-safe-area-view": "0.14.6",
|
||||
"react-native-screens": "1.0.0-alpha.23"
|
||||
"babel-plugin-module-resolver": "^4.0.0",
|
||||
"expo-cli": "^3.11.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,10 @@ import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
} from 'react-navigation-stack';
|
||||
import { createDrawerNavigator } from 'react-navigation-drawer';
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
NavigationDrawerScreenProps,
|
||||
} from 'react-navigation-drawer';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import SampleText from './SampleText';
|
||||
|
||||
@@ -36,11 +39,10 @@ const MyNavScreen = ({
|
||||
</ScrollView>
|
||||
);
|
||||
|
||||
const InboxScreen = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => <MyNavScreen banner="Inbox Screen" navigation={navigation} />;
|
||||
const InboxScreen = ({ navigation }: NavigationDrawerScreenProps) => (
|
||||
<MyNavScreen banner="Inbox Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
InboxScreen.navigationOptions = {
|
||||
headerTitle: 'Inbox',
|
||||
};
|
||||
@@ -52,6 +54,7 @@ const EmailScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
const DraftsScreen = ({ navigation }: NavigationStackScreenProps) => (
|
||||
<MyNavScreen banner="Drafts Screen" navigation={navigation} />
|
||||
);
|
||||
|
||||
DraftsScreen.navigationOptions = {
|
||||
headerTitle: 'Drafts',
|
||||
};
|
||||
|
||||
@@ -92,7 +92,7 @@ const ProfileNavigator = createStackNavigator(
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: {
|
||||
headerLeft: null,
|
||||
headerLeft: () => null,
|
||||
},
|
||||
mode: 'modal',
|
||||
}
|
||||
@@ -107,8 +107,9 @@ MyHeaderTestScreen.navigationOptions = ({
|
||||
}: NavigationStackScreenProps) => {
|
||||
const headerVisible =
|
||||
navigation.state.params && navigation.state.params.headerVisible;
|
||||
|
||||
return {
|
||||
header: headerVisible ? undefined : null,
|
||||
headerShown: headerVisible,
|
||||
title: 'Now you see me',
|
||||
};
|
||||
};
|
||||
@@ -122,7 +123,7 @@ const ModalStack = createStackNavigator(
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: {
|
||||
header: null,
|
||||
headerShown: false,
|
||||
},
|
||||
mode: 'modal',
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ MyProfileScreen.navigationOptions = (props: NavigationStackScreenProps) => {
|
||||
headerBackImage: params!.headerBackImage,
|
||||
// Render a button on the right side of the header.
|
||||
// When pressed switches the screen to edit mode.
|
||||
headerRight: (
|
||||
headerRight: () => (
|
||||
<HeaderButtons>
|
||||
<HeaderButtons.Item
|
||||
title={params!.mode === 'edit' ? 'Done' : 'Edit'}
|
||||
@@ -221,23 +221,18 @@ MyProfileScreen.navigationOptions = (props: NavigationStackScreenProps) => {
|
||||
};
|
||||
};
|
||||
|
||||
const SimpleStack = createStackNavigator(
|
||||
{
|
||||
Home: {
|
||||
screen: MyHomeScreen,
|
||||
},
|
||||
Photos: {
|
||||
path: 'photos/:name',
|
||||
screen: MyPhotosScreen,
|
||||
},
|
||||
Profile: {
|
||||
path: 'people/:name',
|
||||
screen: MyProfileScreen,
|
||||
},
|
||||
const SimpleStack = createStackNavigator({
|
||||
Home: {
|
||||
screen: MyHomeScreen,
|
||||
},
|
||||
{
|
||||
// headerLayoutPreset: 'center',
|
||||
}
|
||||
);
|
||||
Photos: {
|
||||
path: 'photos/:name',
|
||||
screen: MyPhotosScreen,
|
||||
},
|
||||
Profile: {
|
||||
path: 'people/:name',
|
||||
screen: MyProfileScreen,
|
||||
},
|
||||
});
|
||||
|
||||
export default SimpleStack;
|
||||
|
||||
@@ -39,6 +39,7 @@ const MyNavScreen = ({
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
{TEXT.split('\n').map((p, n) => (
|
||||
<Themed.Text
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
key={n}
|
||||
style={{ marginVertical: 10, marginHorizontal: 8 }}
|
||||
>
|
||||
|
||||
@@ -52,7 +52,7 @@ interface MyHomeScreenProps {
|
||||
|
||||
class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
static navigationOptions = {
|
||||
headerBackTitle: null,
|
||||
headerBackTitleVisible: false,
|
||||
title: 'Welcome',
|
||||
};
|
||||
|
||||
@@ -65,13 +65,14 @@ class MyHomeScreen extends React.Component<MyHomeScreenProps> {
|
||||
interface MyPhotosScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
|
||||
class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
static navigationOptions = ({
|
||||
navigation,
|
||||
}: {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}) => ({
|
||||
headerBackTitle: null,
|
||||
headerBackTitleVisible: false,
|
||||
title: `${navigation.state.params!.name}'s photos`,
|
||||
});
|
||||
|
||||
@@ -94,6 +95,7 @@ class MyPhotosScreen extends React.Component<MyPhotosScreenProps> {
|
||||
interface MyProfileScreenProps {
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
}
|
||||
|
||||
class MyProfileScreen extends React.Component<MyProfileScreenProps> {
|
||||
static navigationOptions = {
|
||||
title: 'Profile',
|
||||
|
||||
@@ -3,6 +3,8 @@ import { SafeAreaView, Themed } from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
NavigationStackScreenProps,
|
||||
TransitionPresets,
|
||||
HeaderStyleInterpolators,
|
||||
} from 'react-navigation-stack';
|
||||
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
@@ -78,7 +80,7 @@ class ScreenWithLongTitle extends React.Component<NavigationStackScreenProps> {
|
||||
|
||||
class ScreenWithNoHeader extends React.Component<NavigationStackScreenProps> {
|
||||
static navigationOptions = {
|
||||
header: null,
|
||||
headerShown: false,
|
||||
title: 'No Header',
|
||||
};
|
||||
|
||||
@@ -105,7 +107,10 @@ const StackWithHeaderPreset = createStackNavigator(
|
||||
ScreenWithNoHeader,
|
||||
},
|
||||
{
|
||||
headerTransitionPreset: 'uikit',
|
||||
defaultNavigationOptions: {
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Platform, ScrollView, StyleSheet, View } from 'react-native';
|
||||
import { BlurView } from 'expo-blur';
|
||||
import { isIphoneX } from 'react-native-iphone-x-helper';
|
||||
import { getStatusBarHeight } from 'react-native-iphone-x-helper';
|
||||
import {
|
||||
NavigationEventPayload,
|
||||
NavigationEventSubscription,
|
||||
@@ -10,10 +10,10 @@ import {
|
||||
} from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
Header,
|
||||
HeaderStyleInterpolator,
|
||||
HeaderStyleInterpolators,
|
||||
NavigationStackScreenProps,
|
||||
NavigationStackProp,
|
||||
TransitionPresets,
|
||||
} from 'react-navigation-stack';
|
||||
import { Button } from './commonComponents/ButtonWithMargin';
|
||||
import { HeaderButtons } from './commonComponents/HeaderButtons';
|
||||
@@ -56,15 +56,8 @@ class MyNavScreen extends React.Component<MyNavScreenProps> {
|
||||
// at some point.
|
||||
|
||||
getHeaderInset(): any {
|
||||
const NOTCH_HEIGHT = isIphoneX() ? 25 : 0;
|
||||
|
||||
// $FlowIgnore: we will remove the HEIGHT static soon enough
|
||||
const BASE_HEADER_HEIGHT = Header.HEIGHT;
|
||||
|
||||
const HEADER_HEIGHT =
|
||||
Platform.OS === 'ios'
|
||||
? BASE_HEADER_HEIGHT + NOTCH_HEIGHT
|
||||
: BASE_HEADER_HEIGHT + 20;
|
||||
getStatusBarHeight() + Platform.select({ ios: 44, default: 56 });
|
||||
|
||||
return Platform.select({
|
||||
android: {
|
||||
@@ -193,10 +186,12 @@ MyProfileScreen.navigationOptions = (props: {
|
||||
const { state, setParams } = navigation;
|
||||
const { params } = state;
|
||||
return {
|
||||
headerBackImage: params!.headerBackImage,
|
||||
headerBackImage: params!.headerBackImage
|
||||
? () => params!.headerBackImage
|
||||
: undefined,
|
||||
// Render a button on the right side of the header.
|
||||
// When pressed switches the screen to edit mode.
|
||||
headerRight: (
|
||||
headerRight: () => (
|
||||
<HeaderButtons>
|
||||
<HeaderButtons.Item
|
||||
color={theme === 'light' ? '#000' : '#fff'}
|
||||
@@ -227,7 +222,8 @@ const StackWithTranslucentHeader = createStackNavigator(
|
||||
},
|
||||
{
|
||||
defaultNavigationOptions: ({ theme }: NavigationStackScreenProps) => ({
|
||||
headerBackground:
|
||||
...TransitionPresets.SlideFromRightIOS,
|
||||
headerBackground: () =>
|
||||
Platform.OS === 'ios' ? (
|
||||
<BlurView
|
||||
style={{ flex: 1 }}
|
||||
@@ -241,13 +237,7 @@ const StackWithTranslucentHeader = createStackNavigator(
|
||||
borderBottomWidth: StyleSheet.hairlineWidth,
|
||||
},
|
||||
headerTransparent: true,
|
||||
}),
|
||||
headerTransitionPreset: 'uikit',
|
||||
// You can leave this out if you don't want the card shadow to
|
||||
// be visible through the header
|
||||
transitionConfig: () => ({
|
||||
headerBackgroundInterpolator:
|
||||
HeaderStyleInterpolator.forBackgroundWithTranslation,
|
||||
headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
|
||||
}),
|
||||
}
|
||||
);
|
||||
|
||||
@@ -51,6 +51,7 @@ class MyNavScreen extends React.Component<Props> {
|
||||
<Button onPress={() => navigation.goBack(null)} title="Go back" />
|
||||
|
||||
{TEXT.split('\n').map((p, n) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<Text key={n} style={{ marginVertical: 10, marginHorizontal: 8 }}>
|
||||
{p}
|
||||
</Text>
|
||||
|
||||
@@ -147,7 +147,7 @@ const StackNavigator = createStackNavigator(
|
||||
Root: {
|
||||
screen: TabNavigator,
|
||||
navigationOptions: {
|
||||
header: null,
|
||||
headerShown: false,
|
||||
},
|
||||
},
|
||||
NotifSettings: {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -35,24 +35,24 @@
|
||||
"@react-navigation/native": "^3.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/config-conventional": "^8.0.0",
|
||||
"@commitlint/config-conventional": "^8.3.4",
|
||||
"@release-it/conventional-changelog": "^1.1.0",
|
||||
"@types/jest": "^24.0.18",
|
||||
"@types/react": "^16.9.2",
|
||||
"@types/react-native": "^0.60.9",
|
||||
"codecov": "^3.5.0",
|
||||
"commitlint": "^8.0.0",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-config-satya164": "^2.4.1",
|
||||
"@types/jest": "^24.0.25",
|
||||
"@types/react": "^16.9.17",
|
||||
"@types/react-native": "^0.60.27",
|
||||
"codecov": "^3.6.1",
|
||||
"commitlint": "^8.3.4",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-satya164": "^3.1.5",
|
||||
"eslint-plugin-react-native-globals": "^0.1.0",
|
||||
"husky": "^3.0.0",
|
||||
"husky": "^3.1.0",
|
||||
"jest": "^24.9.0",
|
||||
"prettier": "^1.18.2",
|
||||
"prettier": "^1.19.1",
|
||||
"react": "16.8.3",
|
||||
"react-native": "~0.59.8",
|
||||
"react-test-renderer": "16.8.3",
|
||||
"release-it": "^12.3.6",
|
||||
"typescript": "^3.6.2"
|
||||
"release-it": "^12.4.3",
|
||||
"typescript": "^3.7.4"
|
||||
},
|
||||
"jest": {
|
||||
"notify": true,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
module.exports = {
|
||||
trailingComma: 'es5',
|
||||
singleQuote: true,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user