Skip to content

Commit

Permalink
Include safeAreaInset bottom to HomeSceneUi4
Browse files Browse the repository at this point in the history
It looks like the SceneWrapper is incorrectly applying padding to scenes
with tabs, but rather than fixing the SceneWrapper which is high-risk,
just apply the padding manually.
  • Loading branch information
samholmes committed Jan 26, 2024
1 parent f623aa1 commit 3ffdc75
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/components/ui4/scenes/HomeSceneUi4.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react'
import { View } from 'react-native'
import FastImage from 'react-native-fast-image'
import Animated from 'react-native-reanimated'
import { useSafeAreaFrame } from 'react-native-safe-area-context'
import { useSafeAreaFrame, useSafeAreaInsets } from 'react-native-safe-area-context'

import { showBackupForTransferModal } from '../../../actions/BackupModalActions'
import { useHandler } from '../../../hooks/useHandler'
Expand Down Expand Up @@ -39,12 +39,19 @@ export const HomeSceneUi4 = (props: Props) => {

const { width: screenWidth } = useSafeAreaFrame()

// TODO: Include this fix in the SceneWrapper component
const safeAreaInsets = useSafeAreaInsets()

// Evenly distribute the home cards into 4 quadrants:
const cardSize = screenWidth / 2 - theme.rem(TEMP_PADDING_REM)

const account = useSelector(state => state.core.account)
const isLightAccount = account.username == null

//
// Handlers
//

const handleBuyPress = useHandler(() => {
if (isLightAccount) {
showBackupForTransferModal(() => navigation.navigate('upgradeUsername', {}))
Expand Down Expand Up @@ -83,7 +90,12 @@ export const HomeSceneUi4 = (props: Props) => {
{({ insetStyle, undoInsetStyle }) => (
<>
<WiredProgressBar />
<Animated.ScrollView onScroll={handleScroll} style={undoInsetStyle} contentContainerStyle={[insetStyle]} scrollIndicatorInsets={{ right: 1 }}>
<Animated.ScrollView
onScroll={handleScroll}
style={undoInsetStyle}
contentContainerStyle={[{ ...insetStyle, paddingBottom: insetStyle.paddingBottom + safeAreaInsets.bottom }]}
scrollIndicatorInsets={{ right: 1 }}
>
<SectionView extendRight marginRem={TEMP_PADDING_REM}>
<>
<EdgeAnim enter={{ type: 'fadeInUp', distance: 140 }}>
Expand Down

0 comments on commit 3ffdc75

Please sign in to comment.