Gathering detailed insights and metrics for modal-react-native-web
Gathering detailed insights and metrics for modal-react-native-web
Gathering detailed insights and metrics for modal-react-native-web
Gathering detailed insights and metrics for modal-react-native-web
react-native-modal
An enhanced React Native modal
react-native-modal-datetime-picker
A react-native datetime-picker for Android and iOS
react-native-date-picker
A datetime picker for React Native. In-modal or inlined. Supports Android and iOS.
modal-enhanced-react-native-web
React native modal enhanced for web
React Native Modal Implementation for Web
npm install modal-react-native-web
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
124 Stars
49 Commits
41 Forks
4 Watching
2 Branches
7 Contributors
Updated on 18 Jun 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-0.2%
13,777
Compared to previous day
Last week
3.6%
70,830
Compared to previous week
Last month
8.2%
292,350
Compared to previous month
Last year
33.8%
2,851,318
Compared to previous year
1
4
12
This repository contains NPM Packages for React Native Modal Implementation for Web
Modal is now supported in react native web.
https://github.com/necolas/react-native-web/releases/tag/0.14.0
Thank you for using and supporting this library!
React Native Modal is not yet implemented in React Native Web. This is just replacement of React Native Modal with the same API, behavior, and design. If you want to create a more enhanced modal, use React Native Web Modal Enhanced with the same code as React Native Modal implementation by React Native Community.
Modal library is available on npm, install it with: npm install --save modal-react-native-web
or yarn add modal-react-native-web
for the basic modal.
If you want to use the enhanced version, install it with npm install --save modal-enhanced-react-native-web
or yarn add modal-enhanced-react-native-web
.
Since r-web-modal is an implemantion of the original react native modal, it works in a similar fashion with react-native modal. But of course, some APIs are limited (not all props are suppported).
1 2import React, { Component } from 'react'; 3import { Text, TouchableHighlight, View } from 'react-native'; 4 5import Modal from 'modal-react-native-web'; 6 7export default class Example extends Component { 8 state = { 9 modalVisible: false, 10 }; 11 12 setModalVisible(visible) { 13 this.setState({modalVisible: visible}); 14 } 15 16 render() { 17 return ( 18 <View style={{marginTop: 22}}> 19 <Modal 20 animationType="slide" 21 transparent={false} 22 visible={this.state.modalVisible} 23 onDismiss={() => { 24 alert('Modal has been closed.'); 25 }}> 26 <View style={{marginTop: 22}}> 27 <View> 28 <Text>Hello World!</Text> 29 30 <TouchableHighlight 31 onPress={() => { 32 this.setModalVisible(!this.state.modalVisible); 33 }}> 34 <Text>Hide Modal</Text> 35 </TouchableHighlight> 36 </View> 37 </View> 38 </Modal> 39 40 <TouchableHighlight 41 onPress={() => { 42 this.setModalVisible(true); 43 }}> 44 <Text>Show Modal</Text> 45 </TouchableHighlight> 46 </View> 47 ); 48 } 49}
Taken from React Native Modal Example with some changes
1import React, { Component } from "react"; 2import { Text, TouchableOpacity, View, ScrollView } from "react-native"; 3 4import Modal from 'modal-enhanced-react-native-web'; 5 6export default class Example extends Component { 7 state = { 8 visibleModal: null 9 }; 10 11 _renderButton = (text, onPress) => ( 12 <TouchableOpacity onPress={onPress}> 13 <View> 14 <Text>{text}</Text> 15 </View> 16 </TouchableOpacity> 17 ); 18 19 _renderModalContent = () => ( 20 <View> 21 <Text>Hello!</Text> 22 {this._renderButton("Close", () => this.setState({ visibleModal: false }))} 23 </View> 24 ); 25 26 _handleOnScroll = event => { 27 this.setState({ 28 scrollOffset: event.nativeEvent.contentOffset.y 29 }); 30 }; 31 32 _handleScrollTo = p => { 33 if (this.scrollViewRef) { 34 this.scrollViewRef.scrollTo(p); 35 } 36 }; 37 38 render() { 39 return ( 40 <View> 41 {this._renderButton("Modal that can be closed on backdrop press", () => 42 this.setState({ visibleModal: true }) 43 )} 44 <Modal 45 isVisible={this.state.visibleModal} 46 onBackdropPress={() => this.setState({ visibleModal: false })} 47 > 48 {this._renderModalContent()} 49 </Modal> 50 </View> 51 ); 52 } 53}
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 state and setting it to true
or false
when needed.
Taken from React Native Modal Example and RN Modal by React Native with some changes
See React Native Modal by React Native Community for APIs.
Taken From React Native Modal by React Native Community
Take a look at react-native-animatable to see the dozens of animations available out-of-the-box. You can also pass in custom animation definitions and have them automatically register with react-native-animatable. For more information on creating custom animations, see the react-native-animatable animation definition schema.
React Native Web Modal |
Enhanced Modal React Native Web | |
---|---|---|
NPM | ||
Description | React Native Modal implemented for Web. Implemented using React Native Web Animated and React DOM Portal | Enhanced Version of React Native Modal, implemented for web |
Inspired by | RNW Modal by Kiurchv |
React Native Modal by React Native Community MIT License by React Native Community |
Not yet supported |
- onRequestClose - supportedOrientations - hardwareAccelerated - onOrientationChange - presentationStyle | - |
This project is licensed under the MIT License - see the LICENSE.md file for details
No vulnerabilities found.
No security vulnerabilities found.