Giter Club home page Giter Club logo

react-native-modalbox's Introduction

react-native-modalbox

A react native component, easy, fully customizable, implementing the 'swipe down to close' feature. Using the new react native Animated library.

Preview

Getting started

  1. npm install react-native-modalbox@latest --save
  2. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  3. Go to node_modulesreact-native-modalbox and add RNModalbox.xcodeproj
  4. In XCode, in the project navigator, select your project. Add libRNModalbox.a to your project's Build PhasesLink Binary With Libraries
  5. Click RNModalbox.xcodeproj in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for Header Search Paths and make sure it contains both $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React - mark both as recursive.
  6. Run your project (Cmd+R)

Example

Check index.ios.js in the Example folder.

Properties

Prop Default Type Description
isOpen false bool Open/close the modal, optional, you can use the open/close methods instead
swipeToClose true bool Set to true to enable the swipe down to close feature
swipeThreshold 50 number The threshold to reach in pixels to close the modal
aboveStatusBar true bool If true the modal will appear above the status bar
position center string Control the modal position using top or center or bottom
backdrop true bool Display a backdrop behind the modal
backdropOpacity 0.5 bool Opacity of the backdrop
backdropColor black bool backgroundColor of the backdrop
backdropContent null ReactElement Add an element in the backdrop (a close button for example)

Events

Prop Params Description
onClosed - When the modal is close and the animation is done
onOpened - When the modal is open and the animation is done
onClosingState state bool When the state of the swipe to close feature has changed (usefull to change the content of the modal, display a message for example)

Methods

These methods are optional, you can use the isOpen property instead

Prop Params Description
open - Open the modal
close - Close the modal

react-native-modalbox's People

Contributors

maxs15 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.