minor tweaks
This commit is contained in:
parent
ce48ef06a4
commit
63b49abfab
|
@ -14,10 +14,6 @@ class UserPreferences {
|
||||||
this.mmkv = MMKV;
|
this.mmkv = MMKV;
|
||||||
}
|
}
|
||||||
|
|
||||||
getMMKV() {
|
|
||||||
return this.mmkv;
|
|
||||||
}
|
|
||||||
|
|
||||||
getString<T = string>(key: string) {
|
getString<T = string>(key: string) {
|
||||||
try {
|
try {
|
||||||
return (this.mmkv.getString(key) as T) ?? null;
|
return (this.mmkv.getString(key) as T) ?? null;
|
||||||
|
|
|
@ -6,16 +6,13 @@ export default () =>
|
||||||
(createStore: any) =>
|
(createStore: any) =>
|
||||||
(...args: any) => {
|
(...args: any) => {
|
||||||
const store = createStore(...args);
|
const store = createStore(...args);
|
||||||
|
|
||||||
let currentType: NetInfoStateType | undefined;
|
let currentType: NetInfoStateType | undefined;
|
||||||
|
|
||||||
const handleInternetStateChange = (nextState: NetInfoState) => {
|
const handleInternetStateChange = (nextState: NetInfoState) => {
|
||||||
if (nextState.type !== currentType) {
|
if (nextState.type !== currentType) {
|
||||||
store.dispatch(setInternetType(nextState.type));
|
store.dispatch(setInternetType(nextState.type));
|
||||||
currentType = nextState.type;
|
currentType = nextState.type;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NetInfo.addEventListener(handleInternetStateChange);
|
NetInfo.addEventListener(handleInternetStateChange);
|
||||||
return store;
|
return store;
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,6 +65,8 @@ const ListPicker = ({
|
||||||
onPress={() => showActionSheet({ options: getOptions() })}
|
onPress={() => showActionSheet({ options: getOptions() })}
|
||||||
right={() => (
|
right={() => (
|
||||||
<Text style={[styles.title, { color: colors.actionTintColor }]}>
|
<Text style={[styles.title, { color: colors.actionTintColor }]}>
|
||||||
|
{/* when picking an option the label should be Never
|
||||||
|
but when showing among the other settings the label should be Off */}
|
||||||
{option.label === 'Never' ? I18n.t('Off') : I18n.t(option.label)}
|
{option.label === 'Never' ? I18n.t('Off') : I18n.t(option.label)}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
|
|
Loading…
Reference in New Issue