Created
June 18, 2016 13:50
-
-
Save gHashTag/5488cb07e83ff1d2790f14b5bdd82cb9 to your computer and use it in GitHub Desktop.
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, { Component } from 'react'; | |
import { | |
AppRegistry, | |
StyleSheet, | |
Text, | |
View | |
} from 'react-native'; | |
import Collapsible from 'react-native-collapsible'; | |
import Accordion from 'react-native-collapsible/Accordion'; | |
const SECTIONS = [ | |
{ | |
title: 'First', | |
content: 'Lorem ipsum...', | |
}, | |
{ | |
title: 'Second', | |
content: 'Lorem ipsum...', | |
} | |
]; | |
class AccordionView extends Component { | |
_renderHeader(section) { | |
return ( | |
<View style={styles.header}> | |
<Text style={styles.headerText}>{section.title}</Text> | |
</View> | |
); | |
} | |
_renderContent(section) { | |
return ( | |
<View style={styles.content}> | |
<Text>{section.content}</Text> | |
</View> | |
); | |
} | |
render { | |
return ( | |
<Accordion | |
sections={SECTIONS} | |
renderHeader={this._renderHeader} | |
renderContent={this._renderContent} | |
/> | |
); | |
} | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
backgroundColor: '#F5FCFF', | |
}, | |
welcome: { | |
fontSize: 20, | |
textAlign: 'center', | |
margin: 10, | |
}, | |
instructions: { | |
textAlign: 'center', | |
color: '#333333', | |
marginBottom: 5, | |
}, | |
}); | |
AppRegistry.registerComponent('AccordionView', () => AccordionView); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment