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

Commit

Permalink
Update secondary screen background color (#2205)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers committed Nov 1, 2022
1 parent 4367758 commit e118c2f
Showing 1 changed file with 22 additions and 15 deletions.
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

0 comments on commit e118c2f

Please sign in to comment.