Last active
March 31, 2016 20:35
-
-
Save aymericbouzy/c3267931565dfba5ab86628e8c2c1475 to your computer and use it in GitHub Desktop.
react-native-router-flux android bug report
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { | |
ListView, | |
Text, | |
TouchableWithoutFeedback, | |
View, | |
} from 'react-native' | |
import {Actions, Scene, Router} from 'react-native-router-flux' | |
let App = React.createClass({ | |
render: function() { | |
return ( | |
<Router> | |
<Scene key="root"> | |
<Scene key="list" component={List} initial={true} /> | |
<Scene key="detail" component={Detail} /> | |
</Scene> | |
</Router> | |
) | |
} | |
}) | |
let List = React.createClass({ | |
render: function() { | |
let items = ['foo', 'bar'].map((item) => <Item item={item} key={item} /> ) | |
return ( | |
<View style={{flex: 1, justifyContent: 'center'}}> | |
{items} | |
</View> | |
) | |
}, | |
}) | |
let Item = React.createClass({ | |
render: function() { | |
let item = this.props.item | |
return ( | |
<TouchableWithoutFeedback onPress={() => Actions.detail({item})}> | |
<Text>{item}</Text> | |
</TouchableWithoutFeedback> | |
) | |
} | |
}) | |
let Detail = React.createClass({ | |
render: function() { | |
return ( | |
<View style={{flex: 1, justifyContent: 'center'}}> | |
<Text>{this.props.item}</Text> | |
</View> | |
) | |
} | |
}) | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment