react-native-keyboard-controller 1.13.0 → 1.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  package com.reactnativekeyboardcontroller.views
2
2
 
3
3
  import android.annotation.SuppressLint
4
+ import android.content.res.Configuration
4
5
  import android.os.Handler
5
6
  import android.os.Looper
6
7
  import android.util.Log
@@ -68,6 +69,10 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
68
69
 
69
70
  this.removeKeyboardCallbacks()
70
71
  }
72
+
73
+ override fun onConfigurationChanged(newConfig: Configuration?) {
74
+ this.reApplyWindowInsets()
75
+ }
71
76
  // endregion
72
77
 
73
78
  // region State manager helpers
@@ -83,25 +88,23 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
83
88
 
84
89
  val shouldApplyZeroPaddingTop = !active || this.isStatusBarTranslucent
85
90
  val shouldApplyZeroPaddingBottom = !active || this.isNavigationBarTranslucent
91
+ val navBarInsets = insets.getInsets(WindowInsetsCompat.Type.navigationBars())
92
+ val systemBarInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
93
+
86
94
  params.setMargins(
87
- 0,
95
+ navBarInsets.left,
88
96
  if (shouldApplyZeroPaddingTop) {
89
97
  0
90
98
  } else {
91
- (
92
- insets?.getInsets(WindowInsetsCompat.Type.systemBars())?.top
93
- ?: 0
94
- )
99
+ systemBarInsets.top
95
100
  },
96
- 0,
101
+ navBarInsets.right,
97
102
  if (shouldApplyZeroPaddingBottom) {
98
103
  0
99
104
  } else {
100
- insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom
101
- ?: 0
105
+ navBarInsets.bottom
102
106
  },
103
107
  )
104
-
105
108
  content?.layoutParams = params
106
109
 
107
110
  val defaultInsets = ViewCompat.onApplyWindowInsets(v, insets)
@@ -164,6 +167,11 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
164
167
  // for more details
165
168
  Handler(Looper.getMainLooper()).post { view.removeSelf() }
166
169
  }
170
+
171
+ private fun reApplyWindowInsets() {
172
+ this.setupWindowInsets()
173
+ this.requestApplyInsetsWhenAttached()
174
+ }
167
175
  // endregion
168
176
 
169
177
  // region State managers
@@ -206,8 +214,7 @@ class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : R
206
214
  fun forceStatusBarTranslucent(isStatusBarTranslucent: Boolean) {
207
215
  if (active && this.isStatusBarTranslucent != isStatusBarTranslucent) {
208
216
  this.isStatusBarTranslucent = isStatusBarTranslucent
209
- this.setupWindowInsets()
210
- this.requestApplyInsetsWhenAttached()
217
+ this.reApplyWindowInsets()
211
218
  }
212
219
  }
213
220
  // endregion
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=event-handler.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["event-handler.d.ts"],"sourcesContent":["declare function registerEventHandler(\n handler: (event: never) => void,\n eventName: string,\n viewTag: number,\n): number;\ndeclare function unregisterEventHandler(id: number): void;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=event-handler.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["event-handler.d.ts"],"sourcesContent":["declare function registerEventHandler(\n handler: (event: never) => void,\n eventName: string,\n viewTag: number,\n): number;\ndeclare function unregisterEventHandler(id: number): void;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- export {};
2
- //# sourceMappingURL=event-handler.js.map-native-reanimated/src/core");
1
+ let REACore = null;
2
+ try {
3
+ REACore = require("react-native-reanimated/src/core");
3
4
  } catch (e1) {
4
5
  try {
5
6
  REACore = require("react-native-reanimated/src/reanimated2/core");
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["event-handler.ts"],"sourcesContent":["declare function registerEventHandler(\n handler: (event: never) => void,\n eventName: string,\n viewTag: number,\n): number;\ndeclare function unregisterEventHandler(id: number): void;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":["REACore","require","e1","e2","console","warn","registerEventHandler","unregisterEventHandler"],"sources":["event-handler.js"],"sourcesContent":["let REACore = null;\n\ntry {\n REACore = require(\"react-native-reanimated/src/core\");\n} catch (e1) {\n try {\n REACore = require(\"react-native-reanimated/src/reanimated2/core\");\n } catch (e2) {\n console.warn(\"Failed to load REACore from both paths\");\n }\n}\nconst registerEventHandler = REACore.registerEventHandler;\nconst unregisterEventHandler = REACore.unregisterEventHandler;\n\nexport { registerEventHandler, unregisterEventHandler };\n"],"mappings":"AAAA,IAAIA,OAAO,GAAG,IAAI;AAElB,IAAI;EACFA,OAAO,GAAGC,OAAO,CAAC,kCAAkC,CAAC;AACvD,CAAC,CAAC,OAAOC,EAAE,EAAE;EACX,IAAI;IACFF,OAAO,GAAGC,OAAO,CAAC,8CAA8C,CAAC;EACnE,CAAC,CAAC,OAAOE,EAAE,EAAE;IACXC,OAAO,CAACC,IAAI,CAAC,wCAAwC,CAAC;EACxD;AACF;AACA,MAAMC,oBAAoB,GAAGN,OAAO,CAACM,oBAAoB;AACzD,MAAMC,sBAAsB,GAAGP,OAAO,CAACO,sBAAsB;AAE7D,SAASD,oBAAoB,EAAEC,sBAAsB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-keyboard-controller",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Keyboard manager which works in identical way on both iOS and Android",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,3 +0,0 @@
1
- declare function registerEventHandler(handler: (event: never) => void, eventName: string, viewTag: number): number;
2
- declare function unregisterEventHandler(id: number): void;
3
- export { registerEventHandler, unregisterEventHandler };
File without changes