Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Respostas extends React.Component {
  2.  
  3.   state = {
  4.     modalVisible: false,
  5.   };
  6.  
  7.   setModalVisible(visible) {
  8.     this.setState({ modalVisible: visible });
  9.   }
  10.  
  11.   render() {
  12.    
  13.     return (
  14.      
  15.       <View style={styles.container}>
  16.  
  17.         <Modal
  18.           animationType="fade"
  19.           transparent={true}
  20.           visible={this.state.modalVisible}
  21.           onRequestClose={() => {
  22.             this.setModalVisible(false);
  23.           }}
  24.         >
  25.           <TouchableWithoutFeedback onPress={() => {this.setModalVisible(false);}}>
  26.           <View style={styles.modalstyle}>        
  27.             <View style={styles.modalcontent}>
  28.               <Image source={positive} />
  29.               <Text style={styles.title}>Parabéns!</Text>
  30.               <Text style={styles.body}>Cadastro realizado com sucesso</Text>
  31.               <TouchableHighlight style={styles.btnyes}
  32.                 underlayColor="#D6F22C"
  33.                 onPress={() => {
  34.                   this.setModalVisible(!this.state.modalVisible);
  35.                 }}>
  36.                 <Text style={{ color: 'white', fontSize: 14, fontWeight: 'bold' }}>Concluir</Text>
  37.               </TouchableHighlight>
  38.             </View>        
  39.           </View>    
  40.           </TouchableWithoutFeedback>
  41.         </Modal>
  42.        
  43.  
  44.         <TouchableHighlight
  45.           style={styles.button}
  46.           onPress={() => {
  47.             this.setModalVisible(true);
  48.           }}>
  49.           <Text>Show Modal</Text>
  50.         </TouchableHighlight>
  51.       </View>
  52.    
  53.     );
  54.   }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement