Created
September 23, 2017 15:34
-
-
Save irisAsh/bc9255ad906a90e6847ec034f9598f96 to your computer and use it in GitHub Desktop.
React Native Elementsの使い方(No.2)
This file contains 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, { Component } from 'react' | |
import { | |
ScrollView, | |
View, | |
} from 'react-native' | |
import { List, ListItem } from 'react-native-elements' | |
import { networkData, generalData } from './config/menuData' | |
export default class MenuList extends Component { | |
constructor(props) { | |
super(props) | |
} | |
render() { | |
return ( | |
<View style={{flex: 1}}> | |
<ScrollView | |
automaticallyAdjustContentInsets={false} | |
> | |
{this.renderMenuItems(generalData)} | |
{this.renderMenuItems(networkData)} | |
</ScrollView> | |
</View> | |
) | |
} | |
renderMenuItems = (menuData) => { | |
return ( | |
<List> | |
{ | |
menuData.map((item, i) => ( | |
<ListItem | |
{...item} | |
key={i} | |
onPress={!!item.navigateScreen ? () => this.props.navigation.navigate(item.navigateScreen) : null} | |
/> | |
)) | |
} | |
</List> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment