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

Update secondary screen background color #2205

Merged
merged 1 commit into from
Nov 1, 2022
Merged
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
37 changes: 22 additions & 15 deletions packages/mobile/src/components/core/Screen/Screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,21 @@ import { SecondaryScreenTitle } from './SecondaryScreenTitle'
const removeUndefined = (object: Record<string, unknown>) =>
pickBy(object, negate(isUndefined))

const useStyles = makeStyles(({ palette }, { variant }) => ({
root: {
flex: 1,
backgroundColor:
variant === 'primary'
? palette.background
: variant === 'secondary'
? palette.backgroundSecondary
: palette.white
}
}))
const useStyles = makeStyles(
({ palette }, { variant, isNavOverhaulEnabled }) => ({
root: {
flex: 1,
backgroundColor:
variant === 'primary'
? palette.background
: variant === 'secondary' && !isNavOverhaulEnabled
? palette.backgroundSecondary
: variant === 'secondary' && isNavOverhaulEnabled
? palette.background
: palette.white
}
})
)

export type ScreenProps = {
children: ReactNode
Expand Down Expand Up @@ -59,13 +63,16 @@ export const Screen = (props: ScreenProps) => {
variant = 'primary',
style
} = props
const stylesConfig = useMemo(() => ({ variant }), [variant])
const styles = useStyles(stylesConfig)
const navigation = useNavigation()
const isSecondary = variant === 'secondary' || variant === 'white'
const { isEnabled: isNavOverhaulEnabled } = useFeatureFlag(
FeatureFlags.MOBILE_NAV_OVERHAUL
)
const stylesConfig = useMemo(
() => ({ variant, isNavOverhaulEnabled }),
[variant, isNavOverhaulEnabled]
)
const styles = useStyles(stylesConfig)
const navigation = useNavigation()
const isSecondary = variant === 'secondary' || variant === 'white'

// Record screen view
useEffect(() => {
Expand Down