reading app theme on startup

This commit is contained in:
Nouman Tahir 2022-04-15 17:34:38 +05:00
parent 562623da9e
commit b215d91310
2 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import { Component } from 'react';
import { Platform, BackHandler, Alert, Linking, AppState } from 'react-native';
import { Platform, BackHandler, Alert, Linking, AppState, Appearance } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import Config from 'react-native-config';
import get from 'lodash/get';
@ -787,7 +787,7 @@ class ApplicationContainer extends Component {
const settings = await getSettings();
if (settings) {
const isDarkMode = false; //useDarkMode();
const isDarkMode = Appearance.getColorScheme() === 'dark';
dispatch(isDarkTheme(settings.isDarkTheme !== null ? settings.isDarkTheme : isDarkMode));
this.setState({
isThemeReady: true,

View File

@ -1,11 +1,10 @@
import React from 'react';
import { View } from 'react-native';
import { View, Appearance } from 'react-native';
import LottieView from 'lottie-react-native';
import { useDarkMode } from 'react-native-dynamic';
import styles from './launchStyles';
const LaunchScreen = () => {
const isDarkMode = useDarkMode();
const isDarkMode = Appearance.getColorScheme() === 'dark';
return (
<View style={isDarkMode ? styles.darkContainer : styles.container}>
<LottieView