Skip to content

Commit 091aa2e

Browse files
authored
docs: version 1.16.0 (#782)
## 📜 Description Added new docs version to dropdown list. ## 💡 Motivation and Context This release has some features that are not available for older versions. Let's highlight it. ## 📢 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 - add new docs version; ## 🤔 How Has This Been Tested? Tested via preview. ## 📸 Screenshots (if appropriate): <img width="368" alt="image" src="https://github.com/user-attachments/assets/8b8b1bd9-c59a-43d2-b82f-147482efd37d" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 0e4ed17 commit 091aa2e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2624
-0
lines changed

docs/docusaurus.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ const config = {
8484
"1.15.0": {
8585
label: "1.15.0",
8686
},
87+
"1.16.0": {
88+
label: "1.16.0",
89+
},
8790
},
8891
},
8992
blog: {
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "API Reference",
3+
"position": 4,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "API reference containing information about all public methods and their signatures"
7+
}
8+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "📚 Components",
3+
"position": 2
4+
}
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
---
2+
keywords:
3+
[
4+
react-native-keyboard-controller,
5+
KeyboardAvoidingView,
6+
keyboard avoiding view,
7+
avoid keyboard,
8+
android,
9+
]
10+
---
11+
12+
# KeyboardAvoidingView
13+
14+
This component will automatically adjust its height, position, or bottom padding based on the keyboard height to remain visible while the virtual keyboard is displayed.
15+
16+
## Why another `KeyboardAvoidingView` is needed?
17+
18+
This new `KeyboardAvoidingView` maintains the familiar React Native [API](https://reactnative.dev/docs/keyboardavoidingview) but ensures consistent behavior and animations on both `iOS` and `Android` platforms. Unlike the existing solution, which primarily caters to `iOS`, this component eliminates platform discrepancies, providing a unified user experience. By reproducing the same animations and behaviors on both platforms, it simplifies cross-platform development, meets user expectations for consistency, and enhances code maintainability. Ultimately, it addresses the need for a reliable and uniform keyboard interaction solution across different devices.
19+
20+
Below is a visual difference between the implementations (the animation is _**4x**_ times slower for better visual perception).
21+
22+
import KeyboardAvoidingViewComparison from "@site/src/components/KeyboardAvoidingViewComparison";
23+
24+
<KeyboardAvoidingViewComparison />
25+
26+
:::info Found a bug? Help the project and report it!
27+
28+
If you found any bugs or inconsistent behavior comparing to `react-native` implementation - don't hesitate to open an [issue](https://github.com/kirillzyusko/react-native-keyboard-controller/issues/new?assignees=kirillzyusko&labels=bug&template=bug_report.md&title=). It will help the project 🙏
29+
30+
Also if there is any well-known problems in original `react-native` implementation which can not be fixed for a long time and they are present in this implementation as well - also feel free to submit an [issue](https://github.com/kirillzyusko/react-native-keyboard-controller/issues/new?assignees=kirillzyusko&labels=bug&template=bug_report.md&title=). Let's make this world better together 😎
31+
32+
:::
33+
34+
## Example
35+
36+
```tsx
37+
import React from "react";
38+
import {
39+
Text,
40+
TextInput,
41+
TouchableOpacity,
42+
View,
43+
StyleSheet,
44+
} from "react-native";
45+
import { KeyboardAvoidingView } from "react-native-keyboard-controller";
46+
47+
export default function KeyboardAvoidingViewExample() {
48+
return (
49+
<KeyboardAvoidingView
50+
behavior={"padding"}
51+
keyboardVerticalOffset={100}
52+
style={styles.content}
53+
>
54+
<View style={styles.inner}>
55+
<Text style={styles.heading}>Header</Text>
56+
<View>
57+
<TextInput placeholder="Username" style={styles.textInput} />
58+
<TextInput placeholder="Password" style={styles.textInput} />
59+
</View>
60+
<TouchableOpacity style={styles.button}>
61+
<Text style={styles.text}>Submit</Text>
62+
</TouchableOpacity>
63+
</View>
64+
</KeyboardAvoidingView>
65+
);
66+
}
67+
68+
const styles = StyleSheet.create({
69+
content: {
70+
flex: 1,
71+
maxHeight: 600,
72+
},
73+
heading: {
74+
fontSize: 36,
75+
marginBottom: 48,
76+
fontWeight: "600",
77+
},
78+
inner: {
79+
padding: 24,
80+
flex: 1,
81+
justifyContent: "space-between",
82+
},
83+
textInput: {
84+
height: 45,
85+
borderColor: "#000000",
86+
borderWidth: 1,
87+
borderRadius: 10,
88+
marginBottom: 36,
89+
paddingLeft: 10,
90+
},
91+
button: {
92+
marginTop: 12,
93+
height: 45,
94+
borderRadius: 10,
95+
backgroundColor: "rgb(40, 64, 147)",
96+
justifyContent: "center",
97+
alignItems: "center",
98+
},
99+
text: {
100+
fontWeight: "500",
101+
fontSize: 16,
102+
color: "white",
103+
},
104+
});
105+
```
106+
107+
## Props
108+
109+
### [`View Props`](https://reactnative.dev/docs/view#props)
110+
111+
Inherits [View Props](https://reactnative.dev/docs/view#props).
112+
113+
### `behavior`
114+
115+
Specify how to react to the presence of the keyboard. Could be one value of:
116+
117+
- `position`
118+
- `padding`
119+
- `height`
120+
121+
### `contentContainerStyle`
122+
123+
The style of the content container (View) when behavior is `position`.
124+
125+
### `enabled`
126+
127+
A boolean prop indicating whether `KeyboardAvoidingView` is enabled or disabled. Default is `true`.
128+
129+
### `keyboardVerticalOffset`
130+
131+
This is the distance between the top of the user screen and the react native view, may be non-zero in some use cases. Default is `0`.

0 commit comments

Comments
 (0)