2020-04-09 15:13:09 +05:00
|
|
|
import React, { useEffect, createRef } from 'react';
|
2020-03-15 10:20:34 +05:00
|
|
|
import Animated from 'react-native-reanimated';
|
2020-04-09 15:13:09 +05:00
|
|
|
import { Menu } from './src/components/Menu';
|
2020-03-15 11:03:35 +05:00
|
|
|
import * as Animatable from 'react-native-animatable';
|
2020-03-15 10:20:34 +05:00
|
|
|
import SideMenu from './src/components/SideMenu';
|
2020-05-03 16:28:48 +05:00
|
|
|
import { EditorPosition, EditorOpacity } from './src/utils/animations';
|
2020-04-09 15:13:09 +05:00
|
|
|
import { sideMenuRef } from './src/utils/refs';
|
|
|
|
|
import { DDS, w } from './src/utils/utils';
|
2020-03-15 10:20:34 +05:00
|
|
|
import Editor from './src/views/Editor';
|
2020-04-09 15:13:09 +05:00
|
|
|
import { useTracked } from './src/provider';
|
|
|
|
|
import { StatusBar, Platform } from 'react-native';
|
|
|
|
|
import { AppContainer } from './src/services/AppContainer';
|
|
|
|
|
import NavigationService from './src/services/NavigationService';
|
2020-04-16 13:57:51 +05:00
|
|
|
import { useSafeArea } from 'react-native-safe-area-context';
|
2020-03-15 10:20:34 +05:00
|
|
|
|
2020-03-15 11:03:35 +05:00
|
|
|
const editorRef = createRef();
|
2020-03-15 10:20:34 +05:00
|
|
|
export const Initialize = () => {
|
|
|
|
|
const [state, dispatch] = useTracked();
|
2020-04-09 15:13:09 +05:00
|
|
|
const { colors } = state;
|
2020-03-15 10:20:34 +05:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (Platform.OS === 'android') {
|
|
|
|
|
StatusBar.setBackgroundColor('transparent');
|
|
|
|
|
StatusBar.setTranslucent(true);
|
|
|
|
|
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
return (
|
2020-03-15 11:03:35 +05:00
|
|
|
<Animatable.View
|
|
|
|
|
transition="backgroundColor"
|
|
|
|
|
duration={300}
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
backgroundColor: colors.bg,
|
|
|
|
|
}}>
|
2020-03-15 10:20:34 +05:00
|
|
|
<SideMenu
|
|
|
|
|
ref={sideMenuRef}
|
|
|
|
|
bounceBackOnOverdraw={false}
|
|
|
|
|
contentContainerStyle={{
|
|
|
|
|
opacity: 0,
|
|
|
|
|
backgroundColor: colors.bg,
|
|
|
|
|
}}
|
|
|
|
|
menu={
|
|
|
|
|
<Menu
|
|
|
|
|
hide={false}
|
|
|
|
|
colors={colors}
|
|
|
|
|
close={() =>
|
|
|
|
|
sideMenuRef.current?.openMenu(!sideMenuRef.current?.isOpen)
|
|
|
|
|
}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
openMenuOffset={w / 1.5}>
|
|
|
|
|
<AppContainer
|
|
|
|
|
style={{
|
|
|
|
|
width: DDS.isTab ? '70%' : '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
backgroundColor: colors.bg,
|
|
|
|
|
}}
|
|
|
|
|
ref={navigatorRef => {
|
|
|
|
|
NavigationService.setTopLevelNavigator(navigatorRef);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</SideMenu>
|
2020-03-15 10:49:11 +05:00
|
|
|
|
2020-03-15 10:20:34 +05:00
|
|
|
<Animated.View
|
2020-03-15 11:03:35 +05:00
|
|
|
ref={editorRef}
|
2020-03-15 10:20:34 +05:00
|
|
|
onResponderTerminationRequest={true}
|
|
|
|
|
onStartShouldSetResponderCapture={false}
|
|
|
|
|
onStartShouldSetResponder={false}
|
|
|
|
|
onMoveShouldSetResponder={false}
|
|
|
|
|
onMoveShouldSetResponderCapture={false}
|
|
|
|
|
style={{
|
|
|
|
|
width: '100%',
|
|
|
|
|
height: '100%',
|
|
|
|
|
alignSelf: 'flex-end',
|
|
|
|
|
position: 'absolute',
|
|
|
|
|
backgroundColor: colors.bg,
|
|
|
|
|
elevation: 10,
|
2020-05-03 16:28:48 +05:00
|
|
|
opacity:EditorOpacity,
|
2020-03-15 10:20:34 +05:00
|
|
|
transform: [
|
|
|
|
|
{
|
|
|
|
|
translateX: EditorPosition,
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}}>
|
|
|
|
|
<Editor noMenu={false} />
|
|
|
|
|
</Animated.View>
|
2020-03-15 11:03:35 +05:00
|
|
|
</Animatable.View>
|
2020-03-15 10:20:34 +05:00
|
|
|
);
|
|
|
|
|
};
|