mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-03-27 01:34:25 +08:00
Update example to SDK32
This commit is contained in:
@@ -1,12 +1,5 @@
|
||||
{
|
||||
"presets": [
|
||||
"expo"
|
||||
],
|
||||
"plugins": [
|
||||
["module-resolver", {
|
||||
"alias": {
|
||||
"react-navigation-stack": "../src"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import Expo from 'expo';
|
||||
import { Asset } from 'expo';
|
||||
import { FlatList, I18nManager } from 'react-native';
|
||||
import {
|
||||
createAppContainer,
|
||||
@@ -10,8 +10,9 @@ import {
|
||||
Assets as StackAssets,
|
||||
createStackNavigator,
|
||||
} from 'react-navigation-stack';
|
||||
import { ListSection, Divider } from 'react-native-paper';
|
||||
import { List, Divider } from 'react-native-paper';
|
||||
|
||||
import FullScreen from './src/FullScreen';
|
||||
import SimpleStack from './src/SimpleStack';
|
||||
import ImageStack from './src/ImageStack';
|
||||
import TransparentStack from './src/TransparentStack';
|
||||
@@ -39,6 +40,7 @@ const data = [
|
||||
{ component: HeaderPreset, title: 'UIKit Preset', routeName: 'UIKit' },
|
||||
{ component: ImageStack, title: 'Image', routeName: 'ImageStack' },
|
||||
{ component: ModalStack, title: 'Modal', routeName: 'ModalStack' },
|
||||
{ component: FullScreen, title: 'Full Screen', routeName: 'FullScreen' },
|
||||
{
|
||||
component: LifecycleInteraction,
|
||||
title: 'Lifecycle',
|
||||
@@ -82,7 +84,7 @@ const data = [
|
||||
];
|
||||
|
||||
// Cache images
|
||||
Expo.Asset.loadAsync(StackAssets);
|
||||
Asset.loadAsync(StackAssets);
|
||||
|
||||
class Home extends React.Component {
|
||||
static navigationOptions = {
|
||||
@@ -90,7 +92,7 @@ class Home extends React.Component {
|
||||
};
|
||||
|
||||
_renderItem = ({ item }) => (
|
||||
<ListSection.Item
|
||||
<List.Item
|
||||
title={item.title}
|
||||
onPress={() => this.props.navigation.navigate(item.routeName)}
|
||||
/>
|
||||
@@ -143,9 +145,8 @@ const Root = createStackNavigator(
|
||||
}
|
||||
);
|
||||
|
||||
const App = createAppContainer(Root);
|
||||
Expo.registerRootComponent(App);
|
||||
useScreens();
|
||||
export default createAppContainer(Root);
|
||||
|
||||
// Uncomment this to test immediate transitions
|
||||
// import ImmediateTransition from './src/ImmediateTransition';
|
||||
|
||||
@@ -3,15 +3,8 @@
|
||||
"name": "React Navigation Stack Example",
|
||||
"description": "Demonstrates the various capabilities of react-navigation-stack",
|
||||
"slug": "react-navigation-stack-demo",
|
||||
"sdkVersion": "30.0.0",
|
||||
"sdkVersion": "32.0.0",
|
||||
"version": "1.0.0",
|
||||
"primaryColor": "#2196f3",
|
||||
"packagerOpts": {
|
||||
"assetExts": [
|
||||
"ttf"
|
||||
],
|
||||
"config": "./rn-cli.config.js",
|
||||
"projectRoots": ""
|
||||
}
|
||||
"primaryColor": "#2196f3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,35 +2,28 @@
|
||||
"name": "stackexample",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"main": "node_modules/expo/AppEntry.js",
|
||||
"scripts": {
|
||||
"start": "expo start",
|
||||
"android": "expo start --android",
|
||||
"ios": "expo start --ios",
|
||||
"postinstall": "rm -rf node_modules/expo-react-native-adapter/node_modules/react && rm -rf node_modules/expo-gl/node_modules/react"
|
||||
"postinstall": "rm -rf node_modules/react-navigation-stack/{.git,node_modules,example}"
|
||||
},
|
||||
"dependencies": {
|
||||
"@react-navigation/core": "^3.0.0-alpha",
|
||||
"@react-navigation/native": "^3.0.0-alpha",
|
||||
"expo": "~30.0.0",
|
||||
"react": "16.5.0",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
|
||||
"react-native-paper": "^2.2.0",
|
||||
"react-navigation-stack": "../",
|
||||
"react-navigation-drawer": "^1.1.0",
|
||||
"react-navigation-tabs": "*",
|
||||
"@react-navigation/core": "^3.0.0",
|
||||
"@react-navigation/native": "^3.1.1",
|
||||
"expo": "32.0.0",
|
||||
"hoist-non-react-statics": "^2.5.0",
|
||||
"prop-types": "^15.6.0",
|
||||
"react": "16.3.1",
|
||||
"react-native": "~0.55.4",
|
||||
"react-native-paper": "2.0.0-alpha.4",
|
||||
"react-native-screens": "^1.0.0-alpha.9",
|
||||
"react-navigation-drawer": "^1.0.0-alpha",
|
||||
"react-navigation-tabs": "^1.0.0-alpha"
|
||||
"prop-types": "^15.6.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-plugin-module-resolver": "^3.0.0",
|
||||
"babel-preset-expo": "^4.0.0",
|
||||
"glob-to-regexp": "^0.3.0"
|
||||
},
|
||||
"main": "App.js",
|
||||
"resolutions": {
|
||||
"**/react": "16.3.1",
|
||||
"**/prop-types": "15.6.0",
|
||||
"**/react-lifecycles-compat": "3.0.4",
|
||||
"**/hoist-non-react-statics": "2.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
const path = require('path');
|
||||
const glob = require('glob-to-regexp');
|
||||
const blacklist = require('metro/src/blacklist');
|
||||
const pak = require('../package.json');
|
||||
const pak2 = require('./package.json');
|
||||
|
||||
const dependencies = Object.keys(pak.dependencies || {});
|
||||
const localDependencies = Object.keys(pak2.dependencies);
|
||||
const peerDependencies = Object.keys(pak.peerDependencies);
|
||||
|
||||
module.exports = {
|
||||
getProjectRoots() {
|
||||
return [__dirname, path.resolve(__dirname, '..')];
|
||||
},
|
||||
getProvidesModuleNodeModules() {
|
||||
return [...dependencies, ...localDependencies, ...peerDependencies];
|
||||
},
|
||||
getBlacklistRE() {
|
||||
return blacklist([glob(`${path.resolve(__dirname, '..')}/node_modules/*`)]);
|
||||
},
|
||||
};
|
||||
17
packages/stack/example/src/FullScreen.js
Normal file
17
packages/stack/example/src/FullScreen.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import { createStackNavigator } from 'react-navigation-stack';
|
||||
|
||||
class Screen extends React.Component {
|
||||
static navigationOptions = {
|
||||
header: null,
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View style={{ flex: 1, backgroundColor: 'red' }} />
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default createStackNavigator({ Screen });
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,7 @@
|
||||
"lint": "eslint .",
|
||||
"format": "eslint . --fix",
|
||||
"build": "babel --no-babelrc --plugins=syntax-jsx,syntax-class-properties,syntax-object-rest-spread,transform-flow-strip-types src --copy-files --out-dir dist --ignore '**/__tests__/**'",
|
||||
"dev": "yarn build --watch --out-dir example/node_modules/react-navigation-stack/dist",
|
||||
"prepare": "yarn build",
|
||||
"release": "release-it"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user