-
-
Notifications
You must be signed in to change notification settings - Fork 595
fix(Android, Stack): Fix formSheet - SafeAreaView integration #3336
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
Open
t0maboro
wants to merge
28
commits into
main
Choose a base branch
from
@t0maboro/form-sheet-flex-end
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 27 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
b3e2bf8
Add maxAllowedHeight
t0maboro c07da25
Add test
t0maboro 373ebda
Prevent insets consumption in sheet
t0maboro 055d5b6
Add prop for disabling SAV for formSheet
t0maboro bb2d294
Aggregate conditions in 1 place
t0maboro ab90c3d
Fix top inset consumption
t0maboro ebb96bf
Remove duplicated SAV logic
t0maboro 9a1895e
Simplify
t0maboro dbe14d4
Recalculate layout for fitToContents
t0maboro 4178765
Drop flex style for fitToContents
t0maboro 98ee330
Rename test
t0maboro bed864a
Minor refactor for new prop
t0maboro d0fb8ee
Correct insets consumption
t0maboro 108c194
Add doc
t0maboro 2ee627c
Update doc
t0maboro bbab6f5
Respect partial statusBar insets
t0maboro c1b93d9
Metrics for fitToContents
t0maboro 72f1489
Move SAV to application
t0maboro 5277f63
Override flex for fitToContents
t0maboro 9e7ef61
Make test more configurable
t0maboro 96cbeb7
Add comment
t0maboro 638d4d1
Create BottomSheetMetrics
t0maboro 76ef71f
Add comment
t0maboro f94d051
Linter
t0maboro 94a267a
Update app
t0maboro 961a119
Handle sheet metrics for non formSheet screen
t0maboro 133378f
Update example
t0maboro 1f05c0c
Require
t0maboro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
android/src/main/java/com/swmansion/rnscreens/bottomsheet/BottomSheetMetrics.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package com.swmansion.rnscreens.bottomsheet | ||
|
|
||
| import com.swmansion.rnscreens.Screen | ||
|
|
||
| data class BottomSheetMetrics( | ||
| val availableHeight: Int, | ||
| val maxDetent: Double, | ||
| val maxSheetHeight: Int, | ||
| ) | ||
|
|
||
| fun getSheetMetrics( | ||
| screen: Screen, | ||
| availableHeight: Int, | ||
| sheetHeight: Int, | ||
| ): BottomSheetMetrics? { | ||
| if (!screen.usesFormSheetPresentation()) { | ||
| return null | ||
| } | ||
|
|
||
| val maxDetent = screen.sheetDetents.lastOrNull() ?: 1.0 | ||
|
|
||
| val maxSheetHeight = | ||
| when { | ||
| screen.isSheetFitToContents() -> sheetHeight | ||
| else -> (availableHeight * maxDetent).toInt() | ||
| } | ||
|
|
||
| return BottomSheetMetrics( | ||
| availableHeight = availableHeight, | ||
| maxDetent = maxDetent, | ||
| maxSheetHeight = maxSheetHeight, | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.