react-native-keyboard-controller 1.0.0-alpha.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 (62) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -0
  3. package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
  4. package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
  6. package/android/.gradle/6.8/gc.properties +0 -0
  7. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  8. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  9. package/android/.gradle/checksums/checksums.lock +0 -0
  10. package/android/.gradle/configuration-cache/gc.properties +0 -0
  11. package/android/.gradle/vcs-1/gc.properties +0 -0
  12. package/android/build.gradle +129 -0
  13. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  14. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  15. package/android/gradle.properties +3 -0
  16. package/android/gradlew +185 -0
  17. package/android/gradlew.bat +89 -0
  18. package/android/src/main/AndroidManifest.xml +4 -0
  19. package/android/src/main/java/com/reactnativekeyboardcontroller/EdgeToEdgeReactViewGroup.kt +18 -0
  20. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +39 -0
  21. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +16 -0
  22. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +57 -0
  23. package/android/src/main/java/com/reactnativekeyboardcontroller/TranslateDeferringInsetsAnimationCallback.kt +150 -0
  24. package/android/src/main/java/com/reactnativekeyboardcontroller/events/KeyboardTransitionEvent.kt +23 -0
  25. package/ios/KeyboardController-Bridging-Header.h +1 -0
  26. package/ios/KeyboardController.xcodeproj/project.pbxproj +293 -0
  27. package/ios/KeyboardController.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  28. package/ios/KeyboardController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  29. package/ios/KeyboardController.xcodeproj/project.xcworkspace/xcuserdata/kiryl.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  30. package/ios/KeyboardController.xcodeproj/xcuserdata/kiryl.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  31. package/ios/KeyboardControllerModule-Header.h +10 -0
  32. package/ios/KeyboardControllerModule.m +21 -0
  33. package/ios/KeyboardControllerModule.swift +38 -0
  34. package/ios/KeyboardControllerViewManager.m +7 -0
  35. package/ios/KeyboardControllerViewManager.swift +74 -0
  36. package/ios/KeyboardMoveEvent.swift +37 -0
  37. package/lib/commonjs/animated.js +145 -0
  38. package/lib/commonjs/animated.js.map +1 -0
  39. package/lib/commonjs/index.js +45 -0
  40. package/lib/commonjs/index.js.map +1 -0
  41. package/lib/commonjs/native.js +48 -0
  42. package/lib/commonjs/native.js.map +1 -0
  43. package/lib/commonjs/replicas.js +138 -0
  44. package/lib/commonjs/replicas.js.map +1 -0
  45. package/lib/module/animated.js +117 -0
  46. package/lib/module/animated.js.map +1 -0
  47. package/lib/module/index.js +4 -0
  48. package/lib/module/index.js.map +1 -0
  49. package/lib/module/native.js +32 -0
  50. package/lib/module/native.js.map +1 -0
  51. package/lib/module/replicas.js +114 -0
  52. package/lib/module/replicas.js.map +1 -0
  53. package/lib/typescript/animated.d.ts +22 -0
  54. package/lib/typescript/index.d.ts +3 -0
  55. package/lib/typescript/native.d.ts +36 -0
  56. package/lib/typescript/replicas.d.ts +45 -0
  57. package/package.json +149 -0
  58. package/react-native-keyboard-controller.podspec +19 -0
  59. package/src/animated.tsx +166 -0
  60. package/src/index.ts +3 -0
  61. package/src/native.ts +82 -0
  62. package/src/replicas.ts +152 -0
@@ -0,0 +1,57 @@
1
+ package com.reactnativekeyboardcontroller
2
+
3
+ import androidx.appcompat.widget.FitWindowsLinearLayout
4
+ import androidx.core.view.*
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.common.MapBuilder
7
+ import com.facebook.react.uimanager.ThemedReactContext
8
+ import com.facebook.react.views.view.ReactViewGroup
9
+ import com.facebook.react.views.view.ReactViewManager
10
+ import com.reactnativekeyboardcontroller.events.KeyboardTransitionEvent
11
+
12
+ class KeyboardControllerViewManager(reactContext: ReactApplicationContext) : ReactViewManager() {
13
+ private var mReactContext = reactContext
14
+
15
+ override fun getName() = "KeyboardControllerView"
16
+
17
+ override fun createViewInstance(reactContext: ThemedReactContext): ReactViewGroup {
18
+ val view = EdgeToEdgeReactViewGroup(reactContext)
19
+
20
+ ViewCompat.setOnApplyWindowInsetsListener(view) { v, insets ->
21
+ val content =
22
+ mReactContext.currentActivity?.window?.decorView?.rootView?.findViewById<FitWindowsLinearLayout>(
23
+ R.id.action_bar_root
24
+ )
25
+ content?.setPadding(
26
+ 0, insets?.getInsets(WindowInsetsCompat.Type.systemBars())?.top ?: 0, 0,
27
+ insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom ?: 0
28
+ )
29
+
30
+ insets
31
+ }
32
+
33
+ ViewCompat.setWindowInsetsAnimationCallback(
34
+ reactContext.currentActivity!!.window!!.decorView,
35
+ TranslateDeferringInsetsAnimationCallback(
36
+ view = view,
37
+ persistentInsetTypes = WindowInsetsCompat.Type.systemBars(),
38
+ deferredInsetTypes = WindowInsetsCompat.Type.ime(),
39
+ // We explicitly allow dispatch to continue down to binding.messageHolder's
40
+ // child views, so that step 2.5 below receives the call
41
+ dispatchMode = WindowInsetsAnimationCompat.Callback.DISPATCH_MODE_CONTINUE_ON_SUBTREE,
42
+ context = mReactContext
43
+ )
44
+ )
45
+
46
+ return view
47
+ }
48
+
49
+ override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
50
+ val map: MutableMap<String, Any> = MapBuilder.of(
51
+ KeyboardTransitionEvent.EVENT_NAME,
52
+ MapBuilder.of("registrationName", "onKeyboardMove")
53
+ )
54
+
55
+ return map
56
+ }
57
+ }
@@ -0,0 +1,150 @@
1
+ /*
2
+ * Copyright 2020 The Android Open Source Project
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ package com.reactnativekeyboardcontroller
18
+
19
+ import android.content.Context
20
+ import androidx.core.graphics.Insets
21
+ import androidx.core.view.ViewCompat
22
+ import androidx.core.view.WindowInsetsAnimationCompat
23
+ import androidx.core.view.WindowInsetsCompat
24
+ import com.facebook.react.bridge.Arguments
25
+ import com.facebook.react.bridge.ReactApplicationContext
26
+ import com.facebook.react.bridge.WritableMap
27
+ import com.facebook.react.modules.core.DeviceEventManagerModule
28
+ import com.facebook.react.uimanager.UIManagerModule
29
+ import com.facebook.react.views.view.ReactViewGroup
30
+ import com.reactnativekeyboardcontroller.events.KeyboardTransitionEvent
31
+ import java.util.*
32
+
33
+ fun toDp(px: Float, context: Context): Int = (px / context.resources.displayMetrics.density).toInt()
34
+
35
+ /**
36
+ * A [WindowInsetsAnimationCompat.Callback] which will translate/move the given view during any
37
+ * inset animations of the given inset type.
38
+ *
39
+ * This class works in tandem with [RootViewDeferringInsetsCallback] to support the deferring of
40
+ * certain [WindowInsetsCompat.Type] values during a [WindowInsetsAnimationCompat], provided in
41
+ * [deferredInsetTypes]. The values passed into this constructor should match those which
42
+ * the [RootViewDeferringInsetsCallback] is created with.
43
+ *
44
+ * @param view the view to translate from it's start to end state
45
+ * @param persistentInsetTypes the bitmask of any inset types which were handled as part of the
46
+ * layout
47
+ * @param deferredInsetTypes the bitmask of insets types which should be deferred until after
48
+ * any [WindowInsetsAnimationCompat]s have ended
49
+ * @param dispatchMode The dispatch mode for this callback.
50
+ * See [WindowInsetsAnimationCompat.Callback.getDispatchMode].
51
+ */
52
+ class TranslateDeferringInsetsAnimationCallback(
53
+ val view: ReactViewGroup,
54
+ val persistentInsetTypes: Int,
55
+ val deferredInsetTypes: Int,
56
+ dispatchMode: Int = DISPATCH_MODE_STOP,
57
+ val context: ReactApplicationContext?
58
+ ) : WindowInsetsAnimationCompat.Callback(dispatchMode) {
59
+ private var persistentKeyboardHeight = 0
60
+
61
+ init {
62
+ require(persistentInsetTypes and deferredInsetTypes == 0) {
63
+ "persistentInsetTypes and deferredInsetTypes can not contain any of " +
64
+ " same WindowInsetsCompat.Type values"
65
+ }
66
+ }
67
+
68
+ override fun onStart(
69
+ animation: WindowInsetsAnimationCompat,
70
+ bounds: WindowInsetsAnimationCompat.BoundsCompat
71
+ ): WindowInsetsAnimationCompat.BoundsCompat {
72
+ val keyboardHeight = getCurrentKeyboardHeight()
73
+ val isKeyboardVisible = isKeyboardVisible()
74
+
75
+ if (isKeyboardVisible) {
76
+ // do not update it on hide, since back progress will be invalid
77
+ this.persistentKeyboardHeight = keyboardHeight
78
+ }
79
+
80
+ val params: WritableMap = Arguments.createMap()
81
+ params.putInt("height", keyboardHeight)
82
+ context?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)?.emit("KeyboardController::" + if(!isKeyboardVisible) "keyboardWillHide" else "keyboardWillShow", params)
83
+
84
+ println("KeyboardController::" + if(!isKeyboardVisible) "keyboardWillHide" else "keyboardWillShow")
85
+ println("HEIGHT:: " + keyboardHeight)
86
+
87
+ return super.onStart(animation, bounds)
88
+ }
89
+
90
+ override fun onEnd(animation: WindowInsetsAnimationCompat) {
91
+ super.onEnd(animation)
92
+
93
+ val isKeyboardVisible = isKeyboardVisible()
94
+
95
+ val params: WritableMap = Arguments.createMap()
96
+ context?.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)?.emit("KeyboardController::" + if(!isKeyboardVisible) "keyboardDidHide" else "keyboardDidShow", params)
97
+
98
+ println("KeyboardController::" + if(!isKeyboardVisible) "keyboardDidHide" else "keyboardDidShow")
99
+ }
100
+
101
+ private fun isKeyboardVisible(): Boolean {
102
+ val insets = ViewCompat.getRootWindowInsets(view)
103
+
104
+ return insets?.isVisible(WindowInsetsCompat.Type.ime()) ?: false
105
+ }
106
+
107
+ private fun getCurrentKeyboardHeight(): Int {
108
+ val insets = ViewCompat.getRootWindowInsets(view)
109
+ val keyboardHeight = insets?.getInsets(WindowInsetsCompat.Type.ime())?.bottom ?: 0
110
+ val navigationBar = insets?.getInsets(WindowInsetsCompat.Type.navigationBars())?.bottom ?: 0
111
+
112
+ // on hide it will be negative value, so we are using max function
113
+ return Math.max(toDp((keyboardHeight - navigationBar).toFloat(), context!!), 0)
114
+ }
115
+
116
+ override fun onProgress(
117
+ insets: WindowInsetsCompat,
118
+ runningAnimations: List<WindowInsetsAnimationCompat>
119
+ ): WindowInsetsCompat {
120
+ // onProgress() is called when any of the running animations progress...
121
+
122
+ // First we get the insets which are potentially deferred
123
+ val typesInset = insets.getInsets(deferredInsetTypes)
124
+ // Then we get the persistent inset types which are applied as padding during layout
125
+ val otherInset = insets.getInsets(persistentInsetTypes)
126
+
127
+ // Now that we subtract the two insets, to calculate the difference. We also coerce
128
+ // the insets to be >= 0, to make sure we don't use negative insets.
129
+ val diff = Insets.subtract(typesInset, otherInset).let {
130
+ Insets.max(it, Insets.NONE)
131
+ }
132
+ val diffY = (diff.top - diff.bottom).toFloat()
133
+ val height = toDp(diffY, context!!)
134
+
135
+ var progress = 0.0
136
+ try {
137
+ progress = Math.abs((height.toDouble() / persistentKeyboardHeight))
138
+ } catch (e: ArithmeticException) {
139
+ // do nothing, send progress as 0
140
+ }
141
+ println("DiffY: " + diffY + " " + height)
142
+
143
+ context
144
+ .getNativeModule(UIManagerModule::class.java)
145
+ ?.eventDispatcher
146
+ ?.dispatchEvent(KeyboardTransitionEvent(view.id, height, progress))
147
+
148
+ return insets
149
+ }
150
+ }
@@ -0,0 +1,23 @@
1
+ package com.reactnativekeyboardcontroller.events
2
+
3
+ import com.facebook.react.bridge.Arguments
4
+ import com.facebook.react.uimanager.events.Event
5
+ import com.facebook.react.uimanager.events.RCTEventEmitter
6
+
7
+ class KeyboardTransitionEvent(private val viewId: Int, private val height: Int, private val progress: Double) : Event<KeyboardTransitionEvent>(viewId) {
8
+ override fun getEventName() = EVENT_NAME
9
+
10
+ // TODO: All events for a given view can be coalesced?
11
+ override fun getCoalescingKey(): Short = 0
12
+
13
+ override fun dispatch(rctEventEmitter: RCTEventEmitter) {
14
+ val map = Arguments.createMap()
15
+ map.putDouble("progress", progress)
16
+ map.putInt("height", height)
17
+ rctEventEmitter.receiveEvent(viewTag, eventName, map)
18
+ }
19
+
20
+ companion object {
21
+ const val EVENT_NAME = "topKeyboardMove"
22
+ }
23
+ }
@@ -0,0 +1 @@
1
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,293 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
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 */; };
12
+ F3FF0915281851CC006831B1 /* KeyboardMoveEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3FF0914281851CC006831B1 /* KeyboardMoveEvent.swift */; };
13
+ F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */; };
14
+ /* End PBXBuildFile section */
15
+
16
+ /* Begin PBXCopyFilesBuildPhase section */
17
+ 58B511D91A9E6C8500147676 /* CopyFiles */ = {
18
+ isa = PBXCopyFilesBuildPhase;
19
+ buildActionMask = 2147483647;
20
+ dstPath = "include/$(PRODUCT_NAME)";
21
+ dstSubfolderSpec = 16;
22
+ files = (
23
+ );
24
+ runOnlyForDeploymentPostprocessing = 0;
25
+ };
26
+ /* End PBXCopyFilesBuildPhase section */
27
+
28
+ /* Begin PBXFileReference section */
29
+ 134814201AA4EA6300B7C361 /* libKeyboardController.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libKeyboardController.a; sourceTree = BUILT_PRODUCTS_DIR; };
30
+ B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyboardControllerViewManager.m; sourceTree = "<group>"; };
31
+ F359D34C28133BE1000B6AFE /* KeyboardControllerModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardControllerModule.swift; sourceTree = "<group>"; };
32
+ F359D34E28133C26000B6AFE /* KeyboardControllerModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KeyboardControllerModule.m; sourceTree = "<group>"; };
33
+ F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardControllerModule-Header.h"; sourceTree = "<group>"; };
34
+ F3FF0914281851CC006831B1 /* KeyboardMoveEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardMoveEvent.swift; sourceTree = "<group>"; };
35
+ F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "KeyboardController-Bridging-Header.h"; sourceTree = "<group>"; };
36
+ F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardControllerViewManager.swift; sourceTree = "<group>"; };
37
+ /* End PBXFileReference section */
38
+
39
+ /* Begin PBXFrameworksBuildPhase section */
40
+ 58B511D81A9E6C8500147676 /* Frameworks */ = {
41
+ isa = PBXFrameworksBuildPhase;
42
+ buildActionMask = 2147483647;
43
+ files = (
44
+ );
45
+ runOnlyForDeploymentPostprocessing = 0;
46
+ };
47
+ /* End PBXFrameworksBuildPhase section */
48
+
49
+ /* Begin PBXGroup section */
50
+ 134814211AA4EA7D00B7C361 /* Products */ = {
51
+ isa = PBXGroup;
52
+ children = (
53
+ 134814201AA4EA6300B7C361 /* libKeyboardController.a */,
54
+ );
55
+ name = Products;
56
+ sourceTree = "<group>";
57
+ };
58
+ 58B511D21A9E6C8500147676 = {
59
+ isa = PBXGroup;
60
+ children = (
61
+ F3FF0914281851CC006831B1 /* KeyboardMoveEvent.swift */,
62
+ F359D35028133C6F000B6AFE /* KeyboardControllerModule-Header.h */,
63
+ F359D34E28133C26000B6AFE /* KeyboardControllerModule.m */,
64
+ F359D34C28133BE1000B6AFE /* KeyboardControllerModule.swift */,
65
+ F4FF95D6245B92E800C19C63 /* KeyboardControllerViewManager.swift */,
66
+ B3E7B5891CC2AC0600A0062D /* KeyboardControllerViewManager.m */,
67
+ F4FF95D5245B92E700C19C63 /* KeyboardController-Bridging-Header.h */,
68
+ 134814211AA4EA7D00B7C361 /* Products */,
69
+ );
70
+ sourceTree = "<group>";
71
+ };
72
+ /* End PBXGroup section */
73
+
74
+ /* Begin PBXNativeTarget section */
75
+ 58B511DA1A9E6C8500147676 /* KeyboardController */ = {
76
+ isa = PBXNativeTarget;
77
+ buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "KeyboardController" */;
78
+ buildPhases = (
79
+ 58B511D71A9E6C8500147676 /* Sources */,
80
+ 58B511D81A9E6C8500147676 /* Frameworks */,
81
+ 58B511D91A9E6C8500147676 /* CopyFiles */,
82
+ );
83
+ buildRules = (
84
+ );
85
+ dependencies = (
86
+ );
87
+ name = KeyboardController;
88
+ productName = RCTDataManager;
89
+ productReference = 134814201AA4EA6300B7C361 /* libKeyboardController.a */;
90
+ productType = "com.apple.product-type.library.static";
91
+ };
92
+ /* End PBXNativeTarget section */
93
+
94
+ /* Begin PBXProject section */
95
+ 58B511D31A9E6C8500147676 /* Project object */ = {
96
+ isa = PBXProject;
97
+ attributes = {
98
+ LastUpgradeCheck = 0920;
99
+ ORGANIZATIONNAME = Facebook;
100
+ TargetAttributes = {
101
+ 58B511DA1A9E6C8500147676 = {
102
+ CreatedOnToolsVersion = 6.1.1;
103
+ };
104
+ };
105
+ };
106
+ buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "KeyboardController" */;
107
+ compatibilityVersion = "Xcode 3.2";
108
+ developmentRegion = English;
109
+ hasScannedForEncodings = 0;
110
+ knownRegions = (
111
+ English,
112
+ en,
113
+ );
114
+ mainGroup = 58B511D21A9E6C8500147676;
115
+ productRefGroup = 58B511D21A9E6C8500147676;
116
+ projectDirPath = "";
117
+ projectRoot = "";
118
+ targets = (
119
+ 58B511DA1A9E6C8500147676 /* KeyboardController */,
120
+ );
121
+ };
122
+ /* End PBXProject section */
123
+
124
+ /* Begin PBXSourcesBuildPhase section */
125
+ 58B511D71A9E6C8500147676 /* Sources */ = {
126
+ isa = PBXSourcesBuildPhase;
127
+ buildActionMask = 2147483647;
128
+ files = (
129
+ F3FF0915281851CC006831B1 /* KeyboardMoveEvent.swift in Sources */,
130
+ F359D34F28133C26000B6AFE /* KeyboardControllerModule.m in Sources */,
131
+ F359D34D28133BE1000B6AFE /* KeyboardControllerModule.swift in Sources */,
132
+ F4FF95D7245B92E800C19C63 /* KeyboardControllerViewManager.swift in Sources */,
133
+ );
134
+ runOnlyForDeploymentPostprocessing = 0;
135
+ };
136
+ /* End PBXSourcesBuildPhase section */
137
+
138
+ /* Begin XCBuildConfiguration section */
139
+ 58B511ED1A9E6C8500147676 /* Debug */ = {
140
+ isa = XCBuildConfiguration;
141
+ buildSettings = {
142
+ ALWAYS_SEARCH_USER_PATHS = NO;
143
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
144
+ CLANG_CXX_LIBRARY = "libc++";
145
+ CLANG_ENABLE_MODULES = YES;
146
+ CLANG_ENABLE_OBJC_ARC = YES;
147
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
148
+ CLANG_WARN_BOOL_CONVERSION = YES;
149
+ CLANG_WARN_COMMA = YES;
150
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
151
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
152
+ CLANG_WARN_EMPTY_BODY = YES;
153
+ CLANG_WARN_ENUM_CONVERSION = YES;
154
+ CLANG_WARN_INFINITE_RECURSION = YES;
155
+ CLANG_WARN_INT_CONVERSION = YES;
156
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
157
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
158
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
159
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
160
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
161
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
162
+ CLANG_WARN_UNREACHABLE_CODE = YES;
163
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
164
+ COPY_PHASE_STRIP = NO;
165
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
166
+ ENABLE_TESTABILITY = YES;
167
+ GCC_C_LANGUAGE_STANDARD = gnu99;
168
+ GCC_DYNAMIC_NO_PIC = NO;
169
+ GCC_NO_COMMON_BLOCKS = YES;
170
+ GCC_OPTIMIZATION_LEVEL = 0;
171
+ GCC_PREPROCESSOR_DEFINITIONS = (
172
+ "DEBUG=1",
173
+ "$(inherited)",
174
+ );
175
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
176
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
177
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
178
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
179
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
180
+ GCC_WARN_UNUSED_FUNCTION = YES;
181
+ GCC_WARN_UNUSED_VARIABLE = YES;
182
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
183
+ MTL_ENABLE_DEBUG_INFO = YES;
184
+ ONLY_ACTIVE_ARCH = YES;
185
+ SDKROOT = iphoneos;
186
+ };
187
+ name = Debug;
188
+ };
189
+ 58B511EE1A9E6C8500147676 /* Release */ = {
190
+ isa = XCBuildConfiguration;
191
+ buildSettings = {
192
+ ALWAYS_SEARCH_USER_PATHS = NO;
193
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
194
+ CLANG_CXX_LIBRARY = "libc++";
195
+ CLANG_ENABLE_MODULES = YES;
196
+ CLANG_ENABLE_OBJC_ARC = YES;
197
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
198
+ CLANG_WARN_BOOL_CONVERSION = YES;
199
+ CLANG_WARN_COMMA = YES;
200
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
201
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
202
+ CLANG_WARN_EMPTY_BODY = YES;
203
+ CLANG_WARN_ENUM_CONVERSION = YES;
204
+ CLANG_WARN_INFINITE_RECURSION = YES;
205
+ CLANG_WARN_INT_CONVERSION = YES;
206
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
207
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
208
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
209
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
210
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
211
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
212
+ CLANG_WARN_UNREACHABLE_CODE = YES;
213
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
214
+ COPY_PHASE_STRIP = YES;
215
+ ENABLE_NS_ASSERTIONS = NO;
216
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
217
+ GCC_C_LANGUAGE_STANDARD = gnu99;
218
+ GCC_NO_COMMON_BLOCKS = YES;
219
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
220
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
221
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
222
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
223
+ GCC_WARN_UNUSED_FUNCTION = YES;
224
+ GCC_WARN_UNUSED_VARIABLE = YES;
225
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
226
+ MTL_ENABLE_DEBUG_INFO = NO;
227
+ SDKROOT = iphoneos;
228
+ VALIDATE_PRODUCT = YES;
229
+ };
230
+ name = Release;
231
+ };
232
+ 58B511F01A9E6C8500147676 /* Debug */ = {
233
+ isa = XCBuildConfiguration;
234
+ buildSettings = {
235
+ HEADER_SEARCH_PATHS = (
236
+ "$(inherited)",
237
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
238
+ "$(SRCROOT)/../../../React/**",
239
+ "$(SRCROOT)/../../react-native/React/**",
240
+ );
241
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
242
+ OTHER_LDFLAGS = "-ObjC";
243
+ PRODUCT_NAME = KeyboardController;
244
+ SKIP_INSTALL = YES;
245
+ SWIFT_OBJC_BRIDGING_HEADER = "KeyboardController-Bridging-Header.h";
246
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
247
+ SWIFT_VERSION = 5.0;
248
+ };
249
+ name = Debug;
250
+ };
251
+ 58B511F11A9E6C8500147676 /* Release */ = {
252
+ isa = XCBuildConfiguration;
253
+ buildSettings = {
254
+ HEADER_SEARCH_PATHS = (
255
+ "$(inherited)",
256
+ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
257
+ "$(SRCROOT)/../../../React/**",
258
+ "$(SRCROOT)/../../react-native/React/**",
259
+ );
260
+ LIBRARY_SEARCH_PATHS = "$(inherited)";
261
+ OTHER_LDFLAGS = "-ObjC";
262
+ PRODUCT_NAME = KeyboardController;
263
+ SKIP_INSTALL = YES;
264
+ SWIFT_OBJC_BRIDGING_HEADER = "KeyboardController-Bridging-Header.h";
265
+ SWIFT_VERSION = 5.0;
266
+ };
267
+ name = Release;
268
+ };
269
+ /* End XCBuildConfiguration section */
270
+
271
+ /* Begin XCConfigurationList section */
272
+ 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "KeyboardController" */ = {
273
+ isa = XCConfigurationList;
274
+ buildConfigurations = (
275
+ 58B511ED1A9E6C8500147676 /* Debug */,
276
+ 58B511EE1A9E6C8500147676 /* Release */,
277
+ );
278
+ defaultConfigurationIsVisible = 0;
279
+ defaultConfigurationName = Release;
280
+ };
281
+ 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "KeyboardController" */ = {
282
+ isa = XCConfigurationList;
283
+ buildConfigurations = (
284
+ 58B511F01A9E6C8500147676 /* Debug */,
285
+ 58B511F11A9E6C8500147676 /* Release */,
286
+ );
287
+ defaultConfigurationIsVisible = 0;
288
+ defaultConfigurationName = Release;
289
+ };
290
+ /* End XCConfigurationList section */
291
+ };
292
+ rootObject = 58B511D31A9E6C8500147676 /* Project object */;
293
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>KeyboardController.xcscheme_^#shared#^_</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ </dict>
14
+ </plist>
@@ -0,0 +1,10 @@
1
+ //
2
+ // Module-Bridging-Header.h
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>
@@ -0,0 +1,21 @@
1
+ //
2
+ // RCTBridge.m
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 22.04.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ #import "RCTBridgeModule.h"
10
+ #import "RCTEventEmitter.h"
11
+
12
+ @interface RCT_EXTERN_MODULE(KeyboardController, RCTEventEmitter)
13
+
14
+ // Android stubs
15
+ RCT_EXTERN_METHOD(setInputMode: (nonnull NSNumber*) mode)
16
+ RCT_EXTERN_METHOD(setDefaultMode)
17
+
18
+ // event emitter
19
+ RCT_EXTERN_METHOD(supportedEvents)
20
+
21
+ @end
@@ -0,0 +1,38 @@
1
+ //
2
+ // KeyboardController.swift
3
+ // KeyboardController
4
+ //
5
+ // Created by Kiryl Ziusko on 22.04.22.
6
+ // Copyright © 2022 Facebook. All rights reserved.
7
+ //
8
+
9
+ import Foundation
10
+ import UIKit
11
+ import AVFoundation
12
+
13
+ @objc(KeyboardController)
14
+ class KeyboardController: RCTEventEmitter {
15
+ public static var shared: KeyboardController?
16
+
17
+ override class func requiresMainQueueSetup() -> Bool {
18
+ return false
19
+ }
20
+
21
+ override init() {
22
+ super.init()
23
+ KeyboardController.shared = self
24
+ }
25
+
26
+ // Android stubs
27
+ @objc func setInputMode(_ mode: NSNumber!) {}
28
+ @objc func setDefaultMode() {}
29
+
30
+ @objc open override func supportedEvents() -> [String] {
31
+ return [
32
+ "KeyboardController::keyboardWillShow",
33
+ "KeyboardController::keyboardDidShow",
34
+ "KeyboardController::keyboardWillHide",
35
+ "KeyboardController::keyboardDidHide"
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,7 @@
1
+ #import "React/RCTViewManager.h"
2
+
3
+ @interface RCT_EXTERN_MODULE(KeyboardControllerViewManager, RCTViewManager)
4
+
5
+ RCT_EXPORT_VIEW_PROPERTY(onKeyboardMove, RCTDirectEventBlock);
6
+
7
+ @end