mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-24 20:45:28 +08:00
fix: add peer dep on react-navigation
This commit is contained in:
@@ -32,19 +32,21 @@ jobs:
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths: .
|
||||
lint:
|
||||
lint-and-typecheck:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run: |
|
||||
yarn run lint
|
||||
yarn lint
|
||||
yarn typescript
|
||||
unit-tests:
|
||||
<<: *defaults
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/project
|
||||
- run: yarn test --coverage
|
||||
- run: |
|
||||
yarn test --coverage
|
||||
- store_artifacts:
|
||||
path: coverage
|
||||
destination: coverage
|
||||
@@ -60,7 +62,7 @@ workflows:
|
||||
build-and-test:
|
||||
jobs:
|
||||
- install-dependencies
|
||||
- lint:
|
||||
- lint-and-typecheck:
|
||||
requires:
|
||||
- install-dependencies
|
||||
- unit-tests:
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"react": {
|
||||
"version": "detect"
|
||||
},
|
||||
"import/core-modules": ["react-native-screens"]
|
||||
},
|
||||
|
||||
"env": {
|
||||
@@ -15,7 +16,7 @@
|
||||
},
|
||||
|
||||
"rules": {
|
||||
"import/no-unresolved": "off",
|
||||
"import/named": "off",
|
||||
"react/sort-comp": "off",
|
||||
"jest/no-disabled-tests": "off",
|
||||
}
|
||||
|
||||
1
packages/stack/.gitignore
vendored
1
packages/stack/.gitignore
vendored
@@ -50,6 +50,7 @@ android/keystores/debug.keystore
|
||||
|
||||
# Build
|
||||
dist/
|
||||
generated/
|
||||
|
||||
# generated by bob
|
||||
lib/
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Asset } from 'expo-asset';
|
||||
import { FlatList, I18nManager } from 'react-native';
|
||||
import {
|
||||
createAppContainer,
|
||||
SafeAreaView,
|
||||
ScrollView,
|
||||
} from '@react-navigation/native';
|
||||
import { createAppContainer, SafeAreaView, ScrollView } from 'react-navigation';
|
||||
import {
|
||||
Assets as StackAssets,
|
||||
createStackNavigator,
|
||||
@@ -31,6 +27,7 @@ import {
|
||||
} from './src/HeaderBackgrounds';
|
||||
|
||||
// Comment the following two lines to stop using react-native-screens
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import { useScreens } from 'react-native-screens';
|
||||
|
||||
useScreens(true);
|
||||
|
||||
@@ -29,6 +29,7 @@ module.exports = {
|
||||
providesModuleNodeModules: [
|
||||
'@expo/vector-icons',
|
||||
'@babel/runtime',
|
||||
'react-navigation',
|
||||
...projectDependencies,
|
||||
],
|
||||
},
|
||||
|
||||
@@ -3,14 +3,13 @@
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "react-native start",
|
||||
"start": "expo start",
|
||||
"native": "react-native start",
|
||||
"android": "react-native run-android",
|
||||
"ios": "react-native run-ios"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-native-community/masked-view": "^0.1.1",
|
||||
"@react-navigation/core": "3.4.2",
|
||||
"@react-navigation/native": "^3.4.1",
|
||||
"expo": "^34.0.0",
|
||||
"expo-asset": "^6.0.0",
|
||||
"expo-barcode-scanner": "~6.0.0",
|
||||
@@ -26,11 +25,13 @@
|
||||
"react-native-unimodules": "~0.5.2",
|
||||
"react-native-web": "^0.11.4",
|
||||
"react-native-webview": "~5.12.0",
|
||||
"react-navigation": "^4.0.1",
|
||||
"react-navigation-drawer": "^2.0.0",
|
||||
"react-navigation-tabs": "2.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-module-resolver": "^3.2.0"
|
||||
"babel-plugin-module-resolver": "^3.2.0",
|
||||
"expo-cli": "^3.0.10"
|
||||
},
|
||||
"resolutions": {
|
||||
"react-native-safe-area-view": "0.14.6",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Button, StatusBar } from 'react-native';
|
||||
import { SafeAreaView } from '@react-navigation/native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
TransitionPresets,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
import { createAppContainer } from '@react-navigation/native';
|
||||
import { createAppContainer } from 'react-navigation';
|
||||
|
||||
class ScreenOne extends React.Component {
|
||||
componentDidMount() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { Button, Text, View, StyleSheet } from 'react-native';
|
||||
import { BarCodeScanner } from 'expo-barcode-scanner';
|
||||
import { withNavigationFocus } from '@react-navigation/core';
|
||||
import { withNavigationFocus } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
|
||||
const IndexScreen = ({ navigation }) => (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Dimensions, Button, View, Text } from 'react-native';
|
||||
import { withNavigation } from '@react-navigation/core';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import {
|
||||
createStackNavigator,
|
||||
TransitionPresets,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Dimensions, Button, View, Text } from 'react-native';
|
||||
import { withNavigation } from '@react-navigation/core';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
|
||||
const Buttons = withNavigation(props => (
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
StyleSheet,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import { createSwitchNavigator } from '@react-navigation/core';
|
||||
import { createSwitchNavigator } from 'react-navigation';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
|
||||
class SignInScreen extends React.Component<any, any> {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -50,8 +50,6 @@
|
||||
"@expo/vector-icons": "^10.0.3",
|
||||
"@react-native-community/bob": "^0.6.1",
|
||||
"@react-native-community/masked-view": "^0.1.1",
|
||||
"@react-navigation/core": "^3.4.2",
|
||||
"@react-navigation/native": "^3.5.0",
|
||||
"@release-it/conventional-changelog": "^1.1.0",
|
||||
"@types/jest": "^24.0.15",
|
||||
"@types/react": "^16.8.14",
|
||||
@@ -66,6 +64,7 @@
|
||||
"prettier": "^1.18.2",
|
||||
"react": "16.8.3",
|
||||
"react-dom": "16.8.3",
|
||||
"react-navigation": "^4.0.1",
|
||||
"react-native": "~0.59.8",
|
||||
"react-native-gesture-handler": "^1.3.0",
|
||||
"react-native-reanimated": "^1.1.0",
|
||||
@@ -77,9 +76,9 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-native-community/masked-view": "^0.1.1",
|
||||
"@react-navigation/core": "^3.0.0",
|
||||
"react": "*",
|
||||
"react-native": "*",
|
||||
"react-navigation": "^4.0.1",
|
||||
"react-native-gesture-handler": "^1.0.0",
|
||||
"react-native-reanimated": "^1.3.0-alpha",
|
||||
"react-native-screens": "^1.0.0 || ^1.0.0-alpha"
|
||||
@@ -98,7 +97,7 @@
|
||||
"<rootDir>/lib/"
|
||||
],
|
||||
"transformIgnorePatterns": [
|
||||
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|react-navigation-deprecated-tab-navigator|@react-navigation/core|@react-navigation/native)"
|
||||
"node_modules/(?!(jest-)?react-native|react-clone-referenced-element|react-navigation|@react-navigation/core|@react-navigation/native)"
|
||||
],
|
||||
"testRegex": "/__tests__/.*\\.(test|spec)\\.(js|tsx?)$",
|
||||
"transform": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { createAppContainer } from '@react-navigation/native';
|
||||
import { createAppContainer } from 'react-navigation';
|
||||
import StackNavigator from '../createStackNavigator';
|
||||
|
||||
const SubNavigator = StackNavigator({
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { Component } from 'react';
|
||||
import { StyleSheet, View } from 'react-native';
|
||||
import renderer from 'react-test-renderer';
|
||||
import { withNavigation } from '@react-navigation/core';
|
||||
import { withNavigation } from 'react-navigation';
|
||||
|
||||
import createStackNavigator from '../createStackNavigator';
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import createAppContainer, {
|
||||
_TESTING_ONLY_reset_container_count,
|
||||
// @ts-ignore
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { StackRouter, createNavigator } from '@react-navigation/core';
|
||||
import { StackRouter, createNavigator } from 'react-navigation';
|
||||
import { Platform } from 'react-native';
|
||||
import StackView from '../views/Stack/StackView';
|
||||
import {
|
||||
|
||||
@@ -40,7 +40,7 @@ export type NavigationProp<RouteName = string, Params = object> = {
|
||||
state: NavigationState;
|
||||
setParams(params: Params): void;
|
||||
getParam(): Params;
|
||||
dispatch(action: { type: string }): void;
|
||||
dispatch(action: { type: string }): boolean;
|
||||
isFirstRouteInParent(): boolean;
|
||||
dangerouslyGetParent(): NavigationProp | undefined;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from 'react';
|
||||
import { StackActions } from '@react-navigation/core';
|
||||
import { StackActions } from 'react-navigation';
|
||||
import HeaderSegment from './HeaderSegment';
|
||||
import { HeaderProps, HeaderTitleProps } from '../../types';
|
||||
import HeaderTitle from './HeaderTitle';
|
||||
@@ -54,6 +54,7 @@ export default class Header extends React.PureComponent<HeaderProps> {
|
||||
onGoBack={
|
||||
previous
|
||||
? () =>
|
||||
// @ts-ignore
|
||||
navigation.dispatch(StackActions.pop({ key: scene.route.key }))
|
||||
: undefined
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import { Platform } from 'react-native';
|
||||
import { SceneView, StackActions } from '@react-navigation/core';
|
||||
import { SceneView, StackActions } from 'react-navigation';
|
||||
import Stack from './Stack';
|
||||
import HeaderContainer, {
|
||||
Props as HeaderContainerProps,
|
||||
@@ -239,6 +239,7 @@ class StackView extends React.Component<Props, State> {
|
||||
private handleGoBack = ({ route }: { route: Route }) => {
|
||||
// This event will trigger when a gesture ends
|
||||
// We need to perform the transition before removing the route completely
|
||||
// @ts-ignore
|
||||
this.props.navigation.dispatch(StackActions.pop({ key: route.key }));
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
declare module '@react-navigation/core' {
|
||||
declare module 'react-navigation' {
|
||||
import * as React from 'react';
|
||||
|
||||
export const StackActions: {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
declare module '@react-navigation/native' {
|
||||
declare module 'react-navigation' {
|
||||
import { ComponentType } from 'react';
|
||||
import { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
||||
|
||||
|
||||
@@ -1155,20 +1155,20 @@
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/masked-view/-/masked-view-0.1.1.tgz#dbcfc5ec08efbb02d4142dd9426c8d7a396829d7"
|
||||
integrity sha512-EyJVSbarZkOPYq+zCZLx9apMcpwkX9HvH6R+6CeVL29q88kEFemnLO/IhmE4YX/0MfalsduI8eTi7fuQh/5VeA==
|
||||
|
||||
"@react-navigation/core@^3.4.2":
|
||||
version "3.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-3.4.2.tgz#bec563e94fde40fbab3730cdc97f22afbb2a1498"
|
||||
integrity sha512-7G+iDzLSTeOUU4vVZeRZKJ+Bd7ds7ZxYNqZcB8i0KlBeQEQfR74Ounfu/p0KIEq2RiNnaE3QT7WVP3C87sebzw==
|
||||
"@react-navigation/core@^3.5.0":
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/core/-/core-3.5.0.tgz#73d1a12448e2bd71855e0080b95a7f51ede0cd9e"
|
||||
integrity sha512-NLm24lA51R8o8c+iFnwtN9elqRzm4OJ8f1qPBCUNIYW1sb8M5yCD53vRP0fRcPFpr/6Xzs2TJMsWnnebwFp0Rw==
|
||||
dependencies:
|
||||
hoist-non-react-statics "^3.3.0"
|
||||
path-to-regexp "^1.7.0"
|
||||
query-string "^6.4.2"
|
||||
react-is "^16.8.6"
|
||||
|
||||
"@react-navigation/native@^3.5.0":
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-3.5.0.tgz#f5d16e0845ac26d1147d1caa481f18a00740e7ae"
|
||||
integrity sha512-TmGOis++ejEXG3sqNJhCSKqB0/qLu3FQgDtO959qpqif36R/diR8SQwJqeSdofoEiK3CepdhFlTCeHdS1/+MsQ==
|
||||
"@react-navigation/native@^3.6.2":
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/@react-navigation/native/-/native-3.6.2.tgz#3634697b6350cc5189657ae4551f2d52b57fbbf0"
|
||||
integrity sha512-Cybeou6N82ZeRmgnGlu+wzlV3z5BZQR2dmYaNFV1TNLUGHqtvv8E7oNw9uYcz9Ox5LFbiX+FdNTn2d6ZPlK0kg==
|
||||
dependencies:
|
||||
hoist-non-react-statics "^3.0.1"
|
||||
react-native-safe-area-view "^0.14.1"
|
||||
@@ -7333,6 +7333,14 @@ react-native@~0.59.8:
|
||||
xmldoc "^0.4.0"
|
||||
yargs "^9.0.0"
|
||||
|
||||
react-navigation@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/react-navigation/-/react-navigation-4.0.1.tgz#96c17ac90afcf0a5bc957358152326211a79d183"
|
||||
integrity sha512-6XzuqvhOnY6FA6tCErD6+vfZdnP+O/7hCQper9qDulxxW2ZVkCF4xWdzoVcv3DDR6P5CK6l1tcbJ1ku256AdFQ==
|
||||
dependencies:
|
||||
"@react-navigation/core" "^3.5.0"
|
||||
"@react-navigation/native" "^3.6.2"
|
||||
|
||||
react-proxy@^1.1.7:
|
||||
version "1.1.8"
|
||||
resolved "https://registry.yarnpkg.com/react-proxy/-/react-proxy-1.1.8.tgz#9dbfd9d927528c3aa9f444e4558c37830ab8c26a"
|
||||
|
||||
Reference in New Issue
Block a user