Skip to content

231907786/react-native-actionsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

react-native-actionsheet

pure JavaScript ActionSheet in React Native

if you need new features or find any bugs in using, contact me by issue plz.

example

state = {
  visible: false,
  chosen: 1,
}

// no z-index in react-native, so remember put this at the end of container because of modal
render() {
  <View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
    <Text onPress={() => this.setState({visible: true})} style={{fontSize: 25}}>Open</Text>
    <ActionSheet
      options={['foo', 'bar', 'baz']}
      visible={this.state.visible}
      modalWillClose={chosen => this.setState({chosen, visible: false})}
      chosen={this.state.chosen}
      disable={[3]}
      bottom
    />
  </View>
} 

props

propName type desc isRequired
options array of strings text of each option
visible boolean if true, activate this component
modalWillClose Closure in this callback, parent component should setState({visible: false}) and do other you want
chosen number the index of active option, begin with 1 optional
disable array of numbers the indexes of disable options optional
bottom boolean if true, it will slide in from bottom. in default it's top optional

About

pure JavaScript ActionSheet in React Native

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published