Created
August 28, 2020 07:13
-
-
Save DipanshKhandelwal/1e71f819e78db8c1dd986561f04cc9d6 to your computer and use it in GitHub Desktop.
WebRTC Tutorial : RoomScreen.js :: https://github.com/DipanshKhandelwal/react-native-webrtc-firebase/blob/master/src/screens/RoomScreen.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { Text, StyleSheet, Button, View, TextInput } from 'react-native'; | |
export default function RoomScreen({ setScreen, screens, setRoomId, roomId }) { | |
const onCallOrJoin = (screen) => { | |
if (roomId.length > 0) { | |
setScreen(screen) | |
} | |
} | |
return ( | |
<> | |
<Text style={styles.heading} >Select a Room</Text> | |
<TextInput style={styles.input} value={roomId} onChangeText={setRoomId} /> | |
<View style={styles.buttonContainer} > | |
<Button title="Join Screen" onPress={() => onCallOrJoin(screens.JOIN)} /> | |
</View> | |
<View style={styles.buttonContainer} > | |
<Button title="Call Screen" onPress={() => onCallOrJoin(screens.CALL)} /> | |
</View> | |
</> | |
) | |
} | |
const styles = StyleSheet.create({ | |
heading: { | |
marginVertical: 10, | |
alignSelf: 'center', | |
fontSize: 30, | |
}, | |
input: { | |
margin: 20, | |
height: 40, | |
backgroundColor: '#aaa' | |
}, | |
buttonContainer: { | |
margin: 5 | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment