Repository navigation
[CP Staging] Fix: Android edge-to-edge related inset/padding issues #53223
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
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
dbcaad9
fix: adjust ios and android safe area insets padding style
chrispader b011c91
fix: extract Android specific safe area logic and simplify safe area …
chrispader edcdfbe
fix: bottom inset spacing on IOURequestStepConfirmation screen
chrispader 9aa9b50
fix: make IOU submit button spacing consistent
chrispader d9ae806
fix: MoneyRequestConfirmationList bottom padding
chrispader d5f53d1
fix: useSafeAreaInsets hook
chrispader c52550f
fix: bottom insets/padding in "New chat"
chrispader a543d86
fix: padding broken in other forms
chrispader fef2955
Merge branch 'main' into @chrispader/fix-53161
chrispader 8a6d727
fix: linting
chrispader 62297e2
fix: adjust android insets percentage
chrispader ff72555
fix: improve more screens
chrispader ae74a60
refactor: implement better inset and padding handling in ScreenWrapper
chrispader cabc507
Merge branch 'main' into @chrispader/screen-wrapper-better-inset-padd…
chrispader 7ebc864
Merge branch 'main' into @chrispader/fix-53161
chrispader 71c00f1
feat: add useEdgeSpacing hook
chrispader 33c2afa
fix: set inset bottom to 0 if keyboard is open
chrispader 692d96c
Merge branch '@chrispader/screen-wrapper-better-inset-padding-handlin…
chrispader aa31378
Revert "Merge branch '@chrispader/screen-wrapper-better-inset-padding…
chrispader c50e214
fix: new chat confirm page
chrispader 605c404
fix: video controls on native
chrispader 6eb84c5
fix: new chat confirm page
chrispader e3b589b
fix: improve video player insets
chrispader 8748e79
fix: remove useKeyboardState hook usage
chrispader 30483a8
fix: simplify fixes
chrispader 08e9a18
fix: remaining bugs
chrispader 50e3290
fix: iou confirmation
chrispader 1aff99c
fix: remove unnecessary change
chrispader 7e411ab
fix: use full insets on android
chrispader 6cbbf31
fix: new chat
chrispader c75fd3c
fix: simplify iou request confirmation
chrispader 4761ed5
add insetsPercentage parameter to useStyledSafeAreaInsets hook
chrispader e44e493
fix: remove unused code
chrispader 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 was deleted.
Oops, something went wrong.
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
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
9 changes: 4 additions & 5 deletions
9
src/hooks/useSafeAreaInsets/index.android.ts → src/hooks/useSafeAreaInsets.ts
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 |
|---|---|---|
| @@ -1,15 +1,14 @@ | ||
| import type {EdgeInsets} from 'react-native-safe-area-context'; | ||
| // eslint-disable-next-line no-restricted-imports | ||
| import {useSafeAreaInsets as useSafeAreaInsetsInternal} from 'react-native-safe-area-context'; | ||
| import StatusBar from '@libs/StatusBar'; | ||
| import useStyleUtils from './useStyleUtils'; | ||
|
|
||
| function useSafeAreaInsets(): EdgeInsets { | ||
| const StyleUtils = useStyleUtils(); | ||
| const insets = useSafeAreaInsetsInternal(); | ||
| const adjustedInsets = StyleUtils.getSafeAreaInsets(insets); | ||
|
|
||
| return { | ||
| ...insets, | ||
| top: StatusBar.currentHeight ?? insets.top, | ||
| }; | ||
| return adjustedInsets; | ||
| } | ||
|
|
||
| export default useSafeAreaInsets; |
This file was deleted.
Oops, something went wrong.
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
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
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
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 |
|---|---|---|
|
|
@@ -543,7 +543,7 @@ function IOURequestStepDistance({ | |
| allowBubble | ||
| pressOnEnter | ||
| large | ||
| style={[styles.w100, styles.mb4, styles.ph4, styles.flexShrink0]} | ||
| style={[styles.w100, styles.mb5, styles.ph4, styles.flexShrink0]} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While handling missing styles, we missed noticing the size mismatch for |
||
| onPress={submitWaypoints} | ||
| text={buttonText} | ||
| isLoading={!isOffline && (isLoadingRoute || shouldFetchRoute || isLoading)} | ||
|
|
||
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
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,3 @@ | ||
| const defaultInsets = {top: 0, bottom: 0, left: 0, right: 0}; | ||
|
|
||
| export default defaultInsets; |
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,18 @@ | ||
| import type {EdgeInsets} from 'react-native-safe-area-context'; | ||
| import StatusBar from '@libs/StatusBar'; | ||
| import defaultInsets from './defaultInsets'; | ||
|
|
||
| /** | ||
| * On Android we want to use the StatusBar height rather than the top safe area inset. | ||
| * @returns | ||
| */ | ||
| function getSafeAreaInsets(safeAreaInsets: EdgeInsets | null): EdgeInsets { | ||
| const insets = safeAreaInsets ?? defaultInsets; | ||
|
|
||
| return { | ||
| ...insets, | ||
| top: StatusBar.currentHeight ?? insets.top, | ||
| }; | ||
| } | ||
|
|
||
| export default getSafeAreaInsets; |
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,13 @@ | ||
| import type {EdgeInsets} from 'react-native-safe-area-context'; | ||
| import defaultInsets from './defaultInsets'; | ||
|
|
||
| /** | ||
| * Noop on web and iOS. This utility function is only needed on Android. | ||
| * @returns | ||
| */ | ||
| function getSafeAreaInsets(safeAreaInsets: EdgeInsets | null): EdgeInsets { | ||
| const insets = safeAreaInsets ?? defaultInsets; | ||
| return insets; | ||
| } | ||
|
|
||
| export default getSafeAreaInsets; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change has introduced a regression in #53261 , there is no need to add the extra margin.