1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00

A lot of updates

This commit is contained in:
Zhiyuan Zheng
2020-12-01 00:44:28 +01:00
parent 0e3528d2cd
commit 9bfee02484
18 changed files with 463 additions and 279 deletions

View File

@ -1,5 +1,5 @@
import React, { createContext, useContext, useEffect, useState } from 'react'
import { Appearance } from 'react-native-appearance'
import { useColorScheme } from 'react-native-appearance'
import { useSelector } from 'react-redux'
import { ColorDefinitions, getTheme } from 'src/utils/styles/themes'
import { getSettingsTheme } from '../slices/settingsSlice'
@ -19,11 +19,10 @@ export const ManageThemeContext = createContext<ContextType>({
export const useTheme = () => useContext(ManageThemeContext)
const ThemeManager: React.FC = ({ children }) => {
const osTheme = useColorScheme()
const userTheme = useSelector(getSettingsTheme)
const currentMode =
userTheme === 'auto'
? (Appearance.getColorScheme() as 'light' | 'dark')
: userTheme
userTheme === 'auto' ? (osTheme as 'light' | 'dark') : userTheme
const [mode, setMode] = useState(currentMode)

View File

@ -4,9 +4,10 @@ export const StyleConstants = {
Font: {
Size: {
S: 12,
M: 14,
M: 16,
L: 18
},
LineHeight: { M: 20 },
Weight: {
Bold: '600' as '600'
}
@ -19,7 +20,7 @@ export const StyleConstants = {
L: Base * 6,
XL: Base * 10,
Global: {
PagePadding: Base * 6
PagePadding: Base * 4
}
},