# rntpc_react-native-modal **Repository Path**: openharmony-sig/rntpc_react-native-modal ## Basic Information - **Project Name**: rntpc_react-native-modal - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://gitee.com/openharmony-sig/rntpc_react-native-modal - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-10-14 - **Last Updated**: 2025-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 🚨 **重要提示 | IMPORTANT** > > **⚠️ 此代码仓已归档。新地址请访问 [rntpc_react-native-modal](https://gitcode.com/openharmony-sig/rntpc_react-native-modal)。| ⚠️ This repository has been archived. For the new address, please visit [rntpc_react-native-modal](https://gitcode.com/openharmony-sig/rntpc_react-native-modal).** > --- > ### Announcements - 📣 We're looking for maintainers and contributors! See [#598](https://github.com/react-native-modal/react-native-modal/discussions/598) - 💡 We're brainstorming if/how we can make a JavaScript-only version of `react-native-modal`. See [#597](https://github.com/react-native-modal/react-native-modal/discussions/597) - 🙏 If you have a question, please [start a new discussion](https://github.com/react-native-modal/react-native-modal/discussions) instead of opening a new issue. # react-native-modal [![npm version](https://badge.fury.io/js/react-native-modal.svg)](https://badge.fury.io/js/react-native-modal) [![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) > If you're new to the React Native world, please notice that React Native itself offers a [ component that works out-of-the-box](https://reactnative.dev/docs/modal). An enhanced, animated, customizable React Native modal. The goal of `react-native-modal` is expanding the original React Native `` component by adding animations, style customization options, and new features, while still providing a simple API.

## Features - Smooth enter/exit animations - Plain simple and flexible APIs - Customizable backdrop opacity, color and timing - Listeners for the modal animations ending - Resize itself correctly on device rotation - Swipeable - Scrollable ## Setup This library is available on npm, install it with: `npm i react-native-modal` or `yarn add react-native-modal`. ## Usage Since `react-native-modal` is an extension of the [original React Native modal](https://reactnative.dev/docs/modal.html), it works in a similar fashion. 1. Import `react-native-modal`: ```javascript import Modal from "react-native-modal"; ``` 2. Create a `` component and nest its content inside of it: ```javascript function WrapperComponent() { return ( I am the modal content! ); } ``` 3. Then, show the modal by setting the `isVisible` prop to `true`: ```javascript function WrapperComponent() { return ( I am the modal content! ); } ``` The `isVisible` prop is the only prop you'll really need to make the modal work: you should control this prop value by saving it in your wrapper component state and setting it to `true` or `false` when needed. ## A complete example The following example consists in a component (`ModalTester`) with a button and a modal. The modal is controlled by the `isModalVisible` state variable and it is initially hidden, since its value is `false`. Pressing the button sets `isModalVisible` to true, making the modal visible. Inside the modal there is another button that, when pressed, sets `isModalVisible` to false, hiding the modal. ```javascript import React, { useState } from "react"; import { Button, Text, View } from "react-native"; import Modal from "react-native-modal"; function ModalTester() { const [isModalVisible, setModalVisible] = useState(false); const toggleModal = () => { setModalVisible(!isModalVisible); }; return (