|
|
|
@ -1,15 +1,46 @@
|
|
|
|
|
import * as React from 'react';
|
|
|
|
|
|
|
|
|
|
import { StyleSheet, View } from 'react-native';
|
|
|
|
|
import { Alert, StyleSheet, Text, View } from 'react-native';
|
|
|
|
|
import { BigbluebuttonMobile } from 'bigbluebutton-mobile-sdk';
|
|
|
|
|
import type { INativeEvent } from './types';
|
|
|
|
|
|
|
|
|
|
export default function App() {
|
|
|
|
|
const [loadComponent, setLoadComponent] = React.useState(true);
|
|
|
|
|
|
|
|
|
|
const handleOnError = React.useCallback((content: any) => {
|
|
|
|
|
const nativeEvent = content.nativeEvent as INativeEvent;
|
|
|
|
|
console.log(
|
|
|
|
|
`Error loading URL ${nativeEvent.url}: ${nativeEvent.description}`
|
|
|
|
|
);
|
|
|
|
|
setLoadComponent(false);
|
|
|
|
|
Alert.alert('Error loading URL', undefined, [
|
|
|
|
|
{
|
|
|
|
|
text: 'Cancel',
|
|
|
|
|
onPress: () => console.log('Cancel Pressed'),
|
|
|
|
|
style: 'cancel',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'Retry',
|
|
|
|
|
onPress: () => {
|
|
|
|
|
console.log('Retry Pressed');
|
|
|
|
|
setLoadComponent(true);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<View style={styles.container}>
|
|
|
|
|
<BigbluebuttonMobile
|
|
|
|
|
url="https://mobile.bbb.imdt.dev"
|
|
|
|
|
style={styles.bbb}
|
|
|
|
|
/>
|
|
|
|
|
{loadComponent ? (
|
|
|
|
|
<BigbluebuttonMobile
|
|
|
|
|
url="https://mobile.bbb.imdt.dev"
|
|
|
|
|
style={styles.bbb}
|
|
|
|
|
onError={(content: any) => handleOnError(content)}
|
|
|
|
|
onSuccess={() => console.log('URL Valid')}
|
|
|
|
|
/>
|
|
|
|
|
) : (
|
|
|
|
|
<Text style={styles.text}>Invalid URL</Text>
|
|
|
|
|
)}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -23,4 +54,10 @@ const styles = StyleSheet.create({
|
|
|
|
|
marginTop: 48,
|
|
|
|
|
flex: 1,
|
|
|
|
|
},
|
|
|
|
|
text: {
|
|
|
|
|
marginTop: 48,
|
|
|
|
|
flex: 1,
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
alignContent: 'center',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|