Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure screens that are bottom sheets scroll correctly #5062

Merged
merged 4 commits into from
Mar 8, 2024

Conversation

kathaypacific
Copy link
Collaborator

Description

Context https://valora-app.slack.com/archives/C025V1D6F3J/p1709855852378389

The bottom sheet screens were not scrolling correctly, this was probably a regression but unnoticed because most of these screens do not require scrolling. Root cause is a known issue that is documented in a comment in the Navigator - we need to use the react-native-gesture-handler components to scroll inside bottom sheet screens.

This PR adds a prop to the BottomSheetScrollView component to use the correct scrollview component.

Test plan

Scrolling content:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2024-03-08.at.11.07.42.mp4

Short content:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2024-03-08.at.11.08.02.mp4

Tested also on the WC flow.

Related issues

  • n/a

Backwards compatibility

Y

Network scalability

Y

// use max height simulate max 90% snap point for screens. when bottom sheets
// take up the whole screen, it is no longer obvious that they are a bottom
// sheet / how to navigate away
const maxHeight = isScreen ? variables.height * 0.9 : undefined
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

annoyingly i couldn't find a better way to set the snappoints to be dynamic + set an upper bound on the height

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.53%. Comparing base (1850e60) to head (8f6b885).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5062   +/-   ##
=======================================
  Coverage   85.53%   85.53%           
=======================================
  Files         721      721           
  Lines       29413    29422    +9     
  Branches     5083     5085    +2     
=======================================
+ Hits        25159    25167    +8     
- Misses       4021     4022    +1     
  Partials      233      233           
Files Coverage Δ
src/components/BottomSheet.tsx 93.54% <100.00%> (ø)
src/components/BottomSheetScrollView.tsx 84.61% <100.00%> (+8.14%) ⬆️
src/dapps/DappShortcutTransactionRequest.tsx 91.48% <ø> (ø)
.../fiatExchanges/FiatExchangeCurrencyBottomSheet.tsx 88.37% <ø> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1850e60...8f6b885. Read the comment docs.

Copy link
Member

@jeanregisser jeanregisser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

// Navigator. It is still handy for screens and components to share this
// component for the styling and layout logic.
// https://github.com/osdnk/react-native-reanimated-bottom-sheet/issues/264#issuecomment-674757545
const ScrollViewComponent = isScreen ? ScrollView : GorhomBottomSheetScrollView
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if we use the RNGH ScrollView everywhere?
Does it break any gesture? Maybe the overscroll to dismiss?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is the overscroll to dismiss that is not available with ScrollView. i updated the comment to be more clear about this. it's annoying that this is an issue, but i think the overscroll / bottom sheet gestures are probably the thing preventing the BottomSheetScrollView to work correctly from the navigator


interface Props {
containerStyle?: StyleProp<ViewStyle>
testId?: string
forwardedRef?: React.RefObject<ScrollView>
isScreen?: boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a small comment to explain when/why this is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes updated

@kathaypacific kathaypacific added this pull request to the merge queue Mar 8, 2024
Merged via the queue into main with commit 36a4715 Mar 8, 2024
16 checks passed
@kathaypacific kathaypacific deleted the kathy/fix-cash-in-bottom-sheet branch March 8, 2024 16:29
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
…nc#5062)

### Description

Context
https://valora-app.slack.com/archives/C025V1D6F3J/p1709855852378389

The bottom sheet screens were not scrolling correctly, this was probably
a regression but unnoticed because most of these screens do not require
scrolling. Root cause is a known issue that is documented in a comment
in the Navigator - we need to use the react-native-gesture-handler
components to scroll inside bottom sheet screens.

This PR adds a prop to the BottomSheetScrollView component to use the
correct scrollview component.

### Test plan

Scrolling content:


https://github.com/valora-inc/wallet/assets/20150449/349c2628-017c-46b1-af88-06d20bcb19ce



Short content:


https://github.com/valora-inc/wallet/assets/20150449/5929f8f9-08f1-495f-8131-211cd055fbdb



Tested also on the WC flow.


### Related issues

- n/a

### Backwards compatibility

Y

### Network scalability

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

Successfully merging this pull request may close these issues.

None yet

2 participants