Commit c06b7f95 authored by Wahyu Adjie Prasetyo's avatar Wahyu Adjie Prasetyo
parents 2de43f0a b7ef3356
......@@ -181,7 +181,7 @@ class MenuSelection extends React.Component {
renderTabBar = ({ item }) => {
return (
<View style={{ flex: 1, height: 270 }}>
<TouchableOpacity>
<TouchableOpacity onPress={() => this.scrollToIndex(item)}>
<Image style={{ height: 60, width: 60, top: 5 }} source={{ uri: item.image }} />
</TouchableOpacity>
</View>
......@@ -277,6 +277,13 @@ class MenuSelection extends React.Component {
}
}
scrollToIndex = (item) => {
index = _.findIndex(this.props.menu_item, ['name', item.name])
if (index > -1) {
this.flatListRef.scrollToIndex({animated: true, index: index});
}
}
render() {
return (
<View style={styles.container}>
......@@ -304,6 +311,7 @@ class MenuSelection extends React.Component {
/>
)}
keyExtractor={item => item.id}
ref={(ref) => { this.flatListRef = ref; }}
/>
)}
</View>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment