-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53223 from margelo/@chrispader/fix-53161
[CP Staging] Fix: Android edge-to-edge related inset/padding issues (cherry picked from commit 6430cd7) (CP triggered by mountiny)
- Loading branch information
Showing
21 changed files
with
102 additions
and
77 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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