add themes & dark mode

This commit is contained in:
ammarahm-ed
2019-12-07 12:05:15 +05:00
parent 58c0e5fb11
commit 72d897a35d
26 changed files with 962 additions and 586 deletions

View File

@@ -12,7 +12,21 @@ import {
Text, Text,
Keyboard, Keyboard,
} from 'react-native'; } from 'react-native';
import {COLOR_SCHEME, SIZE, opacity, WEIGHT, pv, ph} from './src/common/common'; import AsyncStorage from '@react-native-community/async-storage';
import {
COLOR_SCHEME,
COLOR_SCHEME_DARK,
SIZE,
opacity,
WEIGHT,
pv,
ph,
setColorScheme,
onThemeUpdate,
clearThemeUpdateListener,
COLOR_SCHEME_LIGHT,
setAccentColor,
} from './src/common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import ActionButton from 'react-native-action-button'; import ActionButton from 'react-native-action-button';
import Storage from 'notes-core/api/database'; import Storage from 'notes-core/api/database';
@@ -22,6 +36,7 @@ import {h, w} from './src/utils/utils';
import {Toast} from './src/components/Toast'; import {Toast} from './src/components/Toast';
import {Menu} from './src/components/Menu'; import {Menu} from './src/components/Menu';
import SideMenu from 'react-native-side-menu'; import SideMenu from 'react-native-side-menu';
import {useForceUpdate} from './src/views/ListsEditor';
const App = () => { const App = () => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const [fab, setFab] = useState(true); const [fab, setFab] = useState(true);
@@ -30,11 +45,29 @@ const App = () => {
const [disableGestures, setDisableGesture] = useState(false); const [disableGestures, setDisableGesture] = useState(false);
const [buttonHide, setButtonHide] = useState(false); const [buttonHide, setButtonHide] = useState(false);
useEffect(() => { useEffect(() => {
if (Platform.OS === 'android') { let theme = COLOR_SCHEME_LIGHT;
StatusBar.setBackgroundColor('transparent'); AsyncStorage.getItem('accentColor').then(accentColor => {
StatusBar.setTranslucent(true); if (typeof accentColor !== 'string') {
StatusBar.setBarStyle('dark-content'); AsyncStorage.setItem('accentColor', colors.accent);
} else {
setAccentColor(accentColor);
} }
});
AsyncStorage.getItem('theme').then(t => {
if (typeof t !== 'string') {
AsyncStorage.setItem('theme', JSON.stringify(theme));
setColorScheme(COLOR_SCHEME_LIGHT);
} else {
let themeToSet = JSON.parse(t);
themeToSet.night
? setColorScheme(COLOR_SCHEME_DARK)
: setColorScheme(COLOR_SCHEME_LIGHT);
StatusBar.setBarStyle(
themeToSet.night ? 'light-content' : 'dark-content',
);
}
});
}, []); }, []);
useEffect(() => { useEffect(() => {
@@ -110,6 +143,14 @@ const App = () => {
}; };
}, []); }, []);
useEffect(() => {
if (Platform.OS === 'android') {
StatusBar.setBackgroundColor('transparent');
StatusBar.setTranslucent(true);
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
}
}, []);
return ( return (
<View <View
style={{ style={{
@@ -126,7 +167,6 @@ const App = () => {
width: sidebar, width: sidebar,
}}> }}>
<Menu <Menu
colors={colors}
close={() => { close={() => {
setSidebar('0%'); setSidebar('0%');
}} }}

View File

@@ -1,38 +1,81 @@
import Storage from '../utils/storage'; import {DeviceEventEmitter} from 'react-native';
//COLOR SCHEME //COLOR SCHEME
export const ACCENT = {
export function setColorScheme( color: '#0560FF',
night = false, };
bg = 'white', export function setColorScheme(colors = COLOR_SCHEME, accent = ACCENT.color) {
fg = '#1790F3', COLOR_SCHEME.bg = colors.bg;
nav = '#f2f2f2', COLOR_SCHEME.fg = accent;
pri = 'black', COLOR_SCHEME.navbg = colors.navbg;
sec = 'white', COLOR_SCHEME.nav = colors.nav;
accent = '#1790F3', COLOR_SCHEME.pri = colors.pri;
normal = 'black', COLOR_SCHEME.sec = colors.sec;
icon = ICONS_COLOR,
) {
COLOR_SCHEME.bg = bg;
COLOR_SCHEME.fg = fg;
COLOR_SCHEME.nav = nav;
COLOR_SCHEME.pri = pri;
COLOR_SCHEME.sec = sec;
COLOR_SCHEME.accent = accent; COLOR_SCHEME.accent = accent;
COLOR_SCHEME.normal = normal; COLOR_SCHEME.normal = colors.normal;
COLOR_SCHEME.night = night; COLOR_SCHEME.night = colors.night;
COLOR_SCHEME.icon = icon; COLOR_SCHEME.icon = colors.icon;
return; DeviceEventEmitter.emit('onThemeUpdate');
} }
export function setAccentColor(color) {
ACCENT.color = color;
DeviceEventEmitter.emit('onThemeUpdate');
}
export const onThemeUpdate = (func = () => {}) => {
return DeviceEventEmitter.addListener('onThemeUpdate', func);
};
export const clearThemeUpdateListener = (func = () => {}) => {
return DeviceEventEmitter.removeListener('onThemeUpdate', func);
};
export const COLOR_SCHEME = { export const COLOR_SCHEME = {
night: false, night: false,
bg: 'white', bg: 'white',
fg: '#0560FF', fg: ACCENT.color,
navbg: '#f6fbfc', navbg: '#f6fbfc',
nav: '#f0f0f0',
pri: 'black', pri: 'black',
sec: 'white', sec: 'white',
accent: '#0560FF', accent: ACCENT.color,
normal: 'black',
icon: 'gray',
errorBg: '#FFD2D2',
errorText: '#D8000C',
successBg: '#DFF2BF',
successText: '#4F8A10',
warningBg: '#FEEFB3',
warningText: '#9F6000',
};
export const COLOR_SCHEME_LIGHT = {
night: false,
bg: 'white',
fg: ACCENT.color,
navbg: '#f6fbfc',
nav: '#f0f0f0',
pri: 'black',
sec: 'white',
accent: ACCENT.color,
normal: 'black',
icon: 'gray',
errorBg: '#FFD2D2',
errorText: '#D8000C',
successBg: '#DFF2BF',
successText: '#4F8A10',
warningBg: '#FEEFB3',
warningText: '#9F6000',
};
export const COLOR_SCHEME_DARK = {
night: true,
bg: '#1f1f1f',
fg: ACCENT.color,
navbg: '#1c1c1c',
nav: '#2b2b2b',
pri: 'white',
sec: 'black',
accent: ACCENT.color,
normal: 'black', normal: 'black',
icon: 'gray', icon: 'gray',
errorBg: '#FFD2D2', errorBg: '#FFD2D2',

View File

@@ -162,7 +162,7 @@ export const AddNotebookDialog = ({visible, close}) => {
style={{ style={{
padding: pv - 5, padding: pv - 5,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingHorizontal: ph, paddingHorizontal: ph,
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.sm, fontSize: SIZE.sm,
@@ -258,7 +258,7 @@ export const AddNotebookDialog = ({visible, close}) => {
width: '45%', width: '45%',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: '#f0f0f0', backgroundColor: colors.nav,
}}> }}>
<Text <Text
style={{ style={{
@@ -298,7 +298,7 @@ const TopicItem = ({
alignItems: 'center', alignItems: 'center',
borderRadius: 5, borderRadius: 5,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingHorizontal: ph, paddingHorizontal: ph,
marginTop: 10, marginTop: 10,
}}> }}>

View File

@@ -138,7 +138,7 @@ export const Dialog = ({
width: '48%', width: '48%',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: '#f0f0f0', backgroundColor: colors.nav,
}}> }}>
<Text <Text
style={{ style={{

View File

@@ -26,7 +26,7 @@ export const ListItem = props => {
marginVertical: Platform.OS === 'ios' ? h * 0.01 : '0%', marginVertical: Platform.OS === 'ios' ? h * 0.01 : '0%',
alignSelf: 'center', alignSelf: 'center',
borderRadius: br, borderRadius: br,
backgroundColor: '#f0f0f0', backgroundColor: colors.nav,
marginBottom: 20, marginBottom: 20,
padding: 5, padding: 5,

View File

@@ -19,13 +19,35 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
COLOR_SCHEME_DARK,
setColorScheme,
COLOR_SCHEME_LIGHT,
clearThemeUpdateListener,
onThemeUpdate,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {getElevation, w, h, Toast} from '../../utils/utils'; import {getElevation, w, h, Toast} from '../../utils/utils';
import AsyncStorage from '@react-native-community/async-storage';
import {useForceUpdate} from '../../views/ListsEditor';
export const Menu = ({colors, close = () => {}, hide}) => ( export const Menu = ({close = () => {}, hide, update = () => {}}) => {
const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return (
<SafeAreaView <SafeAreaView
style={{ style={{
height: '100%', height: '100%',
@@ -36,6 +58,7 @@ export const Menu = ({colors, close = () => {}, hide}) => (
contentContainerStyle={{ contentContainerStyle={{
justifyContent: 'space-between', justifyContent: 'space-between',
height: '100%', height: '100%',
backgroundColor: colors.navbg,
}}> }}>
<View> <View>
<View <View
@@ -55,6 +78,7 @@ export const Menu = ({colors, close = () => {}, hide}) => (
name: 'Home', name: 'Home',
icon: 'home', icon: 'home',
func: () => NavigationService.navigate('Home'), func: () => NavigationService.navigate('Home'),
close: true,
}, },
{ {
@@ -64,34 +88,54 @@ export const Menu = ({colors, close = () => {}, hide}) => (
NavigationService.navigate('Folders', { NavigationService.navigate('Folders', {
title: 'Notebooks', title: 'Notebooks',
}), }),
close: true,
}, },
{ {
name: 'Lists', name: 'Lists',
icon: 'list', icon: 'list',
func: () => NavigationService.navigate('Lists'), func: () => NavigationService.navigate('Lists'),
close: true,
}, },
{ {
name: 'Favorites', name: 'Favorites',
icon: 'star', icon: 'star',
func: () => NavigationService.navigate('Favorites'), func: () => NavigationService.navigate('Favorites'),
close: true,
}, },
{ {
name: 'Dark Mode', name: 'Dark Mode',
icon: 'moon', icon: 'moon',
func: () => NavigationService.navigate('Folders'), func: () => {
if (!colors.night) {
AsyncStorage.setItem(
'theme',
JSON.stringify(COLOR_SCHEME_DARK),
);
setColorScheme(COLOR_SCHEME_DARK);
} else {
AsyncStorage.setItem(
'theme',
JSON.stringify(COLOR_SCHEME_LIGHT),
);
setColorScheme(COLOR_SCHEME_LIGHT);
}
},
switch: true, switch: true,
on: false, on: colors.night ? true : false,
close: false,
}, },
{ {
name: 'Trash', name: 'Trash',
icon: 'trash', icon: 'trash',
func: () => NavigationService.navigate('Trash'), func: () => NavigationService.navigate('Trash'),
close: true,
}, },
{ {
name: 'Settings', name: 'Settings',
icon: 'settings', icon: 'settings',
func: () => NavigationService.navigate('Settings'), func: () => NavigationService.navigate('Settings'),
close: true,
}, },
]} ]}
keyExtractor={(item, index) => item.name} keyExtractor={(item, index) => item.name}
@@ -99,7 +143,7 @@ export const Menu = ({colors, close = () => {}, hide}) => (
<TouchableOpacity <TouchableOpacity
activeOpacity={opacity} activeOpacity={opacity}
onPress={() => { onPress={() => {
close(); item.close === false ? null : close();
item.func(); item.func();
}} }}
style={{ style={{
@@ -128,6 +172,7 @@ export const Menu = ({colors, close = () => {}, hide}) => (
style={{ style={{
fontFamily: WEIGHT.medium, fontFamily: WEIGHT.medium,
fontSize: SIZE.sm - 1, fontSize: SIZE.sm - 1,
color: colors.pri,
}}> }}>
{item.name} {item.name}
</Text> </Text>
@@ -177,6 +222,7 @@ export const Menu = ({colors, close = () => {}, hide}) => (
style={{ style={{
fontFamily: WEIGHT.medium, fontFamily: WEIGHT.medium,
fontSize: SIZE.sm - 1, fontSize: SIZE.sm - 1,
color: colors.pri,
}}> }}>
Tags Tags
</Text> </Text>
@@ -394,3 +440,4 @@ export const Menu = ({colors, close = () => {}, hide}) => (
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
); );
};

View File

@@ -51,7 +51,7 @@ const NoteItem = props => {
width: Platform.isPad ? '95%' : '90%', width: Platform.isPad ? '95%' : '90%',
alignSelf: 'center', alignSelf: 'center',
borderBottomWidth: 1, borderBottomWidth: 1,
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
}}> }}>
<Dialog <Dialog
visible={visible} visible={visible}
@@ -151,6 +151,7 @@ const NoteItem = props => {
<Menu <Menu
style={{ style={{
borderRadius: 5, borderRadius: 5,
backgroundColor: colors.nav,
}} }}
ref={ref => (setMenuRef[props.index] = ref)} ref={ref => (setMenuRef[props.index] = ref)}
button={ button={

View File

@@ -38,7 +38,7 @@ export const NotebookItem = ({
paddingHorizontal: ph, paddingHorizontal: ph,
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomWidth: 1, borderBottomWidth: 1,
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv, paddingVertical: pv,
}}> }}>
<View <View
@@ -224,7 +224,7 @@ export const NotebookItem = ({
borderRadius: 5, borderRadius: 5,
width: '20%', width: '20%',
paddingHorizontal: ph - 5, paddingHorizontal: ph - 5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingVertical: pv, paddingVertical: pv,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'center', justifyContent: 'center',

View File

@@ -18,6 +18,8 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
@@ -41,6 +43,17 @@ export const RecentList = ({update, onScroll, margin}) => {
fetchNotes(); fetchNotes();
}, [update]); }, [update]);
useEffect(() => {
onThemeUpdate(() => {
setColors(COLOR_SCHEME);
});
return () => {
clearThemeUpdateListener(() => {
setColors(COLOR_SCHEME);
});
};
}, []);
return ( return (
<> <>
<FlatList <FlatList
@@ -52,6 +65,7 @@ export const RecentList = ({update, onScroll, margin}) => {
style={{ style={{
height: '100%', height: '100%',
width: '100%', width: '100%',
backgroundColor: colors.bg,
}} }}
ListHeaderComponent={ ListHeaderComponent={
<View <View

View File

@@ -25,7 +25,7 @@ export const Reminder = props => {
marginVertical: Platform.OS === 'ios' ? h * 0.01 : '0%', marginVertical: Platform.OS === 'ios' ? h * 0.01 : '0%',
alignSelf: 'center', alignSelf: 'center',
borderRadius: br, borderRadius: br,
backgroundColor: props.invert ? '#f0f0f0' : colors.accent, backgroundColor: props.invert ? colors.nav : colors.accent,
paddingHorizontal: ph, paddingHorizontal: ph,
marginBottom: 20, marginBottom: 20,
padding: 5, padding: 5,

View File

@@ -48,7 +48,7 @@ export const Search = props => {
? pv - 3 ? pv - 3
: pv - 8, : pv - 8,
marginBottom: props.hide ? 0 : 10, marginBottom: props.hide ? 0 : 10,
borderColor: focus ? colors.navbg : '#f0f0f0', borderColor: focus ? colors.accent : colors.nav,
height: props.hide ? 0 : 55, height: props.hide ? 0 : 55,
}}> }}>
<TextInput <TextInput

View File

@@ -96,7 +96,7 @@ export const VaultDialog = ({visible, close}) => {
style={{ style={{
padding: pv - 5, padding: pv - 5,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingHorizontal: ph, paddingHorizontal: ph,
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.sm, fontSize: SIZE.sm,
@@ -111,7 +111,7 @@ export const VaultDialog = ({visible, close}) => {
style={{ style={{
padding: pv - 5, padding: pv - 5,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingHorizontal: ph, paddingHorizontal: ph,
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.sm, fontSize: SIZE.sm,
@@ -126,7 +126,7 @@ export const VaultDialog = ({visible, close}) => {
style={{ style={{
padding: pv - 5, padding: pv - 5,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingHorizontal: ph, paddingHorizontal: ph,
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.sm, fontSize: SIZE.sm,
@@ -182,7 +182,7 @@ export const VaultDialog = ({visible, close}) => {
width: '45%', width: '45%',
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: '#f0f0f0', backgroundColor: colors.nav,
}}> }}>
<Text <Text
style={{ style={{
@@ -222,7 +222,7 @@ const TopicItem = ({
alignItems: 'center', alignItems: 'center',
borderRadius: 5, borderRadius: 5,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingHorizontal: ph, paddingHorizontal: ph,
marginTop: 10, marginTop: 10,
}}> }}>

View File

@@ -44,8 +44,15 @@ export const Header = ({
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
paddingRight: 15, paddingRight: 15,
height: 40,
width: 40,
marginTop: 5,
}}> }}>
<Icon name={'chevron-left'} size={SIZE.xl} /> <Icon
color={colors.pri}
name={'chevron-left'}
size={hide ? SIZE.xl : SIZE.xxl}
/>
</TouchableOpacity> </TouchableOpacity>
) : ( ) : (
undefined undefined
@@ -78,7 +85,7 @@ export const Header = ({
paddingRight: 0, paddingRight: 0,
marginTop: 7, marginTop: 7,
}}> }}>
<Icon name={'search'} size={SIZE.xl} /> <Icon name={'search'} size={SIZE.xl} color={colors.icon} />
</TouchableOpacity> </TouchableOpacity>
</Animatable.View> </Animatable.View>
</Animatable.View> </Animatable.View>

View File

@@ -20,23 +20,37 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import NoteItem from '../../components/NoteItem'; import NoteItem from '../../components/NoteItem';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
export const AccountSettings = ({navigation}) => { export const AccountSettings = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
height: '100%', height: '100%',
backgroundColor: colors.bg,
}}> }}>
<Header colors={colors} heading="" canGoBack={true} /> <Header colors={colors} heading="" canGoBack={true} />
@@ -110,7 +124,7 @@ export const AccountSettings = ({navigation}) => {
borderBottomWidth: 1, borderBottomWidth: 1,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
paddingHorizontal: ph, paddingHorizontal: ph,
@@ -122,6 +136,7 @@ export const AccountSettings = ({navigation}) => {
fontSize: SIZE.md, fontSize: SIZE.md,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
textAlignVertical: 'center', textAlignVertical: 'center',
color: colors.pri,
}}> }}>
<Icon name={item.icon} size={SIZE.md} /> <Icon name={item.icon} size={SIZE.md} />
{' '} {item.name} {' '} {item.name}
@@ -149,9 +164,10 @@ export const AccountSettings = ({navigation}) => {
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
color: 'white', color: 'white',
}}> }}>
<Icon size={SIZE.lg} color="white" name="log-out" />
{' '}
Logout Logout
</Text> </Text>
<Icon size={SIZE.lg} color="white" name="log-out" />
</TouchableOpacity> </TouchableOpacity>
</SafeAreaView> </SafeAreaView>
); );

View File

@@ -19,18 +19,32 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
export const Favorites = ({navigation}) => { export const Favorites = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView> <SafeAreaView>
<Header colors={colors} heading="Favorites" canGoBack={false} /> <Header colors={colors} heading="Favorites" canGoBack={false} />

View File

@@ -21,6 +21,8 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
@@ -40,6 +42,7 @@ export const Folders = ({navigation}) => {
const [notebooks, setNotebooks] = useState([]); const [notebooks, setNotebooks] = useState([]);
const [hideHeader, setHideHeader] = useState(false); const [hideHeader, setHideHeader] = useState(false);
const [margin, setMargin] = useState(150); const [margin, setMargin] = useState(150);
const forceUpdate = useForceUpdate();
const params = navigation.state.params; const params = navigation.state.params;
let offsetY = 0; let offsetY = 0;
let countUp = 0; let countUp = 0;
@@ -66,10 +69,22 @@ export const Folders = ({navigation}) => {
console.log(storage.getNotebooks()); console.log(storage.getNotebooks());
}, []); }, []);
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
height: '100%', height: '100%',
backgroundColor: colors.bg,
}}> }}>
<AddNotebookDialog <AddNotebookDialog
visible={addNotebook} visible={addNotebook}
@@ -157,12 +172,11 @@ export const Folders = ({navigation}) => {
setAddNotebook(true); setAddNotebook(true);
}} }}
style={{ style={{
borderWidth: 1,
borderRadius: 5, borderRadius: 5,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
paddingHorizontal: ph, paddingHorizontal: ph,
borderColor: '#f0f0f0',
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',

View File

@@ -20,6 +20,8 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
@@ -28,10 +30,22 @@ import {getElevation} from '../../utils/utils';
import {FlatList, TextInput} from 'react-native-gesture-handler'; import {FlatList, TextInput} from 'react-native-gesture-handler';
import {NavigationEvents} from 'react-navigation'; import {NavigationEvents} from 'react-navigation';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import {useForceUpdate} from '../ListsEditor';
export const ForgotPassword = ({navigation}) => { export const ForgotPassword = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
useEffect(() => { useEffect(() => {
DeviceEventEmitter.emit('hide'); DeviceEventEmitter.emit('hide');
return () => { return () => {
@@ -40,7 +54,11 @@ export const ForgotPassword = ({navigation}) => {
}, []); }, []);
return ( return (
<SafeAreaView> <SafeAreaView
style={{
backgroundColor: colors.bg,
height: '100%',
}}>
<NavigationEvents <NavigationEvents
onWillFocus={() => { onWillFocus={() => {
DeviceEventEmitter.emit('hide'); DeviceEventEmitter.emit('hide');
@@ -95,14 +113,14 @@ const renderForgotPassword = colors => {
onBlur={() => { onBlur={() => {
_email.current.setNativeProps({ _email.current.setNativeProps({
style: { style: {
borderColor: '#f0f0f0', borderColor: colors.nav,
}, },
}); });
}} }}
style={{ style={{
padding: pv, padding: pv,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
marginHorizontal: '5%', marginHorizontal: '5%',
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.md, fontSize: SIZE.md,

View File

@@ -9,7 +9,16 @@ import {
Text, Text,
Keyboard, Keyboard,
} from 'react-native'; } from 'react-native';
import {COLOR_SCHEME, opacity, pv, br, SIZE, WEIGHT} from '../../common/common'; import {
COLOR_SCHEME,
opacity,
pv,
br,
SIZE,
WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common';
import {styles} from './styles'; import {styles} from './styles';
import {Search} from '../../components/SearchInput'; import {Search} from '../../components/SearchInput';
import {RecentList} from '../../components/Recents'; import {RecentList} from '../../components/Recents';
@@ -21,6 +30,7 @@ import {storage} from '../../../App';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import NavigationService from '../../services/NavigationService'; import NavigationService from '../../services/NavigationService';
import {ScrollView} from 'react-native-gesture-handler'; import {ScrollView} from 'react-native-gesture-handler';
import {useForceUpdate} from '../ListsEditor';
export const Home = ({navigation}) => { export const Home = ({navigation}) => {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
@@ -31,6 +41,7 @@ export const Home = ({navigation}) => {
const [hideHeader, setHideHeader] = useState(false); const [hideHeader, setHideHeader] = useState(false);
const [margin, setMargin] = useState(150); const [margin, setMargin] = useState(150);
const [buttonHide, setButtonHide] = useState(false); const [buttonHide, setButtonHide] = useState(false);
const forceUpdate = useForceUpdate();
let offsetY = 0; let offsetY = 0;
let countUp = 0; let countUp = 0;
let countDown = 0; let countDown = 0;
@@ -43,6 +54,17 @@ export const Home = ({navigation}) => {
}, 1000); }, 1000);
}, []); }, []);
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
const onChangeText = value => { const onChangeText = value => {
setText(value); setText(value);
}; };
@@ -138,10 +160,12 @@ export const Home = ({navigation}) => {
<SafeAreaView <SafeAreaView
style={{ style={{
height: '100%', height: '100%',
backgroundColor: colors.bg,
}}> }}>
<KeyboardAvoidingView <KeyboardAvoidingView
style={{ style={{
height: '100%', height: '100%',
backgroundColor: colors.bg,
}}> }}>
<NavigationEvents <NavigationEvents
onWillFocus={() => { onWillFocus={() => {

View File

@@ -20,18 +20,32 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
clearThemeUpdateListener,
onThemeUpdate,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Feather';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {getElevation} from '../../utils/utils'; import {getElevation} from '../../utils/utils';
import {FlatList, TextInput} from 'react-native-gesture-handler'; import {FlatList, TextInput} from 'react-native-gesture-handler';
import {NavigationEvents} from 'react-navigation'; import {NavigationEvents} from 'react-navigation';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import {useForceUpdate} from '../ListsEditor';
export const Login = ({navigation}) => { export const Login = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
useEffect(() => { useEffect(() => {
DeviceEventEmitter.emit('hide'); DeviceEventEmitter.emit('hide');
return () => { return () => {
@@ -47,7 +61,11 @@ export const Login = ({navigation}) => {
}, []); }, []);
return ( return (
<SafeAreaView> <SafeAreaView
style={{
backgroundColor: colors.bg,
height: '100%',
}}>
<NavigationEvents <NavigationEvents
onWillFocus={() => { onWillFocus={() => {
DeviceEventEmitter.emit('hide'); DeviceEventEmitter.emit('hide');
@@ -102,14 +120,14 @@ const renderLogin = colors => {
onBlur={() => { onBlur={() => {
_email.current.setNativeProps({ _email.current.setNativeProps({
style: { style: {
borderColor: '#f0f0f0', borderColor: colors.nav,
}, },
}); });
}} }}
style={{ style={{
padding: pv, padding: pv,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
marginHorizontal: '5%', marginHorizontal: '5%',
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.md, fontSize: SIZE.md,
@@ -131,14 +149,14 @@ const renderLogin = colors => {
onBlur={() => { onBlur={() => {
_pass.current.setNativeProps({ _pass.current.setNativeProps({
style: { style: {
borderColor: '#f0f0f0', borderColor: colors.nav,
}, },
}); });
}} }}
style={{ style={{
padding: pv, padding: pv,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
marginHorizontal: '5%', marginHorizontal: '5%',
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.md, fontSize: SIZE.md,

View File

@@ -73,7 +73,7 @@ export const Move = ({navigation}) => {
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
paddingHorizontal: ph, paddingHorizontal: ph,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',

View File

@@ -21,6 +21,8 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
@@ -29,6 +31,7 @@ import {Header} from '../../components/header';
import NoteItem from '../../components/NoteItem'; import NoteItem from '../../components/NoteItem';
import {NotebookItem} from '../../components/NotebookItem'; import {NotebookItem} from '../../components/NotebookItem';
import {Search} from '../../components/SearchInput'; import {Search} from '../../components/SearchInput';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
@@ -38,6 +41,7 @@ export const Notebook = ({navigation}) => {
const params = navigation.state.params; const params = navigation.state.params;
const [hideHeader, setHideHeader] = useState(false); const [hideHeader, setHideHeader] = useState(false);
const [margin, setMargin] = useState(150); const [margin, setMargin] = useState(150);
const forceUpdate = useForceUpdate();
let offsetY = 0; let offsetY = 0;
let countUp = 0; let countUp = 0;
let countDown = 0; let countDown = 0;
@@ -57,10 +61,22 @@ export const Notebook = ({navigation}) => {
}, 10); }, 10);
} }
}; };
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{
height: '100%', height: '100%',
backgroundColor: colors.bg,
}}> }}>
<KeyboardAvoidingView <KeyboardAvoidingView
style={{ style={{
@@ -132,7 +148,7 @@ export const Notebook = ({navigation}) => {
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
paddingHorizontal: ph, paddingHorizontal: ph,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
@@ -167,12 +183,10 @@ export const Notebook = ({navigation}) => {
setAddNotebook(true); setAddNotebook(true);
}} }}
style={{ style={{
borderWidth: 1,
borderRadius: 5, borderRadius: 5,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
paddingHorizontal: ph, paddingHorizontal: ph,
borderColor: '#f0f0f0',
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',

View File

@@ -19,19 +19,33 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import {Search} from '../../components/SearchInput'; import {Search} from '../../components/SearchInput';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
export const Notes = ({navigation}) => { export const Notes = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
let params = navigation.state ? navigation.state.params : null; let params = navigation.state ? navigation.state.params : null;
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
useEffect(() => { useEffect(() => {
if (!params) { if (!params) {

View File

@@ -19,21 +19,45 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
setAccentColor,
COLOR_SCHEME_DARK,
COLOR_SCHEME_LIGHT,
setColorScheme,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import {FlatList} from 'react-native-gesture-handler'; import {FlatList} from 'react-native-gesture-handler';
import AsyncStorage from '@react-native-community/async-storage';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
export const Settings = ({navigation}) => { export const Settings = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView> <SafeAreaView
style={{
backgroundColor: colors.bg,
height: '100%',
}}>
<View>
<Header colors={colors} heading="Settings" canGoBack={false} /> <Header colors={colors} heading="Settings" canGoBack={false} />
<FlatList <FlatList
@@ -68,7 +92,7 @@ export const Settings = ({navigation}) => {
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
paddingHorizontal: ph, paddingHorizontal: ph,
borderColor: '#f0f0f0', borderColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'space-between', justifyContent: 'space-between',
@@ -94,7 +118,7 @@ export const Settings = ({navigation}) => {
borderBottomWidth: 1, borderBottomWidth: 1,
width: item.step ? '85%' : '90%', width: item.step ? '85%' : '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
paddingHorizontal: ph, paddingHorizontal: ph,
@@ -107,12 +131,17 @@ export const Settings = ({navigation}) => {
fontSize: item.step ? SIZE.sm : SIZE.md, fontSize: item.step ? SIZE.sm : SIZE.md,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
textAlignVertical: 'center', textAlignVertical: 'center',
color: colors.pri,
}}> }}>
<Icon name={item.icon} size={SIZE.md} /> <Icon name={item.icon} size={SIZE.md} color={colors.icon} />
{' '} {item.name} {' '} {item.name}
</Text> </Text>
{item.switch ? ( {item.switch ? (
<Icon name="toggle-right" size={item.step ? SIZE.sm : SIZE.md} /> <Icon
name="toggle-right"
color={colors.icon}
size={item.step ? SIZE.sm : SIZE.md}
/>
) : null} ) : null}
</TouchableOpacity> </TouchableOpacity>
)} )}
@@ -123,7 +152,7 @@ export const Settings = ({navigation}) => {
borderBottomWidth: 1, borderBottomWidth: 1,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
paddingHorizontal: ph, paddingHorizontal: ph,
@@ -134,6 +163,7 @@ export const Settings = ({navigation}) => {
style={{ style={{
fontSize: SIZE.md, fontSize: SIZE.md,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
color: colors.pri,
}}> }}>
Accent Color Accent Color
</Text> </Text>
@@ -148,7 +178,7 @@ export const Settings = ({navigation}) => {
'#e6194b', '#e6194b',
'#3cb44b', '#3cb44b',
'#ffe119', '#ffe119',
'#1790F3', '#0560FF',
'#f58231', '#f58231',
'#911eb4', '#911eb4',
'#46f0f0', '#46f0f0',
@@ -157,6 +187,13 @@ export const Settings = ({navigation}) => {
'#fabebe', '#fabebe',
].map(item => ( ].map(item => (
<TouchableOpacity <TouchableOpacity
onPress={() => {
setAccentColor(item);
setColorScheme(
colors.night ? COLOR_SCHEME_DARK : COLOR_SCHEME_LIGHT,
);
AsyncStorage.setItem('accentColor', item);
}}
style={{ style={{
flexDirection: 'row', flexDirection: 'row',
justifyContent: 'flex-start', justifyContent: 'flex-start',
@@ -173,7 +210,9 @@ export const Settings = ({navigation}) => {
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
}}> }}>
{colors.accent === item ? (
<Icon size={SIZE.lg} color="white" name="check" /> <Icon size={SIZE.lg} color="white" name="check" />
) : null}
</View> </View>
</TouchableOpacity> </TouchableOpacity>
))} ))}
@@ -186,7 +225,7 @@ export const Settings = ({navigation}) => {
borderBottomWidth: 1, borderBottomWidth: 1,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
paddingHorizontal: ph, paddingHorizontal: ph,
@@ -197,6 +236,7 @@ export const Settings = ({navigation}) => {
style={{ style={{
fontSize: SIZE.md, fontSize: SIZE.md,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
color: colors.pri,
}}> }}>
Terms of Service Terms of Service
</Text> </Text>
@@ -208,7 +248,7 @@ export const Settings = ({navigation}) => {
borderBottomWidth: 1, borderBottomWidth: 1,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
paddingHorizontal: ph, paddingHorizontal: ph,
@@ -219,6 +259,7 @@ export const Settings = ({navigation}) => {
style={{ style={{
fontSize: SIZE.md, fontSize: SIZE.md,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
color: colors.pri,
}}> }}>
Privacy Policy Privacy Policy
</Text> </Text>
@@ -230,7 +271,7 @@ export const Settings = ({navigation}) => {
borderBottomWidth: 1, borderBottomWidth: 1,
width: '90%', width: '90%',
marginHorizontal: '5%', marginHorizontal: '5%',
borderBottomColor: '#f0f0f0', borderBottomColor: colors.nav,
paddingVertical: pv + 5, paddingVertical: pv + 5,
flexDirection: 'row', flexDirection: 'row',
paddingHorizontal: ph, paddingHorizontal: ph,
@@ -241,10 +282,12 @@ export const Settings = ({navigation}) => {
style={{ style={{
fontSize: SIZE.md, fontSize: SIZE.md,
fontFamily: WEIGHT.regular, fontFamily: WEIGHT.regular,
color: colors.pri,
}}> }}>
About Notes. About Notes.
</Text> </Text>
</TouchableOpacity> </TouchableOpacity>
</View>
</SafeAreaView> </SafeAreaView>
); );
}; };

View File

@@ -20,6 +20,8 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
@@ -28,10 +30,22 @@ import {getElevation} from '../../utils/utils';
import {FlatList, TextInput} from 'react-native-gesture-handler'; import {FlatList, TextInput} from 'react-native-gesture-handler';
import {NavigationEvents} from 'react-navigation'; import {NavigationEvents} from 'react-navigation';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import {useForceUpdate} from '../ListsEditor';
export const Signup = ({navigation}) => { export const Signup = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
useEffect(() => { useEffect(() => {
DeviceEventEmitter.emit('hide'); DeviceEventEmitter.emit('hide');
return () => { return () => {
@@ -40,7 +54,11 @@ export const Signup = ({navigation}) => {
}, []); }, []);
return ( return (
<SafeAreaView> <SafeAreaView
style={{
height: '100%',
backgroundColor: colors.bg,
}}>
<NavigationEvents <NavigationEvents
onWillFocus={() => { onWillFocus={() => {
DeviceEventEmitter.emit('hide'); DeviceEventEmitter.emit('hide');
@@ -95,14 +113,14 @@ const renderSignup = colors => {
onBlur={() => { onBlur={() => {
_email.current.setNativeProps({ _email.current.setNativeProps({
style: { style: {
borderColor: '#f0f0f0', borderColor: colors.nav,
}, },
}); });
}} }}
style={{ style={{
padding: pv, padding: pv,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
marginHorizontal: '5%', marginHorizontal: '5%',
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.md, fontSize: SIZE.md,
@@ -124,14 +142,14 @@ const renderSignup = colors => {
onBlur={() => { onBlur={() => {
_pass.current.setNativeProps({ _pass.current.setNativeProps({
style: { style: {
borderColor: '#f0f0f0', borderColor: colors.nav,
}, },
}); });
}} }}
style={{ style={{
padding: pv, padding: pv,
borderWidth: 1.5, borderWidth: 1.5,
borderColor: '#f0f0f0', borderColor: colors.nav,
marginHorizontal: '5%', marginHorizontal: '5%',
borderRadius: 5, borderRadius: 5,
fontSize: SIZE.md, fontSize: SIZE.md,

View File

@@ -20,19 +20,33 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
onThemeUpdate,
clearThemeUpdateListener,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Ionicons'; import Icon from 'react-native-vector-icons/Ionicons';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import NoteItem from '../../components/NoteItem'; import NoteItem from '../../components/NoteItem';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
export const Tags = ({navigation}) => { export const Tags = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView <SafeAreaView
style={{ style={{

View File

@@ -20,21 +20,38 @@ import {
opacity, opacity,
FONT, FONT,
WEIGHT, WEIGHT,
clearThemeUpdateListener,
onThemeUpdate,
} from '../../common/common'; } from '../../common/common';
import Icon from 'react-native-vector-icons/Feather'; import Icon from 'react-native-vector-icons/Feather';
import {Reminder} from '../../components/Reminder'; import {Reminder} from '../../components/Reminder';
import {ListItem} from '../../components/ListItem'; import {ListItem} from '../../components/ListItem';
import {Header} from '../../components/header'; import {Header} from '../../components/header';
import NoteItem from '../../components/NoteItem'; import NoteItem from '../../components/NoteItem';
import {useForceUpdate} from '../ListsEditor';
const w = Dimensions.get('window').width; const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height; const h = Dimensions.get('window').height;
export const Trash = ({navigation}) => { export const Trash = ({navigation}) => {
const [colors, setColors] = useState(COLOR_SCHEME); const [colors, setColors] = useState(COLOR_SCHEME);
const forceUpdate = useForceUpdate();
useEffect(() => {
onThemeUpdate(() => {
forceUpdate();
});
return () => {
clearThemeUpdateListener(() => {
forceUpdate();
});
};
}, []);
return ( return (
<SafeAreaView> <SafeAreaView
style={{
backgroundColor: colors.bg,
}}>
<Header colors={colors} heading="Trash" canGoBack={false} /> <Header colors={colors} heading="Trash" canGoBack={false} />
<FlatList <FlatList
numColumns={2} numColumns={2}