Commit 5b65344
authored
fix: pending
## 📜 Description
Specify `isClosed=true` by default.
## 💡 Motivation and Context
By default when app starts the keyboard is closed. So `isClosed` should
be `true` 🙂
Code that I used for testing:
```tsx
import { StyleSheet, Alert, TextInput, TouchableOpacity, Text } from 'react-native';
import {
KeyboardAwareScrollView,
KeyboardController,
KeyboardProvider,
} from 'react-native-keyboard-controller';
export default function HomeScreen() {
return (
<KeyboardProvider>
<KeyboardAwareScrollView
bounces={false}
keyboardDismissMode="interactive"
keyboardShouldPersistTaps="handled"
style={styles.container}
>
<TextInput editable style={styles.input} />
<TouchableOpacity onPress={() => KeyboardController.dismiss().then(() => Alert.alert('Dismissed'))}>
<Text>Press me to dismiss</Text>
</TouchableOpacity>
</KeyboardAwareScrollView>
</KeyboardProvider>
);
}
const styles = StyleSheet.create({
input: {
borderBottomColor: 'black',
borderBottomWidth: 1,
},
container: {
flex: 1,
paddingTop: 100,
backgroundColor: "white",
},
});
```
> One interesting thing that I discovered is that on Android 9 e2e tests
stopped to work. Turned out I had to set `adjustResize` mode to make app
working well (on Android 9 `WindowInsetsCallbackCompat` events are not
triggered if we are in `adjustPan`). Initially I wanted to fix it by
replacing `KeyboardEvents` -> `Keyboard`, but then I realized, that
`Keyboard` events may not be synchronized with animation on Android, so
decided just add `useResizeMode` hook in example app to make e2e tests
green again. But I'll keep in mind this fact.
Closes
#854
## 📢 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 -->
### JS
- set `isClosed=true` instead of `isClosed=false` as default value;
## 🤔 How Has This Been Tested?
Tested in reproduction example and via e2e tests.
## 📸 Screenshots (if appropriate):
|Before|After|
|-------|-----|
|<video
src="https://github.com/user-attachments/assets/6a1fa7dc-87ac-4eff-810f-b99a5ab5f95c">|<video
src="https://github.com/user-attachments/assets/2ccd11c7-57d2-4e34-890b-1e27163e7f16">|
## 📝 Checklist
- [x] CI successfully passed
- [x] I added new mocks and corresponding unit-tests if library API was
changeddismiss if keyboard wasn't shown in app yet (#857)1 parent 7c33c6f commit 5b65344
3 files changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
| 9 | + | |
| 10 | + | |
6 | 11 | | |
7 | 12 | | |
8 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments