1.0.10 • Published 5 years ago

react-native-little-modal v1.0.10

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

react-native-little-modal npm version


Features

  1. Pure javascript solution, easy to install.
  2. Both android and ios platform you can use.
  3. Like the antd modal and you can create multiple modals.

Install

npm install react-native-little-modal

Usage

import Modal from 'react-native-little-modal';
Modal.open({
    animationType: "slide",
    maskClosable: true,
    contentWrapperStyle: {
      paddingBottom: 0,
    }
}, <CustomView />)
Modal.hide()

or

Modal.alert("title", "text", [
    {
        text: "confirm",
        onPress: () => {},
        style: {color: "#333"}
    },
    {
        text: "cancel"
    }
])

Available props

Modal.open(options, content)

  • options
NameTypeDefaultDescription
animationType"slide" or "fade" or "node""none"Modal show animation
maskClosableBooleanfalseClose the modal when maskClosable is true
contentWrapperStyleStyleExtra style for content wrapper
modalKeyString"react-native-little-modal"A special key for the modal and you need to hide with this key
onModalCloseFunctionCallback when the modal will be closed
backgroundColor"black" or "transparent"blackBackground color for modal
useRNModalBooleanandroid: true, ios: falsewarning: use it when you want to create top view, but on ios cannot create mutiple react native modals!
  • content - any react element

Modal.alert(title, text, btns, modalKey?: string)

NameTypeDefaultDescription
titleString or React.element""title
textString or React.element""text
btns{text: string, onPress?: () => void, style?: TextStyle}[]buttons
modalKeyString"react-native-little-modal"modal key

Modal.hide(modalKey?: string)

  • modalKey default value is "react-native-little-modal"

Modal.removeAll()

  • remove all modal elements

Warning

  • On ios platform (if you don't use "useRNModal"), modal element created by this library can`t cover other native Modal elements,like: Official Modal Element
  • When you set useRNModal = true on ios platform, DO NOT CREATE MUTIPLE MODALS ON IOS PLATFORM at the same time, or the app will crash because of a react-native bug! 🙃
1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago