2021-02-19 10:12:07 -07:00
|
|
|
import 'react-native-gesture-handler';
|
2021-02-20 09:07:10 -07:00
|
|
|
import { Navigation } from 'react-native-navigation';
|
2021-02-19 10:12:07 -07:00
|
|
|
import { gestureHandlerRootHOC } from 'react-native-gesture-handler';
|
2021-05-11 04:59:05 -06:00
|
|
|
import { CameraPage } from './src/CameraPage';
|
2021-02-19 10:43:41 -07:00
|
|
|
import { Splash } from './src/Splash';
|
2021-05-11 04:59:05 -06:00
|
|
|
import { MediaPage } from './src/MediaPage';
|
2021-02-19 11:51:59 -07:00
|
|
|
import { Camera } from 'react-native-vision-camera';
|
2021-02-19 08:07:53 -07:00
|
|
|
|
2021-02-19 10:24:32 -07:00
|
|
|
Navigation.setDefaultOptions({
|
|
|
|
topBar: {
|
|
|
|
visible: false,
|
|
|
|
},
|
2021-02-19 11:51:59 -07:00
|
|
|
window: {
|
|
|
|
backgroundColor: 'black',
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
backgroundColor: 'black',
|
2021-02-20 09:07:10 -07:00
|
|
|
componentBackgroundColor: 'black',
|
2021-02-19 11:51:59 -07:00
|
|
|
},
|
2021-02-19 13:10:32 -07:00
|
|
|
statusBar: {
|
|
|
|
animated: true,
|
|
|
|
drawBehind: true,
|
|
|
|
translucent: true,
|
|
|
|
visible: true,
|
2021-02-20 09:07:10 -07:00
|
|
|
style: 'dark',
|
2021-02-19 13:10:32 -07:00
|
|
|
},
|
2021-02-19 13:14:42 -07:00
|
|
|
animations: {
|
|
|
|
setRoot: {
|
|
|
|
alpha: {
|
|
|
|
duration: 500,
|
|
|
|
from: 0,
|
|
|
|
to: 1,
|
2021-02-20 09:07:10 -07:00
|
|
|
},
|
2021-02-19 13:14:42 -07:00
|
|
|
},
|
2021-02-20 09:07:10 -07:00
|
|
|
},
|
2021-02-19 10:24:32 -07:00
|
|
|
});
|
2021-02-19 10:12:07 -07:00
|
|
|
|
2021-02-20 09:07:10 -07:00
|
|
|
Navigation.registerComponent(
|
|
|
|
'Splash',
|
|
|
|
() => gestureHandlerRootHOC(Splash),
|
|
|
|
() => Splash,
|
|
|
|
);
|
|
|
|
Navigation.registerComponent(
|
2021-05-11 04:59:05 -06:00
|
|
|
'CameraPage',
|
|
|
|
() => gestureHandlerRootHOC(CameraPage),
|
|
|
|
() => CameraPage,
|
2021-02-20 09:07:10 -07:00
|
|
|
);
|
|
|
|
Navigation.registerComponent(
|
2021-05-11 04:59:05 -06:00
|
|
|
'MediaPage',
|
|
|
|
() => gestureHandlerRootHOC(MediaPage),
|
|
|
|
() => MediaPage,
|
2021-02-20 09:07:10 -07:00
|
|
|
);
|
2021-02-19 10:02:24 -07:00
|
|
|
|
2021-02-19 12:05:02 -07:00
|
|
|
Navigation.events().registerNavigationButtonPressedListener((event) => {
|
2021-02-20 09:07:10 -07:00
|
|
|
if (event.buttonId === 'back') Navigation.pop(event.componentId);
|
2021-02-19 12:05:02 -07:00
|
|
|
});
|
|
|
|
|
2021-02-19 11:51:59 -07:00
|
|
|
Navigation.events().registerAppLaunchedListener(async () => {
|
2021-03-31 07:43:29 -06:00
|
|
|
const [cameraPermission, microphonePermission] = await Promise.all([
|
|
|
|
Camera.getCameraPermissionStatus(),
|
|
|
|
Camera.getMicrophonePermissionStatus(),
|
|
|
|
]);
|
2021-02-20 09:07:10 -07:00
|
|
|
let rootName = 'Splash';
|
2021-05-11 04:59:05 -06:00
|
|
|
if (cameraPermission === 'authorized' && microphonePermission === 'authorized') rootName = 'CameraPage';
|
2021-02-19 11:51:59 -07:00
|
|
|
|
|
|
|
Navigation.setRoot({
|
|
|
|
root: {
|
|
|
|
stack: {
|
|
|
|
children: [
|
|
|
|
{
|
|
|
|
component: {
|
2021-02-20 09:07:10 -07:00
|
|
|
name: rootName,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-02-19 10:02:24 -07:00
|
|
|
});
|
|
|
|
});
|