0.1.0 • Published 9 years ago

react-native-fs-modal v0.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
9 years ago

react-native-fs-modal

React native full screen modal component.

Demo

React Native Modal Component GIF

Usage

NOTE: If you are using the native status bar you will need to combine this plugin with the react-native-overlay plugin

Using ref
/**
 * Two methods show/hide
 */

showModal () {
  this.refs.modal.show();
}

hideModal () {
  this.refs.modal.close();
}

...

<Modal
  // Use ref to allow open/close
  ref={'modal'}

  // Duration of animation (defaults 500)
  duration={1000}

  // Any tween function (defaults 'easeOutBack')
  tween={'easeOutElastic'}

  // Pass styles to modal
  modalStyle={{borderRadius: 0}}

  // Hide/show UIStatusBar (defaults to true)
  hideStatusBar={true}
  >

  // Your modal's content
  <View style={theme.padder}>
    <Button
      onPress={this.hideModal.bind(this)}
      text={'Close modal'}/>
  </View>
</Modal>
Using a child component
<Modal>

  /**
   * The hide func will be added to SomeComponent's props.
   * This will allow you to add close buttons from within
   * the modal's view.
   */

  <SomeComponent />
</Modal>