Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A pure JavaScript solution for react native`s modal component

License

NotificationsYou must be signed in to change notification settings

magicismight/react-native-root-modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Features

  1. Pure javascript solution, easy to install.
  2. Support bothReact element way andjavascript 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 beforeAppRegistry.registerComponent is called.

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

Invoked byReact 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 byJavaScript 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 itmodal.destroy();

Example

IOS


Example

Android


Example

Notice

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

About

A pure JavaScript solution for react native`s modal component

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp