react-native-keyboard-controller 1.1.0 → 1.2.0

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.
Files changed (67) hide show
  1. package/android/build.gradle +72 -3
  2. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerComponentsRegistry.kt +31 -0
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +25 -0
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +32 -0
  5. package/android/src/fabric/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +25 -0
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardAnimationCallback.kt +6 -6
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/{KeyboardControllerModule.kt → KeyboardControllerModuleImpl.kt} +5 -17
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +5 -0
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/{KeyboardControllerViewManager.kt → KeyboardControllerViewManagerImpl.kt} +8 -9
  10. package/android/src/main/java/com/reactnativekeyboardcontroller/{StatusBarManagerCompatModule.kt → StatusBarManagerCompatImpl.kt} +10 -14
  11. package/android/src/main/jni/Android.mk +42 -0
  12. package/android/src/main/jni/KeyboardControllerComponentsRegistry.cpp +71 -0
  13. package/android/src/main/jni/KeyboardControllerComponentsRegistry.h +35 -0
  14. package/android/src/main/jni/OnLoad.cpp +9 -0
  15. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +31 -0
  16. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +26 -0
  17. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +34 -0
  18. package/ios/.clang-format +1 -1
  19. package/ios/KeyboardController.xcodeproj/project.pbxproj +18 -14
  20. package/ios/KeyboardControllerModule-Header.h +6 -2
  21. package/ios/KeyboardControllerModule.mm +105 -0
  22. package/ios/KeyboardControllerView.h +23 -0
  23. package/ios/KeyboardControllerView.mm +81 -0
  24. package/ios/{KeyboardControllerViewManager.m → KeyboardControllerViewManager.mm} +0 -0
  25. package/ios/KeyboardControllerViewManager.swift +2 -2
  26. package/ios/KeyboardMoveEvent.h +18 -0
  27. package/ios/KeyboardMoveEvent.m +74 -0
  28. package/lib/commonjs/KeyboardControllerViewNativeComponent.js +16 -0
  29. package/lib/commonjs/KeyboardControllerViewNativeComponent.js.map +1 -0
  30. package/lib/commonjs/NativeKeyboardController.js +13 -0
  31. package/lib/commonjs/NativeKeyboardController.js.map +1 -0
  32. package/lib/commonjs/NativeStatusBarManagerCompat.js +13 -0
  33. package/lib/commonjs/NativeStatusBarManagerCompat.js.map +1 -0
  34. package/lib/commonjs/architecture.js +13 -0
  35. package/lib/commonjs/architecture.js.map +1 -0
  36. package/lib/commonjs/monkey-patch.js +3 -1
  37. package/lib/commonjs/monkey-patch.js.map +1 -1
  38. package/lib/commonjs/native.js +4 -2
  39. package/lib/commonjs/native.js.map +1 -1
  40. package/lib/module/KeyboardControllerViewNativeComponent.js +4 -0
  41. package/lib/module/KeyboardControllerViewNativeComponent.js.map +1 -0
  42. package/lib/module/NativeKeyboardController.js +3 -0
  43. package/lib/module/NativeKeyboardController.js.map +1 -0
  44. package/lib/module/NativeStatusBarManagerCompat.js +3 -0
  45. package/lib/module/NativeStatusBarManagerCompat.js.map +1 -0
  46. package/lib/module/architecture.js +5 -0
  47. package/lib/module/architecture.js.map +1 -0
  48. package/lib/module/monkey-patch.js +2 -1
  49. package/lib/module/monkey-patch.js.map +1 -1
  50. package/lib/module/native.js +3 -2
  51. package/lib/module/native.js.map +1 -1
  52. package/lib/typescript/KeyboardControllerViewNativeComponent.d.ts +13 -0
  53. package/lib/typescript/NativeKeyboardController.d.ts +10 -0
  54. package/lib/typescript/NativeStatusBarManagerCompat.d.ts +10 -0
  55. package/lib/typescript/architecture.d.ts +2 -0
  56. package/lib/typescript/native.d.ts +1 -1
  57. package/package.json +16 -1
  58. package/react-native-keyboard-controller.podspec +19 -0
  59. package/src/KeyboardControllerViewNativeComponent.ts +23 -0
  60. package/src/NativeKeyboardController.ts +16 -0
  61. package/src/NativeStatusBarManagerCompat.ts +13 -0
  62. package/src/architecture.ts +4 -0
  63. package/src/monkey-patch.tsx +5 -1
  64. package/src/native.ts +12 -7
  65. package/ios/KeyboardControllerModule.m +0 -21
  66. package/ios/KeyboardControllerModule.swift +0 -53
  67. package/ios/KeyboardMoveEvent.swift +0 -41
package/ios/.clang-format CHANGED
@@ -87,4 +87,4 @@ UseTab: Never
87
87
  ---
88
88
  Language: ObjC
89
89
  ColumnLimit: 100
90
- BreakBeforeBraces: WebKit
90
+ BreakBeforeBraces: WebKit
@@ -7,10 +7,10 @@
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
- F359D34D28133BE1000B6AFE /* KeyboardControllerModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = F359D34C28133BE1000B6AFE /* KeyboardControllerModule.swift */; };
11
- F359D34F28133C26000B6AFE /* KeyboardControllerModule.m in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.m */; };
10
+ F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */ = {isa = PBXBuildFile; fileRef = F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */; };
11
+ F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */; };
12
12
  F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */; };
13
- F3FF0915281851CC006831B1 /* KeyboardMoveEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3FF0914281851CC006831B1 /* KeyboardMoveEvent.swift */; };
13
+ F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */; };
14
14
  F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */; };
15
15
  /* End PBXBuildFile section */
16
16
 
@@ -28,12 +28,14 @@
28
28
 
29
29
  /* Begin PBXFileReference section */
30
30
  134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
31
- B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyboardControllerViewManager.m; sourceTree = "<group>"; };
32
- F359D34C28133BE1000B6AFE /* KeyboardControllerModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardControllerModule.swift; sourceTree = "<group>"; };
33
- F359D34E28133C26000B6AFE /* KeyboardControllerModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardControllerModule.m; sourceTree = "<group>"; };
31
+ B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerViewManager.mm; sourceTree = "<group>"; };
32
+ F333F8D128996B1C0015B05F /* KeyboardControllerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardControllerView.h; sourceTree = "<group>"; };
33
+ F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerView.mm; sourceTree = "<group>"; };
34
+ F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = KeyboardControllerModule.mm; sourceTree = "<group>"; };
34
35
  F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardControllerModule-Header.h"; sourceTree = "<group>"; };
35
36
  F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardMovementObserver.swift; sourceTree = "<group>"; };
36
- F3FF0914281851CC006831B1 /* KeyboardMoveEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardMoveEvent.swift; sourceTree = "<group>"; };
37
+ F3F50667289E653B003091D6 /* KeyboardMoveEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KeyboardMoveEvent.h; sourceTree = "<group>"; };
38
+ F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardMoveEvent.m; sourceTree = "<group>"; };
37
39
  F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardController-Bridging-Header.h"; sourceTree = "<group>"; };
38
40
  F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardControllerViewManager.swift; sourceTree = "<group>"; };
39
41
  /* End PBXFileReference section */
@@ -60,13 +62,15 @@
60
62
  58B511D21A9E6C8500147676 = {
61
63
  isa = PBXGroup;
62
64
  children = (
65
+ F3F50667289E653B003091D6 /* KeyboardMoveEvent.h */,
66
+ F3F50668289E653B003091D6 /* KeyboardMoveEvent.m */,
63
67
  F3626A0628B3FE760021B2D9 /* KeyboardMovementObserver.swift */,
64
- F3FF0914281851CC006831B1 /* KeyboardMoveEvent.swift */,
68
+ F333F8D228996B8D0015B05F /* KeyboardControllerView.mm */,
69
+ F333F8D128996B1C0015B05F /* KeyboardControllerView.h */,
65
70
  F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */,
66
- F359D34E28133C26000B6AFE /* KeyboardControllerModule.m */,
67
- F359D34C28133BE1000B6AFE /* KeyboardControllerModule.swift */,
71
+ F359D34E28133C26000B6AFE /* KeyboardControllerModule.mm */,
68
72
  F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */,
69
- B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.m */,
73
+ B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.mm */,
70
74
  F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */,
71
75
  134814211AA4EA7D00B7C361 /* Products */,
72
76
  );
@@ -129,11 +133,11 @@
129
133
  isa = PBXSourcesBuildPhase;
130
134
  buildActionMask = 2147483647;
131
135
  files = (
132
- F3FF0915281851CC006831B1 /* KeyboardMoveEvent.swift in Sources */,
133
136
  F3626A0728B3FE760021B2D9 /* KeyboardMovementObserver.swift in Sources */,
134
- F359D34F28133C26000B6AFE /* KeyboardControllerModule.m in Sources */,
135
- F359D34D28133BE1000B6AFE /* KeyboardControllerModule.swift in Sources */,
137
+ F359D34F28133C26000B6AFE /* KeyboardControllerModule.mm in Sources */,
136
138
  F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
139
+ F333F8D428996B8D0015B05F /* KeyboardControllerView.mm in Sources */,
140
+ F3F50669289E653B003091D6 /* KeyboardMoveEvent.m in Sources */,
137
141
  );
138
142
  runOnlyForDeploymentPostprocessing = 0;
139
143
  };
@@ -1,10 +1,14 @@
1
1
  //
2
- // Module-Bridging-Header.h
2
+ // KeyboardControllerModule-Header.h
3
3
  // KeyboardController
4
4
  //
5
5
  // Created by Kiryl Ziusko on 22.04.22.
6
6
  // Copyright © 2022 Facebook. All rights reserved.
7
7
  //
8
8
 
9
- #import <React/RCTBridgeModule.h>
10
9
  #import <React/RCTEventEmitter.h>
10
+
11
+ @interface KeyboardController : RCTEventEmitter
12
+ + (KeyboardController *)shared;
13
+ - (void)sendEvent:(NSString *)name body:(id)body;
14
+ @end
@@ -0,0 +1,105 @@
1
+ //
2
+ // KeyboardControllerModule.m
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 22.04.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import <React/RCTBridgeModule.h>
10
+ #import <React/RCTEventEmitter.h>
11
+
12
+ // Thanks to this guard, we won't import this header when we build for the old architecture.
13
+ #ifdef RCT_NEW_ARCH_ENABLED
14
+ #import <FBReactNativeSpec/FBReactNativeSpec.h>
15
+ #import "RNKeyboardControllerSpec.h"
16
+ #endif
17
+
18
+ #import "KeyboardControllerModule-Header.h"
19
+
20
+ #import <React/RCTEventDispatcherProtocol.h>
21
+
22
+ #ifdef RCT_NEW_ARCH_ENABLED
23
+ @interface KeyboardController () <NativeKeyboardControllerSpec>
24
+ @end
25
+ #endif
26
+
27
+ @implementation KeyboardController {
28
+ bool hasListeners;
29
+ }
30
+
31
+ static KeyboardController *shared = nil;
32
+
33
+ RCT_EXPORT_MODULE()
34
+
35
+ - (instancetype)init
36
+ {
37
+ self = [super init];
38
+ shared = self;
39
+
40
+ return self;
41
+ }
42
+
43
+ + (BOOL)requiresMainQueueSetup
44
+ {
45
+ return NO;
46
+ }
47
+
48
+ #ifdef RCT_NEW_ARCH_ENABLED
49
+ - (void)setDefaultMode
50
+ #else
51
+ RCT_EXPORT_METHOD(setDefaultMode)
52
+ #endif
53
+ {
54
+ }
55
+
56
+ #ifdef RCT_NEW_ARCH_ENABLED
57
+ - (void)setInputMode:(double)mode
58
+ #else
59
+ RCT_EXPORT_METHOD(setInputMode : (nonnull NSNumber *)mode)
60
+ #endif
61
+ {
62
+ }
63
+
64
+ + (KeyboardController *)shared
65
+ {
66
+ return shared;
67
+ }
68
+
69
+ - (void)startObserving
70
+ {
71
+ hasListeners = YES;
72
+ }
73
+
74
+ - (void)stopObserving
75
+ {
76
+ hasListeners = NO;
77
+ }
78
+
79
+ - (void)sendEvent:(NSString *)name body:(id)body
80
+ {
81
+ if (hasListeners) {
82
+ [self sendEventWithName:name body:body];
83
+ }
84
+ }
85
+
86
+ - (NSArray<NSString *> *)supportedEvents
87
+ {
88
+ return @[
89
+ @"KeyboardController::keyboardWillShow",
90
+ @"KeyboardController::keyboardDidShow",
91
+ @"KeyboardController::keyboardWillHide",
92
+ @"KeyboardController::keyboardDidHide",
93
+ ];
94
+ }
95
+
96
+ // Thanks to this guard, we won't compile this code when we build for the old architecture.
97
+ #ifdef RCT_NEW_ARCH_ENABLED
98
+ - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
99
+ (const facebook::react::ObjCTurboModule::InitParams &)params
100
+ {
101
+ return std::make_shared<facebook::react::NativeKeyboardControllerSpecJSI>(params);
102
+ }
103
+ #endif
104
+
105
+ @end
@@ -0,0 +1,23 @@
1
+ //
2
+ // KeyboardControllerView.h
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 2.08.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #pragma once
10
+
11
+ // This guard prevent this file to be compiled in the old architecture.
12
+ #ifdef RCT_NEW_ARCH_ENABLED
13
+ #import <React/RCTViewComponentView.h>
14
+ #import <UIKit/UIKit.h>
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @interface KeyboardControllerView : RCTViewComponentView
19
+ @end
20
+
21
+ NS_ASSUME_NONNULL_END
22
+
23
+ #endif /* RCT_NEW_ARCH_ENABLED */
@@ -0,0 +1,81 @@
1
+ //
2
+ // KeyboardControllerView.mm
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 2.08.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ // This guard prevent the code from being compiled in the old architecture
10
+ #ifdef RCT_NEW_ARCH_ENABLED
11
+ #import "KeyboardControllerView.h"
12
+ #import "KeyboardMoveEvent.h"
13
+ #import "react_native_keyboard_controller-Swift.h"
14
+
15
+ #import <react/renderer/components/RNKeyboardControllerViewSpec/ComponentDescriptors.h>
16
+ #import <react/renderer/components/RNKeyboardControllerViewSpec/EventEmitters.h>
17
+ #import <react/renderer/components/RNKeyboardControllerViewSpec/Props.h>
18
+ #import <react/renderer/components/RNKeyboardControllerViewSpec/RCTComponentViewHelpers.h>
19
+
20
+ #import <React/RCTBridge+Private.h>
21
+
22
+ #import "KeyboardControllerModule-Header.h"
23
+ #import "RCTFabricComponentsPlugins.h"
24
+
25
+ using namespace facebook::react;
26
+
27
+ @interface KeyboardControllerView () <RCTKeyboardControllerViewViewProtocol>
28
+
29
+ @end
30
+
31
+ @implementation KeyboardControllerView {
32
+ KeyboardMovementObserver *observer;
33
+ }
34
+
35
+ + (ComponentDescriptorProvider)componentDescriptorProvider
36
+ {
37
+ return concreteComponentDescriptorProvider<KeyboardControllerViewComponentDescriptor>();
38
+ }
39
+
40
+ - (instancetype)initWithFrame:(CGRect)frame
41
+ {
42
+ if (self = [super initWithFrame:frame]) {
43
+ static const auto defaultProps = std::make_shared<const KeyboardControllerViewProps>();
44
+ _props = defaultProps;
45
+
46
+ observer = [[KeyboardMovementObserver alloc]
47
+ initWithHandler:^(NSNumber *height, NSNumber *progress) {
48
+ if (self->_eventEmitter) {
49
+ std::dynamic_pointer_cast<const facebook::react::KeyboardControllerViewEventEmitter>(
50
+ self->_eventEmitter)
51
+ ->onKeyboardMove(
52
+ facebook::react::KeyboardControllerViewEventEmitter::OnKeyboardMove{
53
+ .height = [height intValue], .progress = static_cast<Float>(self.tag)});
54
+ }
55
+
56
+ // TODO: use built-in _eventEmitter once NativeAnimated module will use ModernEventemitter
57
+ RCTBridge *bridge = [RCTBridge currentBridge];
58
+ if (bridge) {
59
+ KeyboardMoveEvent *keyboardMoveEvent =
60
+ [[KeyboardMoveEvent alloc] initWithReactTag:@(self.tag)
61
+ height:height
62
+ progress:progress];
63
+ [bridge.eventDispatcher sendEvent:keyboardMoveEvent];
64
+ }
65
+ }
66
+ onNotify:^(NSString *event, NSDictionary *data) {
67
+ [KeyboardController.shared sendEvent:event body:data];
68
+ }];
69
+ [observer mount];
70
+ }
71
+
72
+ return self;
73
+ }
74
+
75
+ Class<RCTComponentViewProtocol> KeyboardControllerViewCls(void)
76
+ {
77
+ return KeyboardControllerView.class;
78
+ }
79
+
80
+ @end
81
+ #endif
@@ -42,7 +42,7 @@ class KeyboardControllerView: UIView {
42
42
  func onEvent(height: NSNumber, progress: NSNumber) {
43
43
  eventDispatcher.send(
44
44
  KeyboardMoveEvent(
45
- viewTag: reactTag,
45
+ reactTag: reactTag,
46
46
  height: height,
47
47
  progress: progress
48
48
  )
@@ -50,6 +50,6 @@ class KeyboardControllerView: UIView {
50
50
  }
51
51
 
52
52
  func onNotify(event: String, data: Any) {
53
- KeyboardController.shared?.sendEvent(withName: event, body: data)
53
+ KeyboardController.shared()?.sendEvent(event, body: data)
54
54
  }
55
55
  }
@@ -0,0 +1,18 @@
1
+ //
2
+ // KeyboardMoveEvent.h
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 6.08.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <React/RCTEventDispatcherProtocol.h>
11
+
12
+ @interface KeyboardMoveEvent : NSObject <RCTEvent>
13
+
14
+ - (instancetype)initWithReactTag:(NSNumber *)reactTag
15
+ height:(NSNumber *)height
16
+ progress:(NSNumber *)progress;
17
+
18
+ @end
@@ -0,0 +1,74 @@
1
+ //
2
+ // KeyboardMoveEvent.m
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 6.08.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import "KeyboardMoveEvent.h"
10
+ #import <React/RCTAssert.h>
11
+
12
+ @implementation KeyboardMoveEvent {
13
+ NSNumber *_progress;
14
+ NSNumber *_height;
15
+ uint16_t _coalescingKey;
16
+ }
17
+
18
+ @synthesize viewTag = _viewTag;
19
+ @synthesize eventName = _eventName;
20
+
21
+ - (instancetype)initWithReactTag:(NSNumber *)reactTag
22
+ height:(NSNumber *)height
23
+ progress:(NSNumber *)progress
24
+ {
25
+ RCTAssertParam(reactTag);
26
+
27
+ if ((self = [super init])) {
28
+ _eventName = @"onKeyboardMove";
29
+ _viewTag = reactTag;
30
+ _progress = progress;
31
+ _height = height;
32
+ _coalescingKey = 0;
33
+ }
34
+ return self;
35
+ }
36
+
37
+ RCT_NOT_IMPLEMENTED(-(instancetype)init)
38
+
39
+ - (uint16_t)coalescingKey
40
+ {
41
+ return _coalescingKey;
42
+ }
43
+
44
+ - (NSDictionary *)body
45
+ {
46
+ NSDictionary *body = @{
47
+ @"progress" : _progress,
48
+ @"height" : _height,
49
+ };
50
+
51
+ return body;
52
+ }
53
+
54
+ - (BOOL)canCoalesce
55
+ {
56
+ return NO;
57
+ }
58
+
59
+ - (KeyboardMoveEvent *)coalesceWithEvent:(KeyboardMoveEvent *)newEvent
60
+ {
61
+ return newEvent;
62
+ }
63
+
64
+ + (NSString *)moduleDotMethod
65
+ {
66
+ return @"RCTEventEmitter.receiveEvent";
67
+ }
68
+
69
+ - (NSArray *)arguments
70
+ {
71
+ return @[ self.viewTag, RCTNormalizeInputEventName(self.eventName), [self body] ];
72
+ }
73
+
74
+ @end
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ // @ts-expect-error - no type definition
13
+ var _default = (0, _codegenNativeComponent.default)('KeyboardControllerView');
14
+
15
+ exports.default = _default;
16
+ //# sourceMappingURL=KeyboardControllerViewNativeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["codegenNativeComponent"],"sources":["KeyboardControllerViewNativeComponent.ts"],"sourcesContent":["import type { HostComponent } from 'react-native';\n// @ts-expect-error - no type definition\nimport type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';\nimport type {\n DirectEventHandler,\n Float,\n Int32,\n} from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\n\ntype KeyboardMoveEvent = Readonly<{\n height: Int32;\n progress: Float;\n}>;\n\nexport interface NativeProps extends ViewProps {\n statusBarTranslucent?: boolean;\n onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n 'KeyboardControllerView'\n) as HostComponent<NativeProps>;\n"],"mappings":";;;;;;;AAQA;;;;AAPA;eAmBe,IAAAA,+BAAA,EACb,wBADa,C"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _default = _reactNative.TurboModuleRegistry.get('KeyboardController');
11
+
12
+ exports.default = _default;
13
+ //# sourceMappingURL=NativeKeyboardController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeKeyboardController.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n // methods\n setInputMode(mode: number): void;\n setDefaultMode(): void;\n\n // event emitter\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n}\n\nexport default TurboModuleRegistry.get<Spec>('KeyboardController');\n"],"mappings":";;;;;;;AACA;;eAceA,gCAAA,CAAoBC,GAApB,CAA8B,oBAA9B,C"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _reactNative = require("react-native");
9
+
10
+ var _default = _reactNative.TurboModuleRegistry.get('StatusBarManagerCompat');
11
+
12
+ exports.default = _default;
13
+ //# sourceMappingURL=NativeStatusBarManagerCompat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeStatusBarManagerCompat.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n setHidden(hidden: boolean): void;\n setColor(color: number, animated: boolean): void;\n setTranslucent(translucent: boolean): void;\n setStyle(style: string): void;\n}\n\nexport default TurboModuleRegistry.get<Spec>('StatusBarManagerCompat');\n"],"mappings":";;;;;;;AACA;;eAWeA,gCAAA,CAAoBC,GAApB,CAA8B,wBAA9B,C"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isTurboModuleEnabled = exports.isFabricEnabled = void 0;
7
+ // @ts-expect-error because `__turboModuleProxy` has any type (maybe think about own types declaration)
8
+ const isTurboModuleEnabled = global.__turboModuleProxy != null; // @ts-expect-error because `nativeFabricUIManager` has any type (maybe think about own types declaration)
9
+
10
+ exports.isTurboModuleEnabled = isTurboModuleEnabled;
11
+ const isFabricEnabled = global.nativeFabricUIManager != null;
12
+ exports.isFabricEnabled = isFabricEnabled;
13
+ //# sourceMappingURL=architecture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isTurboModuleEnabled","global","__turboModuleProxy","isFabricEnabled","nativeFabricUIManager"],"sources":["architecture.ts"],"sourcesContent":["// @ts-expect-error because `__turboModuleProxy` has any type (maybe think about own types declaration)\nexport const isTurboModuleEnabled = global.__turboModuleProxy != null;\n// @ts-expect-error because `nativeFabricUIManager` has any type (maybe think about own types declaration)\nexport const isFabricEnabled = global.nativeFabricUIManager != null;\n"],"mappings":";;;;;;AAAA;AACO,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,kBAAP,IAA6B,IAA1D,C,CACP;;;AACO,MAAMC,eAAe,GAAGF,MAAM,CAACG,qBAAP,IAAgC,IAAxD"}
@@ -4,13 +4,15 @@ var _reactNative = require("react-native");
4
4
 
5
5
  var NativeAndroidManager = _interopRequireWildcard(require("react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid"));
6
6
 
7
+ var _architecture = require("./architecture");
8
+
7
9
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
8
10
 
9
11
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
12
 
11
13
  // @ts-expect-error because there is no corresponding type definition
12
14
  const getConstants = NativeAndroidManager.default.getConstants;
13
- const RCTStatusBarManagerCompat = _reactNative.NativeModules.StatusBarManagerCompat; // On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
15
+ const RCTStatusBarManagerCompat = _architecture.isTurboModuleEnabled ? require('./NativeStatusBarManagerCompat').default : _reactNative.NativeModules.StatusBarManagerCompat; // On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
14
16
  // in order to use library on all available platforms we have to monkey patch
15
17
  // default RN implementation and use modern `WindowInsetsControllerCompat`.
16
18
 
@@ -1 +1 @@
1
- {"version":3,"names":["getConstants","NativeAndroidManager","default","RCTStatusBarManagerCompat","NativeModules","StatusBarManagerCompat","Platform","OS","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden"],"sources":["monkey-patch.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from 'react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid';\n\nconst getConstants = NativeAndroidManager.default.getConstants;\n\nconst RCTStatusBarManagerCompat = NativeModules.StatusBarManagerCompat;\n\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nif (Platform.OS === 'android') {\n NativeAndroidManager.default = {\n getConstants,\n setColor(color: number, animated: boolean): void {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n\n setTranslucent(translucent: boolean): void {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n\n /**\n * - statusBarStyles can be:\n * - 'default'\n * - 'dark-content'\n */\n setStyle(statusBarStyle?: string): void {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n\n setHidden(hidden: boolean): void {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n };\n}\n"],"mappings":";;AAAA;;AAEA;;;;;;AADA;AAGA,MAAMA,YAAY,GAAGC,oBAAoB,CAACC,OAArB,CAA6BF,YAAlD;AAEA,MAAMG,yBAAyB,GAAGC,0BAAA,CAAcC,sBAAhD,C,CAEA;AACA;AACA;;AACA,IAAIC,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;EAC7BN,oBAAoB,CAACC,OAArB,GAA+B;IAC7BF,YAD6B;;IAE7BQ,QAAQ,CAACC,KAAD,EAAgBC,QAAhB,EAAyC;MAC/CP,yBAAyB,CAACK,QAA1B,CAAmCC,KAAnC,EAA0CC,QAA1C;IACD,CAJ4B;;IAM7BC,cAAc,CAACC,WAAD,EAA6B;MACzCT,yBAAyB,CAACQ,cAA1B,CAAyCC,WAAzC;IACD,CAR4B;;IAU7B;AACJ;AACA;AACA;AACA;IACIC,QAAQ,CAACC,cAAD,EAAgC;MACtCX,yBAAyB,CAACU,QAA1B,CAAmCC,cAAnC;IACD,CAjB4B;;IAmB7BC,SAAS,CAACC,MAAD,EAAwB;MAC/Bb,yBAAyB,CAACY,SAA1B,CAAoCC,MAApC;IACD;;EArB4B,CAA/B;AAuBD"}
1
+ {"version":3,"names":["getConstants","NativeAndroidManager","default","RCTStatusBarManagerCompat","isTurboModuleEnabled","require","NativeModules","StatusBarManagerCompat","Platform","OS","setColor","color","animated","setTranslucent","translucent","setStyle","statusBarStyle","setHidden","hidden"],"sources":["monkey-patch.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n// @ts-expect-error because there is no corresponding type definition\nimport * as NativeAndroidManager from 'react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid';\n\nimport { isTurboModuleEnabled } from './architecture';\n\nconst getConstants = NativeAndroidManager.default.getConstants;\n\nconst RCTStatusBarManagerCompat = isTurboModuleEnabled\n ? require('./NativeStatusBarManagerCompat').default\n : NativeModules.StatusBarManagerCompat;\n\n// On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so\n// in order to use library on all available platforms we have to monkey patch\n// default RN implementation and use modern `WindowInsetsControllerCompat`.\nif (Platform.OS === 'android') {\n NativeAndroidManager.default = {\n getConstants,\n setColor(color: number, animated: boolean): void {\n RCTStatusBarManagerCompat.setColor(color, animated);\n },\n\n setTranslucent(translucent: boolean): void {\n RCTStatusBarManagerCompat.setTranslucent(translucent);\n },\n\n /**\n * - statusBarStyles can be:\n * - 'default'\n * - 'dark-content'\n */\n setStyle(statusBarStyle?: string): void {\n RCTStatusBarManagerCompat.setStyle(statusBarStyle);\n },\n\n setHidden(hidden: boolean): void {\n RCTStatusBarManagerCompat.setHidden(hidden);\n },\n };\n}\n"],"mappings":";;AAAA;;AAEA;;AAEA;;;;;;AAHA;AAKA,MAAMA,YAAY,GAAGC,oBAAoB,CAACC,OAArB,CAA6BF,YAAlD;AAEA,MAAMG,yBAAyB,GAAGC,kCAAA,GAC9BC,OAAO,CAAC,gCAAD,CAAP,CAA0CH,OADZ,GAE9BI,0BAAA,CAAcC,sBAFlB,C,CAIA;AACA;AACA;;AACA,IAAIC,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;EAC7BR,oBAAoB,CAACC,OAArB,GAA+B;IAC7BF,YAD6B;;IAE7BU,QAAQ,CAACC,KAAD,EAAgBC,QAAhB,EAAyC;MAC/CT,yBAAyB,CAACO,QAA1B,CAAmCC,KAAnC,EAA0CC,QAA1C;IACD,CAJ4B;;IAM7BC,cAAc,CAACC,WAAD,EAA6B;MACzCX,yBAAyB,CAACU,cAA1B,CAAyCC,WAAzC;IACD,CAR4B;;IAU7B;AACJ;AACA;AACA;AACA;IACIC,QAAQ,CAACC,cAAD,EAAgC;MACtCb,yBAAyB,CAACY,QAA1B,CAAmCC,cAAnC;IACD,CAjB4B;;IAmB7BC,SAAS,CAACC,MAAD,EAAwB;MAC/Bf,yBAAyB,CAACc,SAA1B,CAAoCC,MAApC;IACD;;EArB4B,CAA/B;AAuBD"}
@@ -9,6 +9,8 @@ var _react = require("react");
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _architecture = require("./architecture");
13
+
12
14
  const LINKING_ERROR = `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
13
15
  ios: "- You have run 'pod install'\n",
14
16
  default: ''
@@ -24,7 +26,7 @@ exports.AndroidSoftInputModes = AndroidSoftInputModes;
24
26
  })(AndroidSoftInputModes || (exports.AndroidSoftInputModes = AndroidSoftInputModes = {}));
25
27
 
26
28
  const ComponentName = 'KeyboardControllerView';
27
- const RCTKeyboardController = _reactNative.NativeModules.KeyboardController;
29
+ const RCTKeyboardController = _architecture.isTurboModuleEnabled ? require('./NativeKeyboardController').default : _reactNative.NativeModules.KeyboardController;
28
30
  const KeyboardController = RCTKeyboardController;
29
31
  exports.KeyboardController = KeyboardController;
30
32
  const eventEmitter = new _reactNative.NativeEventEmitter(RCTKeyboardController);
@@ -32,7 +34,7 @@ const KeyboardEvents = {
32
34
  addListener: (name, cb) => eventEmitter.addListener('KeyboardController::' + name, cb)
33
35
  };
34
36
  exports.KeyboardEvents = KeyboardEvents;
35
- const KeyboardControllerView = _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
37
+ const KeyboardControllerView = _architecture.isFabricEnabled ? require('./KeyboardControllerViewNativeComponent').default : _reactNative.UIManager.getViewManagerConfig(ComponentName) != null ? (0, _reactNative.requireNativeComponent)(ComponentName) : () => {
36
38
  throw new Error(LINKING_ERROR);
37
39
  };
38
40
  exports.KeyboardControllerView = KeyboardControllerView;
@@ -1 +1 @@
1
- {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","AndroidSoftInputModes","ComponentName","RCTKeyboardController","NativeModules","KeyboardController","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","KeyboardControllerView","UIManager","getViewManagerConfig","requireNativeComponent","Error","useResizeMode","useEffect","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode"],"sources":["native.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport {\n requireNativeComponent,\n UIManager,\n Platform,\n NativeModules,\n NativeEventEmitter,\n NativeSyntheticEvent,\n ViewProps,\n} from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n}\n\nexport type NativeEvent = {\n progress: number;\n height: number;\n};\nexport type EventWithName<T> = {\n eventName: string;\n} & T;\nexport type KeyboardControllerProps = {\n onKeyboardMove: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;\n // fake prop used to activate reanimated bindings\n onKeyboardMoveReanimated: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>\n ) => void;\n statusBarTranslucent?: boolean;\n} & ViewProps;\ntype KeyboardController = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: AndroidSoftInputModes) => void;\n};\n\nconst ComponentName = 'KeyboardControllerView';\n\nconst RCTKeyboardController = NativeModules.KeyboardController;\nexport const KeyboardController = RCTKeyboardController as KeyboardController;\n\nconst eventEmitter = new NativeEventEmitter(RCTKeyboardController);\ntype KeyboardControllerEvents =\n | 'keyboardWillShow'\n | 'keyboardDidShow'\n | 'keyboardWillHide'\n | 'keyboardDidHide';\ntype KeyboardEvent = {\n height: number;\n};\nexport const KeyboardEvents = {\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEvent) => void\n ) => eventEmitter.addListener('KeyboardController::' + name, cb),\n};\nexport const KeyboardControllerView =\n UIManager.getViewManagerConfig(ComponentName) != null\n ? requireNativeComponent<KeyboardControllerProps>(ComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAUA,MAAMA,aAAa,GAChB,2FAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;IAMYC,qB;;;WAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,qCAAAA,qB;;AA4BZ,MAAMC,aAAa,GAAG,wBAAtB;AAEA,MAAMC,qBAAqB,GAAGC,0BAAA,CAAcC,kBAA5C;AACO,MAAMA,kBAAkB,GAAGF,qBAA3B;;AAEP,MAAMG,YAAY,GAAG,IAAIC,+BAAJ,CAAuBJ,qBAAvB,CAArB;AASO,MAAMK,cAAc,GAAG;EAC5BC,WAAW,EAAE,CACXC,IADW,EAEXC,EAFW,KAGRL,YAAY,CAACG,WAAb,CAAyB,yBAAyBC,IAAlD,EAAwDC,EAAxD;AAJuB,CAAvB;;AAMA,MAAMC,sBAAsB,GACjCC,sBAAA,CAAUC,oBAAV,CAA+BZ,aAA/B,KAAiD,IAAjD,GACI,IAAAa,mCAAA,EAAgDb,aAAhD,CADJ,GAEI,MAAM;EACJ,MAAM,IAAIc,KAAJ,CAAUpB,aAAV,CAAN;AACD,CALA;;;AAOA,MAAMqB,aAAa,GAAG,MAAM;EACjC,IAAAC,gBAAA,EAAU,MAAM;IACdb,kBAAkB,CAACc,YAAnB,CACElB,qBAAqB,CAACmB,wBADxB;IAIA,OAAO,MAAMf,kBAAkB,CAACgB,cAAnB,EAAb;EACD,CAND,EAMG,EANH;AAOD,CARM"}
1
+ {"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","AndroidSoftInputModes","ComponentName","RCTKeyboardController","isTurboModuleEnabled","require","NativeModules","KeyboardController","eventEmitter","NativeEventEmitter","KeyboardEvents","addListener","name","cb","KeyboardControllerView","isFabricEnabled","UIManager","getViewManagerConfig","requireNativeComponent","Error","useResizeMode","useEffect","setInputMode","SOFT_INPUT_ADJUST_RESIZE","setDefaultMode"],"sources":["native.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport {\n requireNativeComponent,\n UIManager,\n Platform,\n NativeModules,\n NativeEventEmitter,\n NativeSyntheticEvent,\n ViewProps,\n} from 'react-native';\n\nimport { isFabricEnabled, isTurboModuleEnabled } from './architecture';\n\nconst LINKING_ERROR =\n `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport enum AndroidSoftInputModes {\n SOFT_INPUT_ADJUST_NOTHING = 48,\n SOFT_INPUT_ADJUST_PAN = 32,\n SOFT_INPUT_ADJUST_RESIZE = 16,\n SOFT_INPUT_ADJUST_UNSPECIFIED = 0,\n}\n\nexport type NativeEvent = {\n progress: number;\n height: number;\n};\nexport type EventWithName<T> = {\n eventName: string;\n} & T;\nexport type KeyboardControllerProps = {\n onKeyboardMove: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;\n // fake prop used to activate reanimated bindings\n onKeyboardMoveReanimated: (\n e: NativeSyntheticEvent<EventWithName<NativeEvent>>\n ) => void;\n statusBarTranslucent?: boolean;\n} & ViewProps;\ntype KeyboardController = {\n // android only\n setDefaultMode: () => void;\n setInputMode: (mode: AndroidSoftInputModes) => void;\n};\n\nconst ComponentName = 'KeyboardControllerView';\n\nconst RCTKeyboardController = isTurboModuleEnabled\n ? require('./NativeKeyboardController').default\n : NativeModules.KeyboardController;\nexport const KeyboardController = RCTKeyboardController as KeyboardController;\n\nconst eventEmitter = new NativeEventEmitter(RCTKeyboardController);\ntype KeyboardControllerEvents =\n | 'keyboardWillShow'\n | 'keyboardDidShow'\n | 'keyboardWillHide'\n | 'keyboardDidHide';\ntype KeyboardEvent = {\n height: number;\n};\nexport const KeyboardEvents = {\n addListener: (\n name: KeyboardControllerEvents,\n cb: (e: KeyboardEvent) => void\n ) => eventEmitter.addListener('KeyboardController::' + name, cb),\n};\nexport const KeyboardControllerView = isFabricEnabled\n ? require('./KeyboardControllerViewNativeComponent').default\n : UIManager.getViewManagerConfig(ComponentName) != null\n ? requireNativeComponent<KeyboardControllerProps>(ComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\n\nexport const useResizeMode = () => {\n useEffect(() => {\n KeyboardController.setInputMode(\n AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE\n );\n\n return () => KeyboardController.setDefaultMode();\n }, []);\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAUA;;AAEA,MAAMA,aAAa,GAChB,2FAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;IAMYC,qB;;;WAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;EAAAA,qB,CAAAA,qB;GAAAA,qB,qCAAAA,qB;;AA4BZ,MAAMC,aAAa,GAAG,wBAAtB;AAEA,MAAMC,qBAAqB,GAAGC,kCAAA,GAC1BC,OAAO,CAAC,4BAAD,CAAP,CAAsCL,OADZ,GAE1BM,0BAAA,CAAcC,kBAFlB;AAGO,MAAMA,kBAAkB,GAAGJ,qBAA3B;;AAEP,MAAMK,YAAY,GAAG,IAAIC,+BAAJ,CAAuBN,qBAAvB,CAArB;AASO,MAAMO,cAAc,GAAG;EAC5BC,WAAW,EAAE,CACXC,IADW,EAEXC,EAFW,KAGRL,YAAY,CAACG,WAAb,CAAyB,yBAAyBC,IAAlD,EAAwDC,EAAxD;AAJuB,CAAvB;;AAMA,MAAMC,sBAAsB,GAAGC,6BAAA,GAClCV,OAAO,CAAC,yCAAD,CAAP,CAAmDL,OADjB,GAElCgB,sBAAA,CAAUC,oBAAV,CAA+Bf,aAA/B,KAAiD,IAAjD,GACA,IAAAgB,mCAAA,EAAgDhB,aAAhD,CADA,GAEA,MAAM;EACJ,MAAM,IAAIiB,KAAJ,CAAUvB,aAAV,CAAN;AACD,CANE;;;AAQA,MAAMwB,aAAa,GAAG,MAAM;EACjC,IAAAC,gBAAA,EAAU,MAAM;IACdd,kBAAkB,CAACe,YAAnB,CACErB,qBAAqB,CAACsB,wBADxB;IAIA,OAAO,MAAMhB,kBAAkB,CAACiB,cAAnB,EAAb;EACD,CAND,EAMG,EANH;AAOD,CARM"}
@@ -0,0 +1,4 @@
1
+ // @ts-expect-error - no type definition
2
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
3
+ export default codegenNativeComponent('KeyboardControllerView');
4
+ //# sourceMappingURL=KeyboardControllerViewNativeComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["codegenNativeComponent"],"sources":["KeyboardControllerViewNativeComponent.ts"],"sourcesContent":["import type { HostComponent } from 'react-native';\n// @ts-expect-error - no type definition\nimport type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';\nimport type {\n DirectEventHandler,\n Float,\n Int32,\n} from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\n\ntype KeyboardMoveEvent = Readonly<{\n height: Int32;\n progress: Float;\n}>;\n\nexport interface NativeProps extends ViewProps {\n statusBarTranslucent?: boolean;\n onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;\n}\n\nexport default codegenNativeComponent<NativeProps>(\n 'KeyboardControllerView'\n) as HostComponent<NativeProps>;\n"],"mappings":"AACA;AAOA,OAAOA,sBAAP,MAAmC,yDAAnC;AAYA,eAAeA,sBAAsB,CACnC,wBADmC,CAArC"}
@@ -0,0 +1,3 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.get('KeyboardController');
3
+ //# sourceMappingURL=NativeKeyboardController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeKeyboardController.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n // methods\n setInputMode(mode: number): void;\n setDefaultMode(): void;\n\n // event emitter\n addListener: (eventName: string) => void;\n removeListeners: (count: number) => void;\n}\n\nexport default TurboModuleRegistry.get<Spec>('KeyboardController');\n"],"mappings":"AACA,SAASA,mBAAT,QAAoC,cAApC;AAcA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,oBAA9B,CAAf"}
@@ -0,0 +1,3 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.get('StatusBarManagerCompat');
3
+ //# sourceMappingURL=NativeStatusBarManagerCompat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["TurboModuleRegistry","get"],"sources":["NativeStatusBarManagerCompat.ts"],"sourcesContent":["import type { TurboModule } from 'react-native';\nimport { TurboModuleRegistry } from 'react-native';\n\nexport interface Spec extends TurboModule {\n readonly getConstants: () => {};\n\n setHidden(hidden: boolean): void;\n setColor(color: number, animated: boolean): void;\n setTranslucent(translucent: boolean): void;\n setStyle(style: string): void;\n}\n\nexport default TurboModuleRegistry.get<Spec>('StatusBarManagerCompat');\n"],"mappings":"AACA,SAASA,mBAAT,QAAoC,cAApC;AAWA,eAAeA,mBAAmB,CAACC,GAApB,CAA8B,wBAA9B,CAAf"}
@@ -0,0 +1,5 @@
1
+ // @ts-expect-error because `__turboModuleProxy` has any type (maybe think about own types declaration)
2
+ export const isTurboModuleEnabled = global.__turboModuleProxy != null; // @ts-expect-error because `nativeFabricUIManager` has any type (maybe think about own types declaration)
3
+
4
+ export const isFabricEnabled = global.nativeFabricUIManager != null;
5
+ //# sourceMappingURL=architecture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isTurboModuleEnabled","global","__turboModuleProxy","isFabricEnabled","nativeFabricUIManager"],"sources":["architecture.ts"],"sourcesContent":["// @ts-expect-error because `__turboModuleProxy` has any type (maybe think about own types declaration)\nexport const isTurboModuleEnabled = global.__turboModuleProxy != null;\n// @ts-expect-error because `nativeFabricUIManager` has any type (maybe think about own types declaration)\nexport const isFabricEnabled = global.nativeFabricUIManager != null;\n"],"mappings":"AAAA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAACC,kBAAP,IAA6B,IAA1D,C,CACP;;AACA,OAAO,MAAMC,eAAe,GAAGF,MAAM,CAACG,qBAAP,IAAgC,IAAxD"}
@@ -1,8 +1,9 @@
1
1
  import { NativeModules, Platform } from 'react-native'; // @ts-expect-error because there is no corresponding type definition
2
2
 
3
3
  import * as NativeAndroidManager from 'react-native/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid';
4
+ import { isTurboModuleEnabled } from './architecture';
4
5
  const getConstants = NativeAndroidManager.default.getConstants;
5
- const RCTStatusBarManagerCompat = NativeModules.StatusBarManagerCompat; // On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
6
+ const RCTStatusBarManagerCompat = isTurboModuleEnabled ? require('./NativeStatusBarManagerCompat').default : NativeModules.StatusBarManagerCompat; // On Android < 11 RN uses legacy API which breaks EdgeToEdge mode in RN, so
6
7
  // in order to use library on all available platforms we have to monkey patch
7
8
  // default RN implementation and use modern `WindowInsetsControllerCompat`.
8
9