Giter Club home page Giter Club logo

react-native-translucent-modal's Introduction

react-native-translucent-modal

A library for React Native Translucent Modal On Android

Chinese introduction: 中文文档介绍

Background

The Modal component provided by react-native does not extend to the status bar when displayed on Android. Why? This is related to the native implementation of Android. The Modal component corresponds to Android native implementation with Dialog, because the dialog itself does not extend to the status bar. How can I make Modal appear on Android like on an iOS device? This is what the library provides. It's very simple to use, just one line of code.

Effect comparison

Before using react-native-translucent-modal

splash:

before1

Pop:

before1

After using react-native-translucent-modal

splash:

after1

Pop:

after1

Setup

1、Use npm

$ npm install react-native-translucent-modal --save

Or use yarn

$ yarn add react-native-translucent-modal

2、then link

$ react-native link react-native-translucent-modal

Usage

The use of react-native-translucent-modal is exactly the same as that of the react-native providing Modal. Their properties and methods are exactly the same. You only need to change the import of Modal, the other is completely Don't change

import { Modal } from "react-native";

change to

import Modal from 'react-native-translucent-modal';

Ok, just change this line of code, your Modal can now be extended to the status bar.

On iOS devices, the Modal component provided by react native is still used., you can view the MFTranslucentModal.ios.js file for detail.

Thanks

thanks react-native-modal-translucent library for providing ideas

react-native-translucent-modal's People

Contributors

pinguo-zhouwei avatar sjsaul1101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-translucent-modal's Issues

触摸崩溃

Android , 触摸Modal就崩溃
RnVersion 0.65.1
java.lang.NullPointerException: Attempt to invoke interface method 'void com.facebook.react.uimanager.events.EventDispatcher.dispatchEvent(com.facebook.react.uimanager.events.Event)' on a null object reference
at com.facebook.react.uimanager.JSTouchDispatcher.handleTouchEvent(JSTouchDispatcher.java:86)
at com.facebook.react.views.modal.ReactModalHostView$DialogRootViewGroup.onInterceptTouchEvent(ReactModalHostView.java:521)

Provide index.d.ts

You can lay on this code

declare module 'react-native-translucent-modal' {
  import { Modal } from 'react-native';
  export default class TranslucentModal extends Modal {}
}

React-native autolinking support

Hello, and thanks for this neat module 👌

React-Native 0.60 introduced a new way to link dependencies automatically (without react-native link). It seems this project is not yet compatible, as I had to link it manually, which leads to an error when building my app for Android (it works, but it's a little sad).

$ react-native run-android
error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - react-native-translucent-modal (to unlink run: "react-native unlink react-native-translucent-modal")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

Could you please make this module compatible with autolinking ? 🙏

文档有错误

库是好用的,然而文档说明不全面,在安卓上还需要引入本地的module,这部分在文档上面找不到,跟着Example导入的module最后才运行成功,希望可以补充一下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.