forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
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 Expensify#34356 from lukemorawski/NewChatPage_list…
…_refactor New Chat page list refactor
- Loading branch information
Showing
9 changed files
with
277 additions
and
278 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 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,37 @@ | ||
// eslint-disable-next-line no-restricted-imports | ||
import {useSafeAreaInsets} from 'react-native-safe-area-context'; | ||
import useStyleUtils from './useStyleUtils'; | ||
|
||
/** | ||
* Custom hook to get the styled safe area insets. | ||
* This hook utilizes the `SafeAreaInsetsContext` to retrieve the current safe area insets | ||
* and applies styling adjustments using the `useStyleUtils` hook. | ||
* | ||
* @returns An object containing the styled safe area insets and additional styles. | ||
* @returns .paddingTop The top padding adjusted for safe area. | ||
* @returns .paddingBottom The bottom padding adjusted for safe area. | ||
* @returns .insets The safe area insets object or undefined if not available. | ||
* @returns .safeAreaPaddingBottomStyle An object containing the bottom padding style adjusted for safe area. | ||
* | ||
* @example | ||
* // How to use this hook in a component | ||
* function MyComponent() { | ||
* const { paddingTop, paddingBottom, safeAreaPaddingBottomStyle } = useStyledSafeAreaInsets(); | ||
* | ||
* // Use these values to style your component accordingly | ||
* } | ||
*/ | ||
function useStyledSafeAreaInsets() { | ||
const StyleUtils = useStyleUtils(); | ||
const insets = useSafeAreaInsets(); | ||
|
||
const {paddingTop, paddingBottom} = StyleUtils.getSafeAreaPadding(insets ?? undefined); | ||
return { | ||
paddingTop, | ||
paddingBottom, | ||
insets: insets ?? undefined, | ||
safeAreaPaddingBottomStyle: {paddingBottom}, | ||
}; | ||
} | ||
|
||
export default useStyledSafeAreaInsets; |
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
Oops, something went wrong.