0.1.0 • Published 11 months ago

react-native-safe-modal v0.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

react-native-safe-modal

Safely open mutiple modals. One modal per time will be shown.

Installation

with npm

npm install react-native-safe-modal

with yarn

yarn add react-native-safe-modal

Usage

react-native-safe-modal includes <SafeModalProvider /> component, and SafeModalFactory() function.

Place <SafeModalProvider /> on top of components. Create <SafeModal /> by SafeModalFactory()

import Modal from 'react-native-modal'
import { SafeModalProvider, SafeModalFactory } from 'react-native-safe-modal'

const SafeModal = SafeModalFactory(Modal, { isVisibleKey: 'isVisible', onModalHideKey: 'onModalHide' })

const App = () => {
  return (
    <SafeModalProvider>
      <SomeComponents>
        <SafeModal isVisible />
        <SafeModal isVisible />
      </SomeComponents>
    </SafeModalProvider>
  )
}
0.1.0

11 months ago