React native full screen modal component.
Switch branches/tags
Nothing to show
Clone or download
kirkness Merge pull request #2 from buhe/master
cross platform and add close modal when touch underlay feature
Latest commit fe64023 Dec 30, 2015
Permalink
Failed to load latest commit information.
utils fix bug Dec 30, 2015
.gitignore Initial commit May 6, 2015
README.md add read me Dec 30, 2015
index.js add close on touch props Dec 30, 2015
package.json Initial commit May 6, 2015

README.md

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}
  // close modal when touch underlay
  closeOnTouch={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>