0.1.2 • Published 7 years ago

react-native-collapsable-view v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

react-native-collapsable-view

a expandable and collapsable view that can be controlled with a handler
npm.io

Install

npm install react-native-collapsable-view --save

Usage

render() {
    return (
      <ScrollView style={styles.container}>
        <Panel title='A Panel with short content text'>
          <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</Text>
        </Panel>
        <Panel title='A Panel with long content text'>
          <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</Text>
        </Panel>
        <Panel title='Another Panel'>
          <Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident.</Text>
        </Panel>
        <Panel title='Another Panel'>
          <Image source={require('./Funny.png')} style={{height: 200, width: null, resizeMode: 'contain'}}/>
        </Panel>
      </ScrollView>
    );
  }

Like this, you can fill everything you like in the Panel and you'd better use ScrollView as the parent view because you don't know how large the children will be.

Props

NameDescriptionDefaultType
expandedthe initial state of paneltrueboolean
titletitle on the handlerstringundefined

License

MIT