Skip to content

Commit d123de5

Browse files
authored
Merge pull request #47096 from margelo/fix/keyboard-avoiding-view-from-keyboard-controller-v2
fix: use `KeyboardAvoidingView` from `react-native-keyboard-controller`
2 parents 4e94c60 + 7db099c commit d123de5

File tree

5 files changed

+33
-21
lines changed

5 files changed

+33
-21
lines changed

ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ PODS:
13031303
- ReactCommon/turbomodule/bridging
13041304
- ReactCommon/turbomodule/core
13051305
- Yoga
1306-
- react-native-keyboard-controller (1.12.2):
1306+
- react-native-keyboard-controller (1.13.0):
13071307
- glog
13081308
- hermes-engine
13091309
- RCT-Folly (= 2022.05.16.00)
@@ -2565,7 +2565,7 @@ SPEC CHECKSUMS:
25652565
react-native-geolocation: 580c86eb531c0aaf7a14bc76fd2983ce47ca58aa
25662566
react-native-image-picker: f8a13ff106bcc7eb00c71ce11fdc36aac2a44440
25672567
react-native-key-command: 28ccfa09520e7d7e30739480dea4df003493bfe8
2568-
react-native-keyboard-controller: 47c01b0741ae5fc84e53cf282e61cfa5c2edb19b
2568+
react-native-keyboard-controller: a8cbf848d0bc0e1976a07948f1c53b8432c1246c
25692569
react-native-launch-arguments: 5f41e0abf88a15e3c5309b8875d6fd5ac43df49d
25702570
react-native-netinfo: 02d31de0e08ab043d48f2a1a8baade109d7b6ca5
25712571
react-native-pager-view: ccd4bbf9fc7effaf8f91f8dae43389844d9ef9fa

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@
153153
"react-native-image-picker": "^7.0.3",
154154
"react-native-image-size": "git+https://github.com/Expensify/react-native-image-size#93399c6410de32966eb57085936ef6951398c2c3",
155155
"react-native-key-command": "^1.0.8",
156-
"react-native-keyboard-controller": "^1.12.2",
156+
"react-native-keyboard-controller": "1.13.0",
157157
"react-native-launch-arguments": "^4.0.2",
158158
"react-native-linear-gradient": "^2.8.1",
159159
"react-native-localize": "^2.2.6",

patches/react-native-keyboard-controller+1.12.2.patch renamed to patches/react-native-keyboard-controller+1.13.0.patch

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt b/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt
2-
index 83884d8..5d9e989 100644
2+
index 6e566fc..82416a1 100644
33
--- a/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt
44
+++ b/node_modules/react-native-keyboard-controller/android/src/main/java/com/reactnativekeyboardcontroller/views/EdgeToEdgeReactViewGroup.kt
5-
@@ -99,12 +99,12 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
5+
@@ -117,11 +117,11 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
66
}
77

88
private fun goToEdgeToEdge(edgeToEdge: Boolean) {
@@ -11,29 +11,41 @@ index 83884d8..5d9e989 100644
1111
- it.window,
1212
- !edgeToEdge,
1313
- )
14-
- }
15-
+ // reactContext.currentActivity?.let {
16-
+ // WindowCompat.setDecorFitsSystemWindows(
17-
+ // it.window,
18-
+ // !edgeToEdge,
19-
+ // )
20-
+ // }
14+
+ // reactContext.currentActivity?.let {
15+
+ // WindowCompat.setDecorFitsSystemWindows(
16+
+ // it.window,
17+
+ // !edgeToEdge,
18+
+ // )
19+
}
2120
}
2221

23-
private fun setupKeyboardCallbacks() {
24-
@@ -158,13 +158,13 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
22+
@@ -169,16 +169,16 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
2523
// region State managers
2624
private fun enable() {
2725
this.goToEdgeToEdge(true)
2826
- this.setupWindowInsets()
2927
+ // this.setupWindowInsets()
3028
this.setupKeyboardCallbacks()
29+
- modalAttachedWatcher.enable()
30+
+ // modalAttachedWatcher.enable()
3131
}
3232

3333
private fun disable() {
3434
this.goToEdgeToEdge(false)
3535
- this.setupWindowInsets()
3636
+ // this.setupWindowInsets()
3737
this.removeKeyboardCallbacks()
38+
- modalAttachedWatcher.disable()
39+
+ // modalAttachedWatcher.disable()
40+
}
41+
// endregion
42+
43+
@@ -206,7 +206,7 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
44+
fun forceStatusBarTranslucent(isStatusBarTranslucent: Boolean) {
45+
if (active && this.isStatusBarTranslucent != isStatusBarTranslucent) {
46+
this.isStatusBarTranslucent = isStatusBarTranslucent
47+
- this.setupWindowInsets()
48+
+ // this.setupWindowInsets()
49+
this.requestApplyInsetsWhenAttached()
50+
}
3851
}
39-
// endregion

src/components/KeyboardAvoidingView/index.ios.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The KeyboardAvoidingView is only used on ios
33
*/
44
import React from 'react';
5-
import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native';
5+
import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native-keyboard-controller';
66
import type {KeyboardAvoidingViewProps} from './types';
77

88
function KeyboardAvoidingView(props: KeyboardAvoidingViewProps) {

0 commit comments

Comments
 (0)