Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const AppWrapper = () => {

const subscription = Appearance.addChangeListener(
({colorScheme: newScheme}) => {
if (colorScheme === null) {
if (!colorScheme || colorScheme === 'unspecified') {
setIsDark(newScheme === 'dark');
}
},
Expand Down
10 changes: 8 additions & 2 deletions src/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ const StartupGate = () => {
const appColorScheme = useAppSelector(({APP}) => APP.colorScheme);
const hasRoutedRef = useRef(false);

const scheme = appColorScheme || Appearance.getColorScheme();
const scheme =
!appColorScheme || appColorScheme === 'unspecified'
? Appearance.getColorScheme()
: appColorScheme;
const theme = scheme === 'dark' ? BitPayDarkTheme : BitPayLightTheme;

useEffect(() => {
Expand Down Expand Up @@ -692,7 +695,10 @@ export default () => {
patchLogger(Logger);
}, []);

const scheme = appColorScheme || Appearance.getColorScheme();
const scheme =
!appColorScheme || appColorScheme === 'unspecified'
? Appearance.getColorScheme()
: appColorScheme;
const theme = scheme === 'dark' ? BitPayDarkTheme : BitPayLightTheme;

return (
Expand Down
13 changes: 8 additions & 5 deletions src/navigation/tabs/settings/general/screens/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ const ThemeSettings: React.FC<Props> = ({navigation}) => {

const onSetThemePress = (setScheme: ColorSchemeName) => {
dispatch(AppActions.setColorScheme(setScheme));
logManager.info('Theme updated to ' + (setScheme || 'system default'));
logManager.info(
'Theme updated to ' +
(setScheme === 'unspecified' ? 'system default' : setScheme),
);
dispatch(
Analytics.track('Saved Theme', {
theme: setScheme || 'system default',
theme: setScheme === 'unspecified' ? 'system default' : setScheme,
}),
);
};
Expand All @@ -120,12 +123,12 @@ const ThemeSettings: React.FC<Props> = ({navigation}) => {
/>
</Setting>
<Hr />
<Setting onPress={() => onSetThemePress(null)}>
<Setting onPress={() => onSetThemePress('unspecified')}>
<SettingTitle>{t('System Default')}</SettingTitle>
<Checkbox
radio
onPress={() => onSetThemePress(null)}
checked={currentTheme === null}
onPress={() => onSetThemePress('unspecified')}
checked={!currentTheme || currentTheme === 'unspecified'}
/>
</Setting>
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/store/app/app.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const initialState: AppState = {
currentSalt: undefined,
pinBannedUntil: undefined,
showBlur: false,
colorScheme: null as unknown as ColorSchemeName,
colorScheme: 'unspecified',
defaultLanguage: i18n.language || 'en',
showPortfolioValue: true,
hideAllBalances: false,
Expand Down
6 changes: 5 additions & 1 deletion src/store/wallet/effects/import/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,11 @@ export const startMigration =
if (theme) {
dispatch(
setColorScheme(
theme.system ? null : theme.name === 'light' ? 'light' : 'dark',
theme.system
? 'unspecified'
: theme.name === 'light'
? 'light'
: 'dark',
),
);
}
Expand Down
Loading