Created
August 28, 2020 07:16
-
-
Save DipanshKhandelwal/40ff964c5fb579526004db80ccb635af to your computer and use it in GitHub Desktop.
WebRTC Tutorial : App.js :: https://github.com/DipanshKhandelwal/react-native-webrtc-firebase/blob/master/src/screens/RoomScreen.js
This file contains 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, SafeAreaView, RecyclerViewBackedScrollView } from 'react-native'; | |
import RoomScreen from './screens/RoomScreen'; | |
import CallScreen from './screens/CallScreen'; | |
import JoinScreen from './screens/JoinScreen'; | |
// Just to handle navigation | |
export default function App() { | |
const screens = { | |
ROOM: 'JOIN_ROOM', | |
CALL: 'CALL', | |
JOIN: 'JOIN', | |
} | |
const [screen, setScreen] = useState(screens.ROOM); | |
const [roomId, setRoomId] = useState(''); | |
let content; | |
switch (screen) { | |
case screens.ROOM: | |
content = <RoomScreen roomId={roomId} setRoomId={setRoomId} screens={screens} setScreen={setScreen} /> | |
break; | |
case screens.CALL: | |
content = <CallScreen roomId={roomId} screens={screens} setScreen={setScreen} /> | |
break; | |
case screens.JOIN: | |
content = <JoinScreen roomId={roomId} screens={screens} setScreen={setScreen} /> | |
break; | |
default: | |
content = <Text>Wrong Screen</Text> | |
} | |
return ( | |
<SafeAreaView style={styles.container} > | |
{content} | |
</SafeAreaView> | |
) | |
} | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
padding: 10, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment