react-native-keyboard-controller 1.9.4 → 1.9.5
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.
- package/android/build.gradle +3 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/{FocusedInputLayoutObserver.kt → FocusedInputObserver.kt} +1 -1
- package/android/src/main/java/com/reactnativekeyboardcontroller/listeners/KeyboardAnimationCallback.kt +2 -2
- package/ios/KeyboardController.xcodeproj/project.pbxproj +4 -4
- package/ios/observers/{FocusedInputLayoutObserver.swift → FocusedInputObserver.swift} +3 -3
- package/ios/views/KeyboardControllerView.mm +2 -2
- package/ios/views/KeyboardControllerViewManager.swift +2 -2
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -43,6 +43,9 @@ android {
|
|
|
43
43
|
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
44
44
|
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
|
|
45
45
|
namespace "com.reactnativekeyboardcontroller"
|
|
46
|
+
buildFeatures {
|
|
47
|
+
buildConfig true
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
@@ -22,7 +22,7 @@ val noFocusedInputEvent = FocusedInputLayoutChangedEventData(
|
|
|
22
22
|
target = -1,
|
|
23
23
|
)
|
|
24
24
|
|
|
25
|
-
class
|
|
25
|
+
class FocusedInputObserver(val view: ReactViewGroup, private val context: ThemedReactContext?) {
|
|
26
26
|
// constructor variables
|
|
27
27
|
private val surfaceId = UIManagerHelper.getSurfaceId(view)
|
|
28
28
|
|
|
@@ -84,7 +84,7 @@ class KeyboardAnimationCallback(
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
private var layoutObserver:
|
|
87
|
+
private var layoutObserver: FocusedInputObserver? = null
|
|
88
88
|
|
|
89
89
|
init {
|
|
90
90
|
require(persistentInsetTypes and deferredInsetTypes == 0) {
|
|
@@ -92,7 +92,7 @@ class KeyboardAnimationCallback(
|
|
|
92
92
|
" same WindowInsetsCompat.Type values"
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
layoutObserver =
|
|
95
|
+
layoutObserver = FocusedInputObserver(view = view, context = context)
|
|
96
96
|
view.viewTreeObserver.addOnGlobalFocusChangeListener(focusListener)
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
10
|
0807071E2A34807B00C05A19 /* Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0807071D2A34807B00C05A19 /* Extensions.swift */; };
|
|
11
11
|
084AEEC62ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */; };
|
|
12
|
-
084AEEC82ACF4AB2001A3069 /*
|
|
12
|
+
084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */; };
|
|
13
13
|
F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */; };
|
|
14
14
|
F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */; };
|
|
15
15
|
F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */; };
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
0807071D2A34807B00C05A19 /* Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extensions.swift; sourceTree = "<group>"; };
|
|
34
34
|
084AEEC22ACF479A001A3069 /* FocusedInputLayoutChangedEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FocusedInputLayoutChangedEvent.h; sourceTree = "<group>"; };
|
|
35
35
|
084AEEC52ACF49A8001A3069 /* FocusedInputLayoutChangedEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FocusedInputLayoutChangedEvent.m; sourceTree = "<group>"; };
|
|
36
|
-
084AEEC72ACF4AB2001A3069 /*
|
|
36
|
+
084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FocusedInputObserver.swift; sourceTree = "<group>"; };
|
|
37
37
|
134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
38
38
|
B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerViewManager.mm; sourceTree = "<group>"; };
|
|
39
39
|
F333F8D128996B1C0015B05F /* KeyboardControllerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardControllerView.h; sourceTree = "<group>"; };
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
isa = PBXGroup;
|
|
74
74
|
children = (
|
|
75
75
|
F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */,
|
|
76
|
-
084AEEC72ACF4AB2001A3069 /*
|
|
76
|
+
084AEEC72ACF4AB2001A3069 /* FocusedInputObserver.swift */,
|
|
77
77
|
);
|
|
78
78
|
path = observers;
|
|
79
79
|
sourceTree = "<group>";
|
|
@@ -172,7 +172,7 @@
|
|
|
172
172
|
F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */,
|
|
173
173
|
0807071E2A34807B00C05A19 /* Extensions.swift in Sources */,
|
|
174
174
|
F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */,
|
|
175
|
-
084AEEC82ACF4AB2001A3069 /*
|
|
175
|
+
084AEEC82ACF4AB2001A3069 /* FocusedInputObserver.swift in Sources */,
|
|
176
176
|
F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
|
|
177
177
|
F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */,
|
|
178
178
|
F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
2
|
+
// FocusedInputObserver.swift
|
|
3
3
|
// KeyboardController
|
|
4
4
|
//
|
|
5
5
|
// Created by Kiryl Ziusko on 05/10/2023.
|
|
@@ -21,8 +21,8 @@ let noFocusedInputEvent: [String: Any] = [
|
|
|
21
21
|
],
|
|
22
22
|
]
|
|
23
23
|
|
|
24
|
-
@objc(
|
|
25
|
-
public class
|
|
24
|
+
@objc(FocusedInputObserver)
|
|
25
|
+
public class FocusedInputObserver: NSObject {
|
|
26
26
|
// class members
|
|
27
27
|
var onEvent: (NSDictionary) -> Void
|
|
28
28
|
// state variables
|
|
@@ -31,7 +31,7 @@ using namespace facebook::react;
|
|
|
31
31
|
|
|
32
32
|
@implementation KeyboardControllerView {
|
|
33
33
|
KeyboardMovementObserver *keyboardObserver;
|
|
34
|
-
|
|
34
|
+
FocusedInputObserver *inputObserver;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
@@ -45,7 +45,7 @@ using namespace facebook::react;
|
|
|
45
45
|
static const auto defaultProps = std::make_shared<const KeyboardControllerViewProps>();
|
|
46
46
|
_props = defaultProps;
|
|
47
47
|
|
|
48
|
-
inputObserver = [[
|
|
48
|
+
inputObserver = [[FocusedInputObserver alloc] initWithHandler:^(NSDictionary *event) {
|
|
49
49
|
if (self->_eventEmitter) {
|
|
50
50
|
int target = [event[@"target"] integerValue];
|
|
51
51
|
double absoluteY = [event[@"layout"][@"absoluteY"] doubleValue];
|
|
@@ -12,7 +12,7 @@ class KeyboardControllerViewManager: RCTViewManager {
|
|
|
12
12
|
class KeyboardControllerView: UIView {
|
|
13
13
|
// internal variables
|
|
14
14
|
private var keyboardObserver: KeyboardMovementObserver?
|
|
15
|
-
private var inputObserver:
|
|
15
|
+
private var inputObserver: FocusedInputObserver?
|
|
16
16
|
private var eventDispatcher: RCTEventDispatcherProtocol
|
|
17
17
|
private var bridge: RCTBridge
|
|
18
18
|
// react callbacks
|
|
@@ -35,7 +35,7 @@ class KeyboardControllerView: UIView {
|
|
|
35
35
|
self.bridge = bridge
|
|
36
36
|
eventDispatcher = bridge.eventDispatcher()
|
|
37
37
|
super.init(frame: frame)
|
|
38
|
-
inputObserver =
|
|
38
|
+
inputObserver = FocusedInputObserver(handler: onInput)
|
|
39
39
|
keyboardObserver = KeyboardMovementObserver(handler: onEvent, onNotify: onNotify)
|
|
40
40
|
}
|
|
41
41
|
|
package/package.json
CHANGED