You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: rephrase translucent StatusBar handling on Android for keyboardVerticalOffset (#892)
## 📜 Description
Re-phrased note about `translucent` StatusBar.
## 💡 Motivation and Context
When I re-read explanation again I realized that it's not very clear how
it should work. So I re-phrazed it.
Also in this PR I changed width of SVG image, and added missing
punctuation signs 🙂
## 📢 Changelog
<!-- High level overview of important changes -->
<!-- For example: fixed status bar manipulation; added new types
declarations; -->
<!-- If your changes don't affect one of platform/language below - then
remove this platform/language -->
### Docs
- replace SVGs;
- rephrase a note about `translucent` StatusBar.
## 🤔 How Has This Been Tested?
Tested via preview.
## 📸 Screenshots (if appropriate):
<img width="940" alt="image"
src="https://github.com/user-attachments/assets/23ca0382-f01f-4cfe-8222-ab8a0df5dcb7"
/>
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changed
Copy file name to clipboardExpand all lines: docs/docs/api/components/keyboard-avoiding-view.mdx
+6-8Lines changed: 6 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ A boolean prop indicating whether `KeyboardAvoidingView` is enabled or disabled.
132
132
133
133
### `keyboardVerticalOffset`
134
134
135
-
This is the distance between the top of the user screen and the react native view This is particularly useful when there are fixed headers, navigation bars, or other UI elements at the top of the screen. Default is `0`.
135
+
This is the distance between the top of the user screen and the react native view. This is particularly useful when there are fixed headers, navigation bars, or other UI elements at the top of the screen. Default is `0`.
@@ -169,19 +169,17 @@ Below shown a visual representation of `keyboardVerticalOffset`:
169
169
170
170
<KeyboardVerticalOffset />
171
171
172
-
:::warning Translucent`StatusBar`
173
-
If you are using translucent `StatusBar` on Android, then `StatusBar` padding gets handled by `react-navigation` automatically and it will include safe-area padding in `useHeaderHeight` (i. e. `StatusBar`height will be included in the returned value and it will match iOS behavior).
172
+
:::warning Handling`StatusBar` height on Android with `useHeaderHeight`
173
+
On `Android`, how you handle the `StatusBar` height depends on whether the `StatusBar`is **translucent** or **not**:
174
174
175
-
If you are not using translucent `StatusBar`, then you need to include `StatusBar` height yourself:
175
+
-**If the `StatusBar` is translucent**, `react-navigation`**automatically includes the `StatusBar` height** in `useHeaderHeight()`, along with safe-area padding. This behavior aligns with iOS, so you don’t need to manually add the `StatusBar` height.
176
+
-**If the StatusBar is not translucent**, `useHeaderHeight()` does **not** include the `StatusBar` height. In this case, you need to add it manually:
`StatusBar.currentHeight` is Android-only prop so you can use `?? 0` and don't
183
-
write platform-specific code using `Platform.OS` or `Platform.select`.
184
-
</blockquote>
182
+
Since `StatusBar.currentHeight` is an **Android-only** property, using `?? 0` ensures it doesn’t cause issues on iOS. This approach avoids the need for `Platform.OS` or `Platform.select` checks.
Copy file name to clipboardExpand all lines: docs/versioned_docs/version-1.16.0/api/components/keyboard-avoiding-view.mdx
+6-8Lines changed: 6 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -132,7 +132,7 @@ A boolean prop indicating whether `KeyboardAvoidingView` is enabled or disabled.
132
132
133
133
### `keyboardVerticalOffset`
134
134
135
-
This is the distance between the top of the user screen and the react native view This is particularly useful when there are fixed headers, navigation bars, or other UI elements at the top of the screen. Default is `0`.
135
+
This is the distance between the top of the user screen and the react native view. This is particularly useful when there are fixed headers, navigation bars, or other UI elements at the top of the screen. Default is `0`.
@@ -169,19 +169,17 @@ Below shown a visual representation of `keyboardVerticalOffset`:
169
169
170
170
<KeyboardVerticalOffset />
171
171
172
-
:::warning Translucent`StatusBar`
173
-
If you are using translucent `StatusBar` on Android, then `StatusBar` padding gets handled by `react-navigation` automatically and it will include safe-area padding in `useHeaderHeight` (i. e. `StatusBar`height will be included in the returned value and it will match iOS behavior).
172
+
:::warning Handling`StatusBar` height on Android with `useHeaderHeight`
173
+
On `Android`, how you handle the `StatusBar` height depends on whether the `StatusBar`is **translucent** or **not**:
174
174
175
-
If you are not using translucent `StatusBar`, then you need to include `StatusBar` height yourself:
175
+
-**If the `StatusBar` is translucent**, `react-navigation`**automatically includes the `StatusBar` height** in `useHeaderHeight()`, along with safe-area padding. This behavior aligns with iOS, so you don’t need to manually add the `StatusBar` height.
176
+
-**If the StatusBar is not translucent**, `useHeaderHeight()` does **not** include the `StatusBar` height. In this case, you need to add it manually:
`StatusBar.currentHeight` is Android-only prop so you can use `?? 0` and don't
183
-
write platform-specific code using `Platform.OS` or `Platform.select`.
184
-
</blockquote>
182
+
Since `StatusBar.currentHeight` is an **Android-only** property, using `?? 0` ensures it doesn’t cause issues on iOS. This approach avoids the need for `Platform.OS` or `Platform.select` checks.
0 commit comments