-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
liaoxuan
committed
Sep 27, 2023
1 parent
df0c31e
commit 19c5d97
Showing
4 changed files
with
83 additions
and
22 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
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,14 @@ | ||
import { useWindowDimensions } from 'react-native' | ||
|
||
import { useIsLargeTablet, useIsTablet } from './tablet' | ||
|
||
/** | ||
* 屏幕宽度 | ||
* 适配 iPad 布局 | ||
*/ | ||
export function useScreenWidth() { | ||
const { width } = useWindowDimensions() | ||
const isTablet = useIsTablet() | ||
const isLargeTablet = useIsLargeTablet() | ||
return isTablet ? width - 74 - (isLargeTablet ? 400 : 0) : width | ||
} |