Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-root-modal

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-root-modal

react native modal component

  • 5.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
655
increased by62.94%
Maintainers
2
Weekly downloads
 
Created
Source

react-native-root-modal npm version


Features

  1. Pure javascript solution, easy to install.
  2. Support both React element way and javascript class way to invoke, easy to use.
  3. Inherited from <View /> you can set your own style or animation or anything you can do with View.
  4. redux support.

Breaking changes

5.x

From 5.x redux support is not enabled by default. The redux support can be enabled by setting a redux context wrapper.

import { setSiblingWrapper } from 'react-native-root-siblings';
import { Provider } from 'react-redux';

// const store = ... get store;

// Call this before using redux context inside RootSiblings.
setSiblingWrapper((sibling) => <Provider store={store}>{sibling}</Provider>);

Install

npm install react-native-root-modal

Usage

Import library any where inside your code before AppRegistry.registerComponent is called.

import Modal, { AnimatedModal, ModalManager } from 'react-native-root-modal';

Invoked by React element way.

....other elements before
<Modal
    style={{
        top: 0,
        right: 0,
        bottom: 0,
        left: 0,
        backgroundColor: 'rgba(0, 0, 0, 0.2)',
        transform: [{scale: this.state.scaleAnimation}]
    }}

    visible={this.state.modalVisible}
>
    ... You can add anything inside
</Modal>
....other elements after

Just put <Modal /> element anywhere, And it will be front of other elements. And you can set <Modal /> element`s style or other properties inherited from <View /> element

Or you can invoke it by JavaScript class way

Import modal Manager class.

import { ModalManager } from 'react-native-root-modal';

Invoke it.

// Create a Modal element on screen.
let modal = new ModalManager(<View style={modal container style}>
    ...modal contents here.
</View>);

// Update (replace) the modal element which is already existed.
modal.update(<View style={modal container style}>
    ...other modal contents here.
</View>);

// Destroy it
modal.destroy();

Example

IOS


Example

Android


Example

Notice

Modal element created by this library can`t cover other native Modal elements,like: Official Modal Element

Keywords

FAQs

Package last updated on 03 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc