Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

SafeAreaView Background Color Not Changing with Theme #447

Closed
neverson-silva opened this issue Sep 19, 2023 · 1 comment
Closed

SafeAreaView Background Color Not Changing with Theme #447

neverson-silva opened this issue Sep 19, 2023 · 1 comment
Assignees

Comments

@neverson-silva
Copy link

neverson-silva commented Sep 19, 2023

Problem

When applying the GlueStack styling to a SafeAreaView component in React Native, the background color is not changing correctly based on the theme. In these particular example, it should be green for the light theme and blue for the dark theme, but this behavior is not being observed.

Same behavior on android and ios.

Expected Behavior

  • In the light theme, the SafeAreaView background color should be green.
  • In the dark theme, the SafeAreaView background color should be blue.

Steps to Reproduce

  1. Import SafeAreaView from 'react-native' and apply GlueStack styling as shown in the code snippet below.
  2. Set the theme to light and render the SafeAreaView.
  3. Observe the background color.
import { SafeAreaView as RNSafeAreaView } from 'react-native'
import { styled } from '@gluestack-style/react'

export const SafeAreaView = styled(RNSafeAreaView, {
  flex: 1,
  _light: {
    backgroundColor: 'green',
  },
  _dark: {
    backgroundColor: 'blue',
  },
})

safe area view

@neverson-silva
Copy link
Author

I managed to make it work, it turns out I didn't configure the colorMode

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants