react-native-keyboard-controller 1.1.0 → 1.3.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 (101) hide show
  1. package/android/build.gradle +32 -3
  2. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +25 -0
  3. package/android/src/fabric/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +32 -0
  4. package/android/src/fabric/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +25 -0
  5. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardAnimationCallback.kt +6 -6
  6. package/android/src/main/java/com/reactnativekeyboardcontroller/{KeyboardControllerModule.kt → KeyboardControllerModuleImpl.kt} +5 -17
  7. package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +45 -4
  8. package/android/src/main/java/com/reactnativekeyboardcontroller/{KeyboardControllerViewManager.kt → KeyboardControllerViewManagerImpl.kt} +8 -9
  9. package/android/src/main/java/com/reactnativekeyboardcontroller/{StatusBarManagerCompatModule.kt → StatusBarManagerCompatImpl.kt} +10 -14
  10. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +31 -0
  11. package/android/src/paper/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +26 -0
  12. package/android/src/paper/java/com/reactnativekeyboardcontroller/StatusBarManagerCompatModule.kt +34 -0
  13. package/ios/.clang-format +1 -1
  14. package/ios/KeyboardController.xcodeproj/project.pbxproj +20 -16
  15. package/ios/KeyboardControllerModule-Header.h +6 -2
  16. package/ios/KeyboardControllerModule.mm +105 -0
  17. package/ios/KeyboardControllerView.h +23 -0
  18. package/ios/KeyboardControllerView.mm +81 -0
  19. package/ios/{KeyboardControllerViewManager.m → KeyboardControllerViewManager.mm} +0 -0
  20. package/ios/KeyboardControllerViewManager.swift +2 -2
  21. package/ios/KeyboardMoveEvent.h +18 -0
  22. package/ios/KeyboardMoveEvent.m +74 -0
  23. package/lib/commonjs/animated.js +14 -59
  24. package/lib/commonjs/animated.js.map +1 -1
  25. package/lib/commonjs/context.js +28 -0
  26. package/lib/commonjs/context.js.map +1 -0
  27. package/lib/commonjs/hooks.js +39 -0
  28. package/lib/commonjs/hooks.js.map +1 -0
  29. package/lib/commonjs/index.js +39 -0
  30. package/lib/commonjs/index.js.map +1 -1
  31. package/lib/commonjs/internal.js +27 -0
  32. package/lib/commonjs/internal.js.map +1 -0
  33. package/lib/commonjs/monkey-patch.js +3 -1
  34. package/lib/commonjs/monkey-patch.js.map +1 -1
  35. package/lib/commonjs/native.js +24 -19
  36. package/lib/commonjs/native.js.map +1 -1
  37. package/lib/commonjs/replicas.js +2 -2
  38. package/lib/commonjs/replicas.js.map +1 -1
  39. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js +16 -0
  40. package/lib/commonjs/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  41. package/lib/commonjs/specs/NativeKeyboardController.js +13 -0
  42. package/lib/commonjs/specs/NativeKeyboardController.js.map +1 -0
  43. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js +13 -0
  44. package/lib/commonjs/specs/NativeStatusBarManagerCompat.js.map +1 -0
  45. package/lib/commonjs/types.js +6 -0
  46. package/lib/commonjs/types.js.map +1 -0
  47. package/lib/module/animated.js +12 -50
  48. package/lib/module/animated.js.map +1 -1
  49. package/lib/module/context.js +18 -0
  50. package/lib/module/context.js.map +1 -0
  51. package/lib/module/hooks.js +20 -0
  52. package/lib/module/hooks.js.map +1 -0
  53. package/lib/module/index.js +3 -0
  54. package/lib/module/index.js.map +1 -1
  55. package/lib/module/internal.js +19 -0
  56. package/lib/module/internal.js.map +1 -0
  57. package/lib/module/monkey-patch.js +4 -2
  58. package/lib/module/monkey-patch.js.map +1 -1
  59. package/lib/module/native.js +23 -16
  60. package/lib/module/native.js.map +1 -1
  61. package/lib/module/replicas.js +1 -1
  62. package/lib/module/replicas.js.map +1 -1
  63. package/lib/module/specs/KeyboardControllerViewNativeComponent.js +4 -0
  64. package/lib/module/specs/KeyboardControllerViewNativeComponent.js.map +1 -0
  65. package/lib/module/specs/NativeKeyboardController.js +3 -0
  66. package/lib/module/specs/NativeKeyboardController.js.map +1 -0
  67. package/lib/module/specs/NativeStatusBarManagerCompat.js +3 -0
  68. package/lib/module/specs/NativeStatusBarManagerCompat.js.map +1 -0
  69. package/lib/module/types.js +2 -0
  70. package/lib/module/types.js.map +1 -0
  71. package/lib/typescript/animated.d.ts +1 -17
  72. package/lib/typescript/context.d.ts +16 -0
  73. package/lib/typescript/hooks.d.ts +4 -0
  74. package/lib/typescript/index.d.ts +3 -0
  75. package/lib/typescript/internal.d.ts +4 -0
  76. package/lib/typescript/native.d.ts +15 -27
  77. package/lib/typescript/specs/KeyboardControllerViewNativeComponent.d.ts +13 -0
  78. package/lib/typescript/specs/NativeKeyboardController.d.ts +10 -0
  79. package/lib/typescript/specs/NativeStatusBarManagerCompat.d.ts +10 -0
  80. package/lib/typescript/types.d.ts +23 -0
  81. package/package.json +20 -8
  82. package/react-native-keyboard-controller.podspec +21 -1
  83. package/src/animated.tsx +12 -75
  84. package/src/context.ts +28 -0
  85. package/src/hooks.ts +28 -0
  86. package/src/index.ts +3 -0
  87. package/src/internal.ts +27 -0
  88. package/src/{monkey-patch.tsx → monkey-patch.ts} +3 -2
  89. package/src/native.ts +37 -61
  90. package/src/replicas.ts +1 -1
  91. package/src/specs/KeyboardControllerViewNativeComponent.ts +23 -0
  92. package/src/specs/NativeKeyboardController.ts +16 -0
  93. package/src/specs/NativeStatusBarManagerCompat.ts +13 -0
  94. package/src/types.ts +42 -0
  95. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  96. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  97. package/android/gradlew +0 -185
  98. package/android/gradlew.bat +0 -89
  99. package/ios/KeyboardControllerModule.m +0 -21
  100. package/ios/KeyboardControllerModule.swift +0 -53
  101. package/ios/KeyboardMoveEvent.swift +0 -41
package/src/native.ts CHANGED
@@ -1,81 +1,57 @@
1
- import { useEffect } from 'react';
2
- import {
3
- requireNativeComponent,
4
- UIManager,
5
- Platform,
6
- NativeModules,
7
- NativeEventEmitter,
8
- NativeSyntheticEvent,
9
- ViewProps,
10
- } from 'react-native';
1
+ import { Platform, NativeEventEmitter } from 'react-native';
2
+
3
+ import type {
4
+ KeyboardControllerEvents,
5
+ KeyboardControllerModule,
6
+ KeyboardEventData,
7
+ } from './types';
11
8
 
12
9
  const LINKING_ERROR =
13
10
  `The package 'react-native-keyboard-controller' doesn't seem to be linked. Make sure: \n\n` +
14
11
  Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
15
12
  '- You rebuilt the app after installing the package\n' +
16
- '- You are not using Expo managed workflow\n';
13
+ '- You are not using Expo Go\n';
17
14
 
15
+ // copied from `android.view.WindowManager.LayoutParams`
18
16
  export enum AndroidSoftInputModes {
19
17
  SOFT_INPUT_ADJUST_NOTHING = 48,
20
18
  SOFT_INPUT_ADJUST_PAN = 32,
21
19
  SOFT_INPUT_ADJUST_RESIZE = 16,
22
20
  SOFT_INPUT_ADJUST_UNSPECIFIED = 0,
21
+ SOFT_INPUT_IS_FORWARD_NAVIGATION = 256,
22
+ SOFT_INPUT_MASK_ADJUST = 240,
23
+ SOFT_INPUT_MASK_STATE = 15,
24
+ SOFT_INPUT_MODE_CHANGED = 512,
25
+ SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3,
26
+ SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5,
27
+ SOFT_INPUT_STATE_HIDDEN = 2,
28
+ SOFT_INPUT_STATE_UNCHANGED = 1,
29
+ SOFT_INPUT_STATE_UNSPECIFIED = 0,
30
+ SOFT_INPUT_STATE_VISIBLE = 4,
23
31
  }
24
32
 
25
- export type NativeEvent = {
26
- progress: number;
27
- height: number;
28
- };
29
- export type EventWithName<T> = {
30
- eventName: string;
31
- } & T;
32
- export type KeyboardControllerProps = {
33
- onKeyboardMove: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
34
- // fake prop used to activate reanimated bindings
35
- onKeyboardMoveReanimated: (
36
- e: NativeSyntheticEvent<EventWithName<NativeEvent>>
37
- ) => void;
38
- statusBarTranslucent?: boolean;
39
- } & ViewProps;
40
- type KeyboardController = {
41
- // android only
42
- setDefaultMode: () => void;
43
- setInputMode: (mode: AndroidSoftInputModes) => void;
44
- };
45
-
46
- const ComponentName = 'KeyboardControllerView';
47
-
48
- const RCTKeyboardController = NativeModules.KeyboardController;
49
- export const KeyboardController = RCTKeyboardController as KeyboardController;
33
+ const RCTKeyboardController =
34
+ require('./specs/NativeKeyboardController').default;
35
+ export const KeyboardController = (
36
+ RCTKeyboardController
37
+ ? RCTKeyboardController
38
+ : new Proxy(
39
+ {},
40
+ {
41
+ get() {
42
+ throw new Error(LINKING_ERROR);
43
+ },
44
+ }
45
+ )
46
+ ) as KeyboardControllerModule;
47
+
48
+ const eventEmitter = new NativeEventEmitter(KeyboardController);
50
49
 
51
- const eventEmitter = new NativeEventEmitter(RCTKeyboardController);
52
- type KeyboardControllerEvents =
53
- | 'keyboardWillShow'
54
- | 'keyboardDidShow'
55
- | 'keyboardWillHide'
56
- | 'keyboardDidHide';
57
- type KeyboardEvent = {
58
- height: number;
59
- };
60
50
  export const KeyboardEvents = {
61
51
  addListener: (
62
52
  name: KeyboardControllerEvents,
63
- cb: (e: KeyboardEvent) => void
53
+ cb: (e: KeyboardEventData) => void
64
54
  ) => eventEmitter.addListener('KeyboardController::' + name, cb),
65
55
  };
66
56
  export const KeyboardControllerView =
67
- UIManager.getViewManagerConfig(ComponentName) != null
68
- ? requireNativeComponent<KeyboardControllerProps>(ComponentName)
69
- : () => {
70
- throw new Error(LINKING_ERROR);
71
- };
72
-
73
- export const useResizeMode = () => {
74
- useEffect(() => {
75
- KeyboardController.setInputMode(
76
- AndroidSoftInputModes.SOFT_INPUT_ADJUST_RESIZE
77
- );
78
-
79
- return () => KeyboardController.setDefaultMode();
80
- }, []);
81
- };
57
+ require('./specs/KeyboardControllerViewNativeComponent').default;
package/src/replicas.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  useWorkletCallback,
9
9
  withSpring,
10
10
  } from 'react-native-reanimated';
11
- import { useReanimatedKeyboardAnimation } from './animated';
11
+ import { useReanimatedKeyboardAnimation } from './hooks';
12
12
 
13
13
  import { AndroidSoftInputModes, KeyboardController } from './native';
14
14
 
