2019-11-17 16:02:19 +05:00
|
|
|
import React, {useState, useEffect} from 'react';
|
|
|
|
|
import NavigationService, {
|
|
|
|
|
AppContainer,
|
|
|
|
|
} from './src/services/NavigationService';
|
2019-11-23 06:25:22 +05:00
|
|
|
import {
|
|
|
|
|
StatusBar,
|
|
|
|
|
View,
|
|
|
|
|
SafeAreaView,
|
|
|
|
|
TouchableOpacity,
|
|
|
|
|
DeviceEventEmitter,
|
|
|
|
|
Platform,
|
|
|
|
|
} from 'react-native';
|
2019-11-17 17:48:56 +05:00
|
|
|
import {COLOR_SCHEME, SIZE, opacity, WEIGHT} from './src/common/common';
|
|
|
|
|
import Icon from 'react-native-vector-icons/Ionicons';
|
|
|
|
|
import ActionButton from 'react-native-action-button';
|
2019-11-27 21:44:52 +05:00
|
|
|
import Storage from 'notes-core/sync/storage';
|
|
|
|
|
import StorageInterface from './src/utils/storage';
|
2019-11-15 01:17:59 +05:00
|
|
|
const App = () => {
|
2019-11-17 17:48:56 +05:00
|
|
|
const [colors, setColors] = useState(COLOR_SCHEME);
|
2019-11-23 06:25:22 +05:00
|
|
|
const [fab, setFab] = useState(true);
|
|
|
|
|
|
2019-11-17 16:02:19 +05:00
|
|
|
useEffect(() => {
|
2019-11-23 06:25:22 +05:00
|
|
|
DeviceEventEmitter.addListener('hide', () => {
|
|
|
|
|
setFab(false);
|
|
|
|
|
});
|
|
|
|
|
DeviceEventEmitter.addListener('show', () => {
|
|
|
|
|
setFab(true);
|
|
|
|
|
});
|
|
|
|
|
if (Platform.OS === 'android') {
|
|
|
|
|
StatusBar.setBackgroundColor('transparent');
|
|
|
|
|
StatusBar.setTranslucent(true);
|
|
|
|
|
StatusBar.setBarStyle('dark-content');
|
|
|
|
|
}
|
|
|
|
|
return () => {
|
|
|
|
|
DeviceEventEmitter.removeListener('hide', () => {
|
|
|
|
|
setFab(false);
|
|
|
|
|
});
|
|
|
|
|
DeviceEventEmitter.removeListener('show', () => {
|
|
|
|
|
setFab(true);
|
|
|
|
|
});
|
|
|
|
|
};
|
2019-11-17 16:02:19 +05:00
|
|
|
});
|
|
|
|
|
return (
|
2019-11-17 17:48:56 +05:00
|
|
|
<>
|
|
|
|
|
<AppContainer
|
|
|
|
|
ref={navigatorRef => {
|
|
|
|
|
NavigationService.setTopLevelNavigator(navigatorRef);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
2019-11-23 06:25:22 +05:00
|
|
|
{fab ? (
|
|
|
|
|
<ActionButton elevation={5} buttonColor={colors.accent}>
|
|
|
|
|
<ActionButton.Item
|
|
|
|
|
buttonColor="#9b59b6"
|
|
|
|
|
textStyle={{
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
2019-11-17 17:48:56 +05:00
|
|
|
color: 'white',
|
|
|
|
|
}}
|
2019-11-23 06:25:22 +05:00
|
|
|
title=""
|
|
|
|
|
hideShadow={true}
|
|
|
|
|
onPress={() => NavigationService.navigate('Editor')}>
|
|
|
|
|
<Icon
|
|
|
|
|
name="md-create"
|
|
|
|
|
style={{
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
height: 22,
|
|
|
|
|
color: 'white',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</ActionButton.Item>
|
|
|
|
|
<ActionButton.Item
|
|
|
|
|
textStyle={{
|
|
|
|
|
fontFamily: WEIGHT.regular,
|
2019-11-17 17:48:56 +05:00
|
|
|
color: 'white',
|
|
|
|
|
}}
|
2019-11-23 06:25:22 +05:00
|
|
|
hideShadow={true}
|
|
|
|
|
buttonColor="#3498db"
|
|
|
|
|
title=""
|
|
|
|
|
onPress={() => {
|
|
|
|
|
NavigationService.navigate('ListsEditor');
|
|
|
|
|
}}>
|
|
|
|
|
<Icon
|
|
|
|
|
name="ios-list"
|
|
|
|
|
style={{
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
height: 22,
|
|
|
|
|
color: 'white',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</ActionButton.Item>
|
|
|
|
|
</ActionButton>
|
|
|
|
|
) : (
|
|
|
|
|
undefined
|
|
|
|
|
)}
|
2019-11-17 17:48:56 +05:00
|
|
|
</>
|
2019-11-15 01:17:59 +05:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default App;
|
2019-11-27 21:44:52 +05:00
|
|
|
|
|
|
|
|
export const storage = new Storage(StorageInterface);
|