π Title
Fix `InvestScreen` layout β triple nesting causes scroll conflict, double top inset, and amount display truncation
π Description
`InvestScreen` is wrapped inside `MainLayout`, creating three separate layout conflicts:
Bug 1 β Double SafeAreaView (extra blank space at top):
`MainLayout` applies `` AND `InvestScreen` has its own `<SafeAreaView edges={['top']}>`. The top inset is applied twice, adding a large blank gap above the screen content.
Bug 2 β Nested KeyboardAvoidingViews (unpredictable keyboard offset):
`MainLayout` has `` and `InvestScreen` has its own with `keyboardVerticalOffset={0}`. Both use `behavior="padding"` on iOS. Nested KAVs stack their offsets β when the deposit input is focused, content jumps by an incorrect amount.
Bug 3 β Nested ScrollViews (scroll conflict + amount truncation):
`MainLayout` wraps `{children}` in a `` and `InvestScreen` has its own inner ``. React Native does not support nested ScrollViews in the same scroll direction. The deposit amount text is truncated because the inner ScrollView is constrained by the outer one and cannot calculate its own height correctly.
Bug 4 β Unintended outer scroll:
The user reported the home screen has scroll β this is the `MainLayout` ScrollView making the entire screen (including the header) scroll, which feels wrong. The header should be fixed; only the content area should scroll.
β
Tasks to complete
π Documentation/context for AI
https://github.com/TrustUp-app/TrustUp-Frontend/tree/main/docs
Files to modify:
- `components/pages/InvestScreen.tsx`
- `components/shared/MainLayout.tsx`
- `hooks/invest/use-invest.ts` (minor β wire formatCurrency)
ποΈ Additional notes
- The fix is structural β do not add workarounds like negative margins or absolute positioning to compensate for the double inset
- After removing SafeAreaView from InvestScreen, test on a physical device with a notch (iPhone with Dynamic Island) to confirm top content is not hidden
- The header in `MainLayout` (greeting, settings icon, avatar) must remain fixed at the top β it should NOT scroll with content
- `InvestScreen` content (cards, deposit input) should scroll independently if content overflows the screen height
π Title
Fix `InvestScreen` layout β triple nesting causes scroll conflict, double top inset, and amount display truncation
π Description
`InvestScreen` is wrapped inside `MainLayout`, creating three separate layout conflicts:
Bug 1 β Double SafeAreaView (extra blank space at top):
`MainLayout` applies `` AND `InvestScreen` has its own `<SafeAreaView edges={['top']}>`. The top inset is applied twice, adding a large blank gap above the screen content.
Bug 2 β Nested KeyboardAvoidingViews (unpredictable keyboard offset):
`MainLayout` has `` and `InvestScreen` has its own with `keyboardVerticalOffset={0}`. Both use `behavior="padding"` on iOS. Nested KAVs stack their offsets β when the deposit input is focused, content jumps by an incorrect amount.
Bug 3 β Nested ScrollViews (scroll conflict + amount truncation):
`MainLayout` wraps `{children}` in a `` and `InvestScreen` has its own inner ``. React Native does not support nested ScrollViews in the same scroll direction. The deposit amount text is truncated because the inner ScrollView is constrained by the outer one and cannot calculate its own height correctly.
Bug 4 β Unintended outer scroll:
The user reported the home screen has scroll β this is the `MainLayout` ScrollView making the entire screen (including the header) scroll, which feels wrong. The header should be fixed; only the content area should scroll.
β Tasks to complete
π Documentation/context for AI
https://github.com/TrustUp-app/TrustUp-Frontend/tree/main/docs
Files to modify:
ποΈ Additional notes