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.
- package/LICENSE +21 -0
- package/README.md +88 -0
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +129 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +3 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/EdgeToEdgeReactViewGroup.kt +18 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerModule.kt +39 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerPackage.kt +16 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/KeyboardControllerViewManager.kt +57 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/TranslateDeferringInsetsAnimationCallback.kt +150 -0
- package/android/src/main/java/com/reactnativekeyboardcontroller/events/KeyboardTransitionEvent.kt +23 -0
- package/ios/KeyboardController-Bridging-Header.h +1 -0
- package/ios/KeyboardController.xcodeproj/project.pbxproj +293 -0
- package/ios/KeyboardController.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/KeyboardController.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/KeyboardController.xcodeproj/project.xcworkspace/xcuserdata/kiryl.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/KeyboardController.xcodeproj/xcuserdata/kiryl.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/KeyboardControllerModule-Header.h +10 -0
- package/ios/KeyboardControllerModule.m +21 -0
- package/ios/KeyboardControllerModule.swift +38 -0
- package/ios/KeyboardControllerViewManager.m +7 -0
- package/ios/KeyboardControllerViewManager.swift +74 -0
- package/ios/KeyboardMoveEvent.swift +37 -0
- package/lib/commonjs/animated.js +145 -0
- package/lib/commonjs/animated.js.map +1 -0
- package/lib/commonjs/index.js +45 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/native.js +48 -0
- package/lib/commonjs/native.js.map +1 -0
- package/lib/commonjs/replicas.js +138 -0
- package/lib/commonjs/replicas.js.map +1 -0
- package/lib/module/animated.js +117 -0
- package/lib/module/animated.js.map +1 -0
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/native.js +32 -0
- package/lib/module/native.js.map +1 -0
- package/lib/module/replicas.js +114 -0
- package/lib/module/replicas.js.map +1 -0
- package/lib/typescript/animated.d.ts +22 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/native.d.ts +36 -0
- package/lib/typescript/replicas.d.ts +45 -0
- package/package.json +149 -0
- package/react-native-keyboard-controller.podspec +19 -0
- package/src/animated.tsx +166 -0
- package/src/index.ts +3 -0
- package/src/native.ts +82 -0
- package/src/replicas.ts +152 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Kiryl Ziusko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# react-native-keyboard-controller
|
|
2
|
+
|
|
3
|
+
Keyboard manager which works in identical way on both iOS and Android.
|
|
4
|
+
|
|
5
|
+
> **Note**: This library is still in development and in `alpha` stage. So most likely it has bugs/issues - don't hesitate to report if you find them 🙂.
|
|
6
|
+
|
|
7
|
+
## Demonstration
|
|
8
|
+
|
|
9
|
+
<div>
|
|
10
|
+
<img align="right" width="30%" style="margin-left: 20px" src="./gifs/ios.gif?raw=true">
|
|
11
|
+
<img align="right" width="30%" style="margin-left: 20px" src="./gifs/android.gif?raw=true">
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
- mapping keyboard appearance to animated values 😎
|
|
15
|
+
- missing `keyboardWillShow`/`keyboardWillHide` events are available on Android 😍
|
|
16
|
+
- module for changing soft input mode on Android 🤔
|
|
17
|
+
- reanimated support 🚀
|
|
18
|
+
- interactive keyboard dismissing (planned) 👆📱
|
|
19
|
+
- and more is coming... Stay tuned! 😊
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
Install `react-native-keyboard-controller` package from npm:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
yarn add react-native-keyboard-controller
|
|
27
|
+
|
|
28
|
+
# or
|
|
29
|
+
# npm install react-native-keyboard-controller --save
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
For more comprehensive usage you can have a look on [example](https://github.com/kirillzyusko/react-native-keyboard-controller/tree/main/example).
|
|
35
|
+
|
|
36
|
+
Below you can see a short overview of library API:
|
|
37
|
+
|
|
38
|
+
```js
|
|
39
|
+
import {
|
|
40
|
+
KeyboardProvider,
|
|
41
|
+
useKeyboardAnimation,
|
|
42
|
+
} from 'react-native-keyboard-controller';
|
|
43
|
+
|
|
44
|
+
// 1. wrap your app in Provider
|
|
45
|
+
<KeyboardProvider>
|
|
46
|
+
<AppContainer />
|
|
47
|
+
</KeyboardProvider>
|
|
48
|
+
|
|
49
|
+
// 2. get animation values where you need them
|
|
50
|
+
const { height, progress } = useKeyboardAnimation();
|
|
51
|
+
|
|
52
|
+
// 3. Animate any elements as you wish :)
|
|
53
|
+
<Animated.View
|
|
54
|
+
style={{
|
|
55
|
+
width: 50,
|
|
56
|
+
height: 50,
|
|
57
|
+
backgroundColor: 'red',
|
|
58
|
+
borderRadius: 25,
|
|
59
|
+
// the element will move up with the keyboard
|
|
60
|
+
transform: [{ translateY: height }],
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
<Animated.View
|
|
64
|
+
style={{
|
|
65
|
+
width: 50,
|
|
66
|
+
height: 50,
|
|
67
|
+
backgroundColor: 'green',
|
|
68
|
+
borderRadius: 25,
|
|
69
|
+
transform: [
|
|
70
|
+
{
|
|
71
|
+
// or use custom interpolation using `progress`
|
|
72
|
+
translateX: progress.interpolate({
|
|
73
|
+
inputRange: [0, 1],
|
|
74
|
+
outputRange: [0, 100],
|
|
75
|
+
}),
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
}}
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Contributing
|
|
83
|
+
|
|
84
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['KeyboardController_kotlinVersion']
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath 'com.android.tools.build:gradle:4.2.2'
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
apply plugin: 'com.android.library'
|
|
18
|
+
apply plugin: 'kotlin-android'
|
|
19
|
+
|
|
20
|
+
def getExtOrDefault(name) {
|
|
21
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['KeyboardController_' + name]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
def getExtOrIntegerDefault(name) {
|
|
25
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['KeyboardController_' + name]).toInteger()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
android {
|
|
29
|
+
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
|
|
30
|
+
defaultConfig {
|
|
31
|
+
minSdkVersion 16
|
|
32
|
+
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
|
|
33
|
+
versionCode 1
|
|
34
|
+
versionName "1.0"
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
buildTypes {
|
|
39
|
+
release {
|
|
40
|
+
minifyEnabled false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
lintOptions {
|
|
44
|
+
disable 'GradleCompatible'
|
|
45
|
+
}
|
|
46
|
+
compileOptions {
|
|
47
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
48
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
repositories {
|
|
53
|
+
mavenCentral()
|
|
54
|
+
google()
|
|
55
|
+
|
|
56
|
+
def found = false
|
|
57
|
+
def defaultDir = null
|
|
58
|
+
def androidSourcesName = 'React Native sources'
|
|
59
|
+
|
|
60
|
+
if (rootProject.ext.has('reactNativeAndroidRoot')) {
|
|
61
|
+
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
|
|
62
|
+
} else {
|
|
63
|
+
defaultDir = new File(
|
|
64
|
+
projectDir,
|
|
65
|
+
'/../../../node_modules/react-native/android'
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (defaultDir.exists()) {
|
|
70
|
+
maven {
|
|
71
|
+
url defaultDir.toString()
|
|
72
|
+
name androidSourcesName
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
|
|
76
|
+
found = true
|
|
77
|
+
} else {
|
|
78
|
+
def parentDir = rootProject.projectDir
|
|
79
|
+
|
|
80
|
+
1.upto(5, {
|
|
81
|
+
if (found) return true
|
|
82
|
+
parentDir = parentDir.parentFile
|
|
83
|
+
|
|
84
|
+
def androidSourcesDir = new File(
|
|
85
|
+
parentDir,
|
|
86
|
+
'node_modules/react-native'
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
def androidPrebuiltBinaryDir = new File(
|
|
90
|
+
parentDir,
|
|
91
|
+
'node_modules/react-native/android'
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
if (androidPrebuiltBinaryDir.exists()) {
|
|
95
|
+
maven {
|
|
96
|
+
url androidPrebuiltBinaryDir.toString()
|
|
97
|
+
name androidSourcesName
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
|
|
101
|
+
found = true
|
|
102
|
+
} else if (androidSourcesDir.exists()) {
|
|
103
|
+
maven {
|
|
104
|
+
url androidSourcesDir.toString()
|
|
105
|
+
name androidSourcesName
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
|
|
109
|
+
found = true
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (!found) {
|
|
115
|
+
throw new GradleException(
|
|
116
|
+
"${project.name}: unable to locate React Native android sources. " +
|
|
117
|
+
"Ensure you have you installed React Native as a dependency in your project and try again."
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
def kotlin_version = getExtOrDefault('kotlinVersion')
|
|
123
|
+
|
|
124
|
+
dependencies {
|
|
125
|
+
// noinspection GradleDynamicVersion
|
|
126
|
+
api 'com.facebook.react:react-native:+'
|
|
127
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
128
|
+
implementation 'androidx.core:core-ktx:1.5.0-beta03'
|
|
129
|
+
}
|
|
Binary file
|
package/android/gradlew
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
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" "$@"
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.reactnativekeyboardcontroller
|
|
2
|
+
|
|
3
|
+
import androidx.core.view.WindowCompat
|
|
4
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
5
|
+
import com.facebook.react.views.view.ReactViewGroup
|
|
6
|
+
|
|
7
|
+
class EdgeToEdgeReactViewGroup(private val reactContext: ThemedReactContext) : ReactViewGroup(reactContext) {
|
|
8
|
+
override fun onAttachedToWindow() {
|
|
9
|
+
super.onAttachedToWindow()
|
|
10
|
+
|
|
11
|
+
reactContext.currentActivity?.let {
|
|
12
|
+
WindowCompat.setDecorFitsSystemWindows(
|
|
13
|
+
it.window,
|
|
14
|
+
false
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
package com.reactnativekeyboardcontroller
|
|
2
|
+
|
|
3
|
+
import android.view.WindowManager
|
|
4
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
5
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
6
|
+
import com.facebook.react.bridge.ReactMethod
|
|
7
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
8
|
+
|
|
9
|
+
class KeyboardControllerModule(private val mReactContext: ReactApplicationContext) : ReactContextBaseJavaModule(mReactContext) {
|
|
10
|
+
private val mDefaultMode: Int = mReactContext.currentActivity?.window?.attributes?.softInputMode ?: WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED
|
|
11
|
+
|
|
12
|
+
override fun getName(): String = "KeyboardController"
|
|
13
|
+
|
|
14
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
15
|
+
fun setInputMode(mode: Int) {
|
|
16
|
+
setSoftInputMode(mode)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
20
|
+
fun setDefaultMode() {
|
|
21
|
+
setSoftInputMode(mDefaultMode)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@ReactMethod
|
|
25
|
+
fun addListener(eventName: String?) {
|
|
26
|
+
/* Required for RN built-in Event Emitter Calls. */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@ReactMethod
|
|
30
|
+
fun removeListeners(count: Int?) {
|
|
31
|
+
/* Required for RN built-in Event Emitter Calls. */
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private fun setSoftInputMode(mode: Int) {
|
|
35
|
+
UiThreadUtil.runOnUiThread {
|
|
36
|
+
mReactContext.currentActivity?.window?.setSoftInputMode(mode)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.reactnativekeyboardcontroller
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.ReactPackage
|
|
4
|
+
import com.facebook.react.bridge.NativeModule
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import com.facebook.react.uimanager.ViewManager
|
|
7
|
+
|
|
8
|
+
class KeyboardControllerPackage : ReactPackage {
|
|
9
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
10
|
+
return listOf(KeyboardControllerModule(reactContext))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
14
|
+
return listOf(KeyboardControllerViewManager(reactContext))
|
|
15
|
+
}
|
|
16
|
+
}
|