1.0.1 • Published 1 year ago

rn-bottom-modal v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

rn-bottom-modal

  • Modal with bottom slide out animation
  • Customizable content components
  • Support Android and IOS

Install

$ yarn add rn-bottom-modal

or

$ npm install rn-bottom-modal --save

Import

import {BottomModal} from 'rn-bottom-modal'

Props

PropsTypeDescDefault
containerStyleStylePropSets view style of content root view.undefined
hasMaskbooleanSets whether show mask.true
touchOutsideClosebooleanSets whether touch outside the content to close this modal.true
backKeyClosebooleanSets whether close this modal with android BACK key . only Androidtrue
keyboardAvoidbooleanSets whether use KeyboardAvoidingView. only IOSfalse
onShowfunctionSets the show callback.undefined
onDismissfunctionSets the close callback.undefined

Methods

MethodsDesc
show()use ref call this function to show modal
dismiss()use ref call this function to close modal

Example

<Button 
  title="show Modal" 
  onPress={()=>{
    ref.current?.show()
  }}/>
<BottomModal
  ref={ref}
  containerStyle={{ height: 200 }}
  onShow={()=>{
    console.info("show======")
  }}
  onDismiss={() => {
    console.info("dismiss======")
  }}>
  <Text>Content</Text>
</BottomModal>

npm.io