ui optimization

This commit is contained in:
ammarahm-ed
2020-01-22 02:49:29 +05:00
parent 86d98405ec
commit 9c8dd26652

View File

@@ -9,7 +9,7 @@ import {
} from 'react-native'; } from 'react-native';
import FastStorage from 'react-native-fast-storage'; import FastStorage from 'react-native-fast-storage';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {db} from '../../../App'; import {db, DDS} from '../../../App';
import { import {
ACCENT, ACCENT,
COLOR_SCHEME, COLOR_SCHEME,
@@ -22,7 +22,11 @@ import {
WEIGHT, WEIGHT,
} from '../../common/common'; } from '../../common/common';
import {ACTIONS, useTracked} from '../../provider'; import {ACTIONS, useTracked} from '../../provider';
import {moveNoteEvent} from '../DialogManager'; import {
moveNoteEvent,
_recieveEvent,
_unSubscribeEvent,
} from '../DialogManager';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
@@ -37,16 +41,6 @@ export const ActionSheetComponent = ({
}) => { }) => {
const [state, dispatch] = useTracked(); const [state, dispatch] = useTracked();
const {colors} = state; const {colors} = state;
// Todo
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
let newColors = setColorScheme(colors, accent);
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
dispatch({type: ACTIONS.THEME, colors: newColors});
}
const [focused, setFocused] = useState(false); const [focused, setFocused] = useState(false);
const [note, setNote] = useState( const [note, setNote] = useState(
item item
@@ -65,6 +59,13 @@ export const ActionSheetComponent = ({
}, },
); );
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
let newColors = setColorScheme(colors, accent);
StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
dispatch({type: ACTIONS.THEME, colors: newColors});
}
useEffect(() => { useEffect(() => {
if (item.dateCreated !== null) { if (item.dateCreated !== null) {
setNote({...item}); setNote({...item});
@@ -358,8 +359,8 @@ export const ActionSheetComponent = ({
}}> }}>
<View <View
style={{ style={{
width: (w - 12) / 10, width: DDS.isTab ? (w * 0.6) / 10 : w / 10,
height: (w - 12) / 10, height: DDS.isTab ? (w * 0.6) / 10 : w / 10,
backgroundColor: color, backgroundColor: color,
borderRadius: 100, borderRadius: 100,
justifyContent: 'center', justifyContent: 'center',
@@ -379,7 +380,7 @@ export const ActionSheetComponent = ({
key={rowItem.name} key={rowItem.name}
style={{ style={{
alignItems: 'center', alignItems: 'center',
width: (w - 24) / rowItems.length, width: DDS.isTab ? (w * 0.6) / rowItems.length : w / rowItems.length,
}}> }}>
<Icon <Icon
style={{ style={{
@@ -483,13 +484,14 @@ export const ActionSheetComponent = ({
style={{ style={{
paddingBottom: 15, paddingBottom: 15,
backgroundColor: colors.bg, backgroundColor: colors.bg,
width: '100%',
paddingHorizontal: 12,
}}> }}>
<View <View
style={{ style={{
width: w - 24, width: '100%',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center', alignItems: 'center',
marginHorizontal: 12,
paddingVertical: 10, paddingVertical: 10,
flexDirection: 'row', flexDirection: 'row',
borderBottomWidth: 1, borderBottomWidth: 1,