-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.android.js
More file actions
56 lines (48 loc) · 1.64 KB
/
index.android.js
File metadata and controls
56 lines (48 loc) · 1.64 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
import { Provider, connect } from 'react-redux';
import { createStore } from 'redux';
import { Actions, ActionConst, Router, Scene } from 'react-native-router-flux';
import { appReducer } from './app/reducers';
import Lists from './app/components/lists';
import GroceryList from './app/components/groceryList';
import TodoList from './app/components/todoList';
class TabIcon extends React.Component {
render() {
const color = `#${Math.floor(Math.random()* 10)}${Math.floor(Math.random() * 10)}${Math.floor(Math.random() * 10)}`
return (
<View style={{backgroundColor: color, width: '100%', height: '100%', justifyContent: 'center'}}>
<Text style={{color: this.props.selected ? 'pink' :'white', textAlign: 'center', fontSize :20}}>{this.props.title}</Text>
</View>
);
}
}
const Scenes = Actions.create(
<Scene key='root' tabs={true} hideNavBar>
<Scene key='tab1' title='Add' hideNavBar component={Lists} icon={TabIcon} />
<Scene key='tab2' title='Grocery' component={GroceryList} icon={TabIcon}/>
<Scene key='tab3' title='To Do' component={TodoList} icon={TabIcon}/>
</Scene>
);
const ConnectedRouter = connect()(Router);
const store = createStore(appReducer);
export default class ExampleTabs extends Component {
render() {
return (
<Provider store={store}>
<ConnectedRouter scenes={Scenes} />
</Provider>
);
}
}
AppRegistry.registerComponent('ExampleTabs', () => ExampleTabs);