forked from wscodelabs/react_native_ecommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.android.js
More file actions
37 lines (30 loc) · 796 Bytes
/
Copy pathindex.android.js
File metadata and controls
37 lines (30 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
View,
Navigator
} from 'react-native';
import Home from './src/components/Home'
import ProductDetails from './src/components/ProductDetails'
const routeComponents = {home:Home,productDetails:ProductDetails}
class HelloWorld1 extends Component {
render() {
return (
<Navigator
style={{ flex:1 }}
initialRoute={{ name: 'home' }}
renderScene={ this.renderScene } />
);
}
renderScene(route , navigator){
let Component = routeComponents[route.name]
console.log(Component);
return <Component navigator={navigator}/>
}
}
AppRegistry.registerComponent('HelloWorld1', () => HelloWorld1);