import React, {Component} from 'react'; import { Modal, Text, TouchableHighlight, View, Alert, StyleSheet, TextInput } from 'react-native'; export default class RoomInput extends Component { constructor(props) { super(props); this.join = this.props.join;; } state = { modalVisible: false, gameText: "", userText: "" }; setModalVisible(visible) { this.setState({modalVisible: visible}); } render() { return ( { Alert.alert('Modal has been closed.'); }} style={styles.modal}> Enter Game ID: this.setState({userText: text})} /> this.setState({gameText: texta})} /> { this.join(this.state.userText, this.state.gameText); this.setModalVisible(!this.state.modalVisible) }}> Join { this.setModalVisible(!this.state.modalVisible); }}> Cancel ); } } const styles = StyleSheet.create({ modal: { backgroundColor: 'white', margin: 15, alignItems: undefined, justifyContent: undefined, } })