Skip to content
프로젝트

magicismight/react-native-root-modal

GitHub에서 보기

소개

React Native 모달 컴포넌트를 위한 순수 JavaScript 솔루션

웹 및 앱 개발

이 수치를 측정하는 방법

What you can do

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

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
-1
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

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

관련 프로젝트 살펴보기

불러오는 중…