@@ -0,0 +1,23 @@
1
+ import type { HostComponent } from 'react-native';
2
+ // @ts-expect-error - no type definition
3
+ import type { ViewProps } from 'react-native/Libraries/Components/View/ViewPropTypes';
4
+ import type {
5
+ DirectEventHandler,
6
+ Float,
7
+ Int32,
8
+ } from 'react-native/Libraries/Types/CodegenTypes';
9
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
10
+
11
+ type KeyboardMoveEvent = Readonly<{
12
+ height: Int32;
13
+ progress: Float;
14
+ }>;
15
+
16
+ export interface NativeProps extends ViewProps {
17
+ statusBarTranslucent?: boolean;
18
+ onKeyboardMove?: DirectEventHandler<KeyboardMoveEvent>;
19
+ }
20
+
21
+ export default codegenNativeComponent<NativeProps>(
22
+ 'KeyboardControllerView'
23
+ ) as HostComponent<NativeProps>;
@@ -0,0 +1,16 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ readonly getConstants: () => {};
6
+
7
+ // methods
8
+ setInputMode(mode: number): void;
9
+ setDefaultMode(): void;
10
+
11
+ // event emitter
12
+ addListener: (eventName: string) => void;
13
+ removeListeners: (count: number) => void;
14
+ }
15
+
16
+ export default TurboModuleRegistry.get<Spec>('KeyboardController');
@@ -0,0 +1,13 @@
1
+ import type { TurboModule } from 'react-native';
2
+ import { TurboModuleRegistry } from 'react-native';
3
+
4
+ export interface Spec extends TurboModule {
5
+ readonly getConstants: () => {};
6
+
7
+ setHidden(hidden: boolean): void;
8
+ setColor(color: number, animated: boolean): void;
9
+ setTranslucent(translucent: boolean): void;
10
+ setStyle(style: string): void;
11
+ }
12
+
13
+ export default TurboModuleRegistry.get<Spec>('StatusBarManagerCompat');
package/src/types.ts ADDED
@@ -0,0 +1,42 @@
1
+ import type { NativeSyntheticEvent, ViewProps } from 'react-native';
2
+
3
+ // DirectEventHandler events declaration
4
+
5
+ export type NativeEvent = {
6
+ progress: number;
7
+ height: number;
8
+ };
9
+ export type EventWithName<T> = {
10
+ eventName: string;
11
+ } & T;
12
+
13
+ // native View/Module declarations
14
+
15
+ export type KeyboardControllerProps = {
16
+ onKeyboardMove: (e: NativeSyntheticEvent<EventWithName<NativeEvent>>) => void;
17
+ // fake prop used to activate reanimated bindings
18
+ onKeyboardMoveReanimated: (
19
+ e: NativeSyntheticEvent<EventWithName<NativeEvent>>
20
+ ) => void;
21
+ statusBarTranslucent?: boolean;
22
+ } & ViewProps;
23
+
24
+ export type KeyboardControllerModule = {
25
+ // android only
26
+ setDefaultMode: () => void;
27
+ setInputMode: (mode: number) => void;
28
+ // native event module stuff
29
+ addListener: (eventName: string) => void;
30
+ removeListeners: (count: number) => void;
31
+ };
32
+
33
+ // Event module declarations
34
+
35
+ export type KeyboardControllerEvents =
36
+ | 'keyboardWillShow'
37
+ | 'keyboardDidShow'
38
+ | 'keyboardWillHide'
39
+ | 'keyboardDidHide';
40
+ export type KeyboardEventData = {
41
+ height: number;
42
+ };
@@ -1,5 +0,0 @@
1
- distributionBase=GRADLE_USER_HOME
2
- distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
4
- zipStoreBase=GRADLE_USER_HOME
5
- zipStorePath=wrapper/dists
package/android/gradlew DELETED
@@ -1,185 +0,0 @@
1
- #!/usr/bin/env sh
2
-
3
- #
4
- # Copyright 2015 the original author or authors.
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # https://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
- #
18
-
19
- ##############################################################################
20
- ##
21
- ## Gradle start up script for UN*X
22
- ##
23
- ##############################################################################
24
-
25
- # Attempt to set APP_HOME
26
- # Resolve links: $0 may be a link
27
- PRG="$0"
28
- # Need this for relative symlinks.
29
- while [ -h "$PRG" ] ; do
30
- ls=`ls -ld "$PRG"`
31
- link=`expr "$ls" : '.*-> \(.*\)$'`
32
- if expr "$link" : '/.*' > /dev/null; then
33
- PRG="$link"
34
- else
35
- PRG=`dirname "$PRG"`"/$link"
36
- fi
37
- done
38
- SAVED="`pwd`"
39
- cd "`dirname \"$PRG\"`/" >/dev/null
40
- APP_HOME="`pwd -P`"
41
- cd "$SAVED" >/dev/null
42
-
43
- APP_NAME="Gradle"
44
- APP_BASE_NAME=`basename "$0"`
45
-
46
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
-
49
- # Use the maximum available, or set MAX_FD != -1 to use that value.
50
- MAX_FD="maximum"
51
-
52
- warn () {
53
- echo "$*"
54
- }
55
-
56
- die () {
57
- echo
58
- echo "$*"
59
- echo
60
- exit 1
61
- }
62
-
63
- # OS specific support (must be 'true' or 'false').
64
- cygwin=false
65
- msys=false
66
- darwin=false
67
- nonstop=false
68
- case "`uname`" in
69
- CYGWIN* )
70
- cygwin=true
71
- ;;
72
- Darwin* )
73
- darwin=true
74
- ;;
75
- MINGW* )
76
- msys=true
77
- ;;
78
- NONSTOP* )
79
- nonstop=true
80
- ;;
81
- esac
82
-
83
- CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
-
85
-
86
- # Determine the Java command to use to start the JVM.
87
- if [ -n "$JAVA_HOME" ] ; then
88
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
- # IBM's JDK on AIX uses strange locations for the executables
90
- JAVACMD="$JAVA_HOME/jre/sh/java"
91
- else
92
- JAVACMD="$JAVA_HOME/bin/java"
93
- fi
94
- if [ ! -x "$JAVACMD" ] ; then
95
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
-
97
- Please set the JAVA_HOME variable in your environment to match the
98
- location of your Java installation."
99
- fi
100
- else
101
- JAVACMD="java"
102
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
-
104
- Please set the JAVA_HOME variable in your environment to match the
105
- location of your Java installation."
106
- fi
107
-
108
- # Increase the maximum file descriptors if we can.
109
- if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
- MAX_FD_LIMIT=`ulimit -H -n`
111
- if [ $? -eq 0 ] ; then
112
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
- MAX_FD="$MAX_FD_LIMIT"
114
- fi
115
- ulimit -n $MAX_FD
116
- if [ $? -ne 0 ] ; then
117
- warn "Could not set maximum file descriptor limit: $MAX_FD"
118
- fi
119
- else
120
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
- fi
122
- fi
123
-
124
- # For Darwin, add options to specify how the application appears in the dock
125
- if $darwin; then
126
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
- fi
128
-
129
- # For Cygwin or MSYS, switch paths to Windows format before running java
130
- if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
-
134
- JAVACMD=`cygpath --unix "$JAVACMD"`
135
-
136
- # We build the pattern for arguments to be converted via cygpath
137
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
- SEP=""
139
- for dir in $ROOTDIRSRAW ; do
140
- ROOTDIRS="$ROOTDIRS$SEP$dir"
141
- SEP="|"
142
- done
143
- OURCYGPATTERN="(^($ROOTDIRS))"
144
- # Add a user-defined pattern to the cygpath arguments
145
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
- fi
148
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
- i=0
150
- for arg in "$@" ; do
151
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
-
154
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
- else
157
- eval `echo args$i`="\"$arg\""
158
- fi
159
- i=`expr $i + 1`
160
- done
161
- case $i in
162
- 0) set -- ;;
163
- 1) set -- "$args0" ;;
164
- 2) set -- "$args0" "$args1" ;;
165
- 3) set -- "$args0" "$args1" "$args2" ;;
166
- 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
- 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
- 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
- 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
- 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
- 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
- esac
173
- fi
174
-
175
- # Escape application args
176
- save () {
177
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
- echo " "
179
- }
180
- APP_ARGS=`save "$@"`
181
-
182
- # Collect all arguments for the java command, following the shell quoting and substitution rules
183
- eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
-
185
- exec "$JAVACMD" "$@"
@@ -1,89 +0,0 @@
1
- @rem
2
- @rem Copyright 2015 the original author or authors.
3
- @rem
4
- @rem Licensed under the Apache License, Version 2.0 (the "License");
5
- @rem you may not use this file except in compliance with the License.
6
- @rem You may obtain a copy of the License at
7
- @rem
8
- @rem https://www.apache.org/licenses/LICENSE-2.0
9
- @rem
10
- @rem Unless required by applicable law or agreed to in writing, software
11
- @rem distributed under the License is distributed on an "AS IS" BASIS,
12
- @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- @rem See the License for the specific language governing permissions and
14
- @rem limitations under the License.
15
- @rem
16
-
17
- @if "%DEBUG%" == "" @echo off
18
- @rem ##########################################################################
19
- @rem
20
- @rem Gradle startup script for Windows
21
- @rem
22
- @rem ##########################################################################
23
-
24
- @rem Set local scope for the variables with windows NT shell
25
- if "%OS%"=="Windows_NT" setlocal
26
-
27
- set DIRNAME=%~dp0
28
- if "%DIRNAME%" == "" set DIRNAME=.
29
- set APP_BASE_NAME=%~n0
30
- set APP_HOME=%DIRNAME%
31
-
32
- @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
- for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
-
35
- @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
- set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
-
38
- @rem Find java.exe
39
- if defined JAVA_HOME goto findJavaFromJavaHome
40
-
41
- set JAVA_EXE=java.exe
42
- %JAVA_EXE% -version >NUL 2>&1
43
- if "%ERRORLEVEL%" == "0" goto execute
44
-
45
- echo.
46
- echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
- echo.
48
- echo Please set the JAVA_HOME variable in your environment to match the
49
- echo location of your Java installation.
50
-
51
- goto fail
52
-
53
- :findJavaFromJavaHome
54
- set JAVA_HOME=%JAVA_HOME:"=%
55
- set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
-
57
- if exist "%JAVA_EXE%" goto execute
58
-
59
- echo.
60
- echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
- echo.
62
- echo Please set the JAVA_HOME variable in your environment to match the
63
- echo location of your Java installation.
64
-
65
- goto fail
66
-
67
- :execute
68
- @rem Setup the command line
69
-
70
- set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
-
72
-
73
- @rem Execute Gradle
74
- "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
-
76
- :end
77
- @rem End local scope for the variables with windows NT shell
78
- if "%ERRORLEVEL%"=="0" goto mainEnd
79
-
80
- :fail
81
- rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
- rem the _cmd.exe /c_ return code!
83
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
- exit /b 1
85
-
86
- :mainEnd
87
- if "%OS%"=="Windows_NT" endlocal
88
-
89
- :omega
@@ -1,21 +0,0 @@
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 <React/RCTBridgeModule.h>
10
- #import <React/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
@@ -1,53 +0,0 @@
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 AVFoundation
10
- import Foundation
11
- import UIKit
12
-
13
- @objc(KeyboardController)
14
- class KeyboardController: RCTEventEmitter {
15
- public static var shared: KeyboardController?
16
- private var hasListeners = false
17
-
18
- override class func requiresMainQueueSetup() -> Bool {
19
- return false
20
- }
21
-
22
- override init() {
23
- super.init()
24
- KeyboardController.shared = self
25
- }
26
-
27
- // Android stubs
28
- @objc func setInputMode(_: NSNumber!) {}
29
- @objc func setDefaultMode() {}
30
-
31
- @objc override open func supportedEvents() -> [String] {
32
- return [
33
- "KeyboardController::keyboardWillShow",
34
- "KeyboardController::keyboardDidShow",
35
- "KeyboardController::keyboardWillHide",
36
- "KeyboardController::keyboardDidHide",
37
- ]
38
- }
39
-
40
- @objc override open func startObserving() {
41
- hasListeners = true
42
- }
43
-
44
- @objc override open func stopObserving() {
45
- hasListeners = false
46
- }
47
-
48
- @objc override open func sendEvent(withName name: String!, body: Any!) {
49
- if hasListeners {
50
- super.sendEvent(withName: name, body: body)
51
- }
52
- }
53
- }
@@ -1,41 +0,0 @@
1
- //
2
- // KeyboardMoveEvent.swift
3
- // KeyboardController
4
- //
5
- // Created by Kiryl Ziusko on 26.04.22.
6
- // Copyright © 2022 Facebook. All rights reserved.
7
- //
8
-
9
- class KeyboardMoveEvent: NSObject, RCTEvent {
10
- var viewTag: NSNumber!
11
- var eventName: String = "onKeyboardMove"
12
- var coalescingKey: UInt16 = 0
13
- var height: NSNumber!
14
- var progress: NSNumber!
15
-
16
- func canCoalesce() -> Bool {
17
- return false
18
- }
19
-
20
- func coalesce(with newEvent: RCTEvent!) -> RCTEvent! {
21
- return newEvent
22
- }
23
-
24
- static func moduleDotMethod() -> String! {
25
- return "RCTEventEmitter.receiveEvent"
26
- }
27
-
28
- func arguments() -> [Any]! {
29
- return [
30
- viewTag,
31
- RCTNormalizeInputEventName(eventName),
32
- ["height": height, "progress": progress],
33
- ]
34
- }
35
-
36
- init(viewTag: NSNumber, height: NSNumber, progress: NSNumber) {
37
- self.viewTag = viewTag
38
- self.height = height
39
- self.progress = progress
40
- }
41
- }