chore: add react-navigation-fluid-transitions

This commit is contained in:
Kyle Fang
2019-05-12 10:12:11 +08:00
parent 5404b766a4
commit adfcc78bd0
8 changed files with 217 additions and 34 deletions

47
App.js
View File

@@ -7,27 +7,23 @@
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import {Button, Platform, StyleSheet, Text, View} from 'react-native';
import {createAppContainer, createStackNavigator} from 'react-navigation';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
const PageA = ({navigation}) => (
<View style={{flex: 1}}>
<Button onPress={() => navigation.push('PageB')} title="Push"/>
</View>
);
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
const PageB = () => (
<View style={styles.container}>
<Button onPress={() => alert("TEST")} title="TEST"/>
<View style={StyleSheet.absoluteFill}>
<View style={{flex: 1}}/>
</View>
);
}
}
</View>
);
const styles = StyleSheet.create({
container: {
@@ -36,14 +32,9 @@ const styles = StyleSheet.create({
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
export default createAppContainer(createStackNavigator({
PageA,
PageB
}));