Skip to content

Instantly share code, notes, and snippets.

@aymericbouzy
Last active March 31, 2016 20:35
Show Gist options
  • Save aymericbouzy/c3267931565dfba5ab86628e8c2c1475 to your computer and use it in GitHub Desktop.
Save aymericbouzy/c3267931565dfba5ab86628e8c2c1475 to your computer and use it in GitHub Desktop.
react-native-router-flux android bug report
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