mirror of
https://github.com/zhigang1992/examples.git
synced 2026-01-12 17:13:21 +08:00
39 lines
793 B
JavaScript
39 lines
793 B
JavaScript
import React from "react";
|
|
import { StyleSheet, Text, View, Platform } from "react-native";
|
|
import { Router, Route, Link } from "./react-router";
|
|
|
|
const Home = () => <Text>Home</Text>;
|
|
|
|
const About = () => <Text>About</Text>;
|
|
|
|
const App = () => (
|
|
<Router>
|
|
<View style={styles.container}>
|
|
<View style={styles.nav}>
|
|
<Link to="/">
|
|
<Text>Home</Text>
|
|
</Link>
|
|
<Link to="/about">
|
|
<Text>About</Text>
|
|
</Link>
|
|
</View>
|
|
|
|
<Route exact path="/" component={Home} />
|
|
<Route path="/about" component={About} />
|
|
</View>
|
|
</Router>
|
|
);
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
marginTop: 25,
|
|
padding: 10
|
|
},
|
|
nav:{
|
|
flexDirection: 'row',
|
|
justifyContent: 'space-around',
|
|
},
|
|
});
|
|
|
|
export default App;
|