-
Notifications
You must be signed in to change notification settings - Fork 0
/
33_modal_inbuilt.js
64 lines (50 loc) · 1.19 KB
/
33_modal_inbuilt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import React,{useEffect,useState} from 'react';
import { Button, Text, View,ActivityIndicator,StyleSheet,Modal } from 'react-native';
const App = () => {
const [showModal,setShowModal] = useState(false);
return (
<View style={styles.main}>
<Modal
transparent={true}
visible={showModal}
animationType="slide"
>
<View style={styles.centredView}>
<View style={styles.modalView}>
<Text style={styles.modalText}>Modal Code Step By Step</Text>
<Button title="Close Modal" onPress={()=>setShowModal(false)}/>
</View>
</View>
</Modal>
<View style={styles.buttonView}>
<Button title="Show Modal" onPress={()=>setShowModal(true)} />
</View>
</View>
);
}
const styles = StyleSheet.create({
main:{
flex:1,
},
buttonView:{
flex:1,
justifyContent:'flex-end',
},
centredView:{
flex:1,
justifyContent:'center',
alignItems:'center',
},
modalView:{
backgroundColor:'white',
padding:20,
borderRadius:20,
shadowColor:'black',
elevation:10
},
modalText:{
fontSize:30,
marginBottom:20,
},
})
export default App;