react native modal
import React, {Component} from 'react';
import {Modal, Text, TouchableHighlight, View, Alert} from 'react-native';
class ModalExample extends Component {
state = {
modalVisible: false,
};
setModalVisible(visible) {
this.setState({modalVisible: visible});
}
render() {
return (
<View style={{marginTop: 22}}>
<Modal
animationType="slide"
transparent={false}
visible={this.state.modalVisible}
onRequestClose={() => {
Alert.alert('Modal has been closed.');
}}>
<View style={{marginTop: 22}}>
<View>
<Text>Hello World!</Text>
<TouchableHighlight
onPress={() => {
this.setModalVisible(!this.state.modalVisible);
}}>
<Text>Hide Modal</Text>
</TouchableHighlight>
</View>
</View>
</Modal>
<TouchableHighlight
onPress={() => {
this.setModalVisible(true);
}}>
<Text>Show Modal</Text>
</TouchableHighlight>
</View>
);
}
}
Also in JavaScript:
- install cypress
- javascript number between values
- get last element in array javascript
- get element by tag name
- how to update all node libraries
- extract data from pdf nodejs
- close browser tab javascript
- json parse string
- javascript modal show
- how to solve Could not write JSON: Infinite recursion (StackOverflowError)
- how to use fetch() to fetch an image from database in js
- jquery typeof undefined
- first letter capital in javascript
- onPress image react native
- datatable processing
- enable swipe using javascript
- javascript print numbers in the given range
- how to flatten array in javascript using foreach loop
- angular how to get previous state
- attempt to invoke virtual method 'android.graphics.drawable.drawable react native
- js settimeout mdn
- javascript converting latitude longitude to gps coordinates
- how to find the current date and time of a city in js
- javascript remove last word from string