set proper content style to fix background color (#2575)

* set the proper content style

* lint
This commit is contained in:
Hailey 2024-01-19 16:13:29 -08:00 committed by GitHub
parent 5522b581ec
commit 89607d90aa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,5 +1,4 @@
import * as React from 'react' import * as React from 'react'
import {StyleSheet} from 'react-native'
import { import {
NavigationContainer, NavigationContainer,
createNavigationContainerRef, createNavigationContainerRef,
@ -25,7 +24,6 @@ import {
import {BottomBar} from './view/shell/bottom-bar/BottomBar' import {BottomBar} from './view/shell/bottom-bar/BottomBar'
import {buildStateObject} from 'lib/routes/helpers' import {buildStateObject} from 'lib/routes/helpers'
import {State, RouteParams} from 'lib/routes/types' import {State, RouteParams} from 'lib/routes/types'
import {colors} from 'lib/styles'
import {isAndroid, isNative} from 'platform/detection' import {isAndroid, isNative} from 'platform/detection'
import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle' import {useColorSchemeStyle} from 'lib/hooks/useColorSchemeStyle'
import {router} from './routes' import {router} from './routes'
@ -299,7 +297,7 @@ function TabsNavigator() {
} }
function HomeTabNavigator() { function HomeTabNavigator() {
const contentStyle = useColorSchemeStyle(styles.bgLight, styles.bgDark) const pal = usePalette('default')
return ( return (
<HomeTab.Navigator <HomeTab.Navigator
@ -309,7 +307,7 @@ function HomeTabNavigator() {
fullScreenGestureEnabled: true, fullScreenGestureEnabled: true,
headerShown: false, headerShown: false,
animationDuration: 250, animationDuration: 250,
contentStyle, contentStyle: pal.view,
}}> }}>
<HomeTab.Screen <HomeTab.Screen
name="Home" name="Home"
@ -322,7 +320,7 @@ function HomeTabNavigator() {
} }
function SearchTabNavigator() { function SearchTabNavigator() {
const contentStyle = useColorSchemeStyle(styles.bgLight, styles.bgDark) const pal = usePalette('default')
return ( return (
<SearchTab.Navigator <SearchTab.Navigator
screenOptions={{ screenOptions={{
@ -331,7 +329,7 @@ function SearchTabNavigator() {
fullScreenGestureEnabled: true, fullScreenGestureEnabled: true,
headerShown: false, headerShown: false,
animationDuration: 250, animationDuration: 250,
contentStyle, contentStyle: pal.view,
}}> }}>
<SearchTab.Screen name="Search" getComponent={() => SearchScreen} /> <SearchTab.Screen name="Search" getComponent={() => SearchScreen} />
{commonScreens(SearchTab as typeof HomeTab)} {commonScreens(SearchTab as typeof HomeTab)}
@ -340,7 +338,7 @@ function SearchTabNavigator() {
} }
function FeedsTabNavigator() { function FeedsTabNavigator() {
const contentStyle = useColorSchemeStyle(styles.bgLight, styles.bgDark) const pal = usePalette('default')
return ( return (
<FeedsTab.Navigator <FeedsTab.Navigator
screenOptions={{ screenOptions={{
@ -349,7 +347,7 @@ function FeedsTabNavigator() {
fullScreenGestureEnabled: true, fullScreenGestureEnabled: true,
headerShown: false, headerShown: false,
animationDuration: 250, animationDuration: 250,
contentStyle, contentStyle: pal.view,
}}> }}>
<FeedsTab.Screen <FeedsTab.Screen
name="Feeds" name="Feeds"
@ -362,7 +360,7 @@ function FeedsTabNavigator() {
} }
function NotificationsTabNavigator() { function NotificationsTabNavigator() {
const contentStyle = useColorSchemeStyle(styles.bgLight, styles.bgDark) const pal = usePalette('default')
return ( return (
<NotificationsTab.Navigator <NotificationsTab.Navigator
screenOptions={{ screenOptions={{
@ -371,7 +369,7 @@ function NotificationsTabNavigator() {
fullScreenGestureEnabled: true, fullScreenGestureEnabled: true,
headerShown: false, headerShown: false,
animationDuration: 250, animationDuration: 250,
contentStyle, contentStyle: pal.view,
}}> }}>
<NotificationsTab.Screen <NotificationsTab.Screen
name="Notifications" name="Notifications"
@ -384,7 +382,7 @@ function NotificationsTabNavigator() {
} }
function MyProfileTabNavigator() { function MyProfileTabNavigator() {
const contentStyle = useColorSchemeStyle(styles.bgLight, styles.bgDark) const pal = usePalette('default')
return ( return (
<MyProfileTab.Navigator <MyProfileTab.Navigator
screenOptions={{ screenOptions={{
@ -393,7 +391,7 @@ function MyProfileTabNavigator() {
fullScreenGestureEnabled: true, fullScreenGestureEnabled: true,
headerShown: false, headerShown: false,
animationDuration: 250, animationDuration: 250,
contentStyle, contentStyle: pal.view,
}}> }}>
<MyProfileTab.Screen <MyProfileTab.Screen
// @ts-ignore // TODO: fix this broken type in ProfileScreen // @ts-ignore // TODO: fix this broken type in ProfileScreen
@ -424,7 +422,7 @@ const FlatNavigator = () => {
fullScreenGestureEnabled: true, fullScreenGestureEnabled: true,
headerShown: false, headerShown: false,
animationDuration: 250, animationDuration: 250,
contentStyle: [pal.view], contentStyle: pal.view,
}}> }}>
<Flat.Screen <Flat.Screen
name="Home" name="Home"
@ -620,15 +618,6 @@ function handleLink(url: string) {
} }
} }
const styles = StyleSheet.create({
bgDark: {
backgroundColor: colors.black,
},
bgLight: {
backgroundColor: colors.white,
},
})
let didInit = false let didInit = false
function logModuleInitTime() { function logModuleInitTime() {
if (didInit) { if (didInit) {