Skip to content

Commit 3cd4b96

Browse files
Version bump v0.2.0
1 parent d718b3f commit 3cd4b96

File tree

4 files changed

+44
-9
lines changed

4 files changed

+44
-9
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.2.0
2+
3+
- Added support for fetching **bottom safe area inset** using native modules.
4+
- Improved example layout for better visual clarity and margin usage.
5+
16
## 0.1.0
27

38
- Fetch status bar height on **iOS** using native modules.

README.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @logicwind/react-native-status-bar-height
22

3-
A simple and lightweight React Native package to get the height of the status bar on both Android and iOS.
3+
A simple and lightweight React Native package to get the **status bar height** and **bottom safe area inset** on both Android and iOS.
44

55
### Installation
66

@@ -30,18 +30,43 @@ No additional setup is required.
3030

3131
## Usage
3232

33-
Import and use the `fetchStatusBarHeight` function to get the status bar height.
33+
Import and use the utility functions to fetch values:
3434

3535
```tsx md title="App.tsx"
36-
import { fetchStatusBarHeight } from '@logicwind/react-native-status-bar-height';
36+
import {
37+
fetchStatusBarHeight,
38+
fetchBottonInset,
39+
} from '@logicwind/react-native-status-bar-height';
3740

3841
const statusBarHeight = fetchStatusBarHeight();
42+
const bottomInset = fetchBottonInset();
3943
```
4044

45+
## Example
46+
```tsx md title="App.tsx"
47+
<View style={{ flex: 1 }}>
48+
<Text style={{ marginTop: fetchStatusBarHeight() }}>
49+
Status Bar Height
50+
</Text>
51+
<View style={{ flex: 1 }} />
52+
<Text style={{ marginBottom: fetchBottonInset() }}>
53+
Bottom Safe Area
54+
</Text>
55+
</View>
56+
```
57+
58+
## API
59+
`fetchStatusBarHeight(): number` - Returns the status bar height in pixels.
60+
61+
`fetchBottomInset(): number` - Returns the bottom safe area inset in pixels, helpful for avoiding overlap with gesture/navigation bars.
62+
4163
## How It Works
4264

43-
- On **iOS**, it attempts to fetch the status bar height using native modules. If unavailable, it falls back to predefined values based on screen dimensions.
44-
- On **Android**, it retrieves `StatusBar.currentHeight`.
65+
- On iOS, it retrieves values using native APIs or falls back to common values.
66+
67+
- On Android, it uses StatusBar.currentHeight for the status bar height, and WindowInsets for the bottom inset when available.
68+
69+
- A fallback mechanism is in place to provide reasonable defaults.
4570

4671
## react-native-status-bar-height is crafted mindfully at [Logicwind](https://www.logicwind.com?utm_source=github&utm_medium=github.com-logicwind&utm_campaign=react-native-status-bar-height)
4772

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@logicwind/react-native-status-bar-height",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "A React Native library for retrieving the status bar height on both Android and iOS.",
55
"source": "./src/index.tsx",
66
"main": "./lib/commonjs/index.js",
@@ -55,7 +55,12 @@
5555
"react-native-status-bar",
5656
"react-native-status-bar-height-ios",
5757
"react-native-status-bar-height-android",
58-
"react-native-status-bar-height-ios-android"
58+
"react-native-status-bar-height-ios-android",
59+
"bottom-inset",
60+
"safe-area",
61+
"safe-area-inset",
62+
"react-native-bottom-inset",
63+
"react-native-safe-area"
5964
],
6065
"repository": {
6166
"type": "git",

0 commit comments

Comments
 (0)