Skip to content

Commit

Permalink
[RNKC-004] - reanme package to react-native-keyboard-controller
Browse files Browse the repository at this point in the history
  • Loading branch information
kirillzyusko committed Apr 20, 2022
1 parent b922cea commit 4d4a488
Show file tree
Hide file tree
Showing 37 changed files with 219 additions and 217 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ Remember to add tests for your change if possible. Run the unit tests by:
yarn test
```

To edit the Objective-C files, open `example/ios/KeyboardEventsExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-keyboard-events`.
To edit the Objective-C files, open `example/ios/KeyboardControllerExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-keyboard-controller`.

To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativekeyboardevents` under `Android`.
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `reactnativekeyboardcontroller` under `Android`.

### Commit message convention

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# react-native-keyboard-events
# react-native-keyboard-controller

Platform agnostic keyboard manager

## Installation

```sh
npm install react-native-keyboard-events
npm install react-native-keyboard-controller
```

## Usage

```js
import { KeyboardEventsView } from "react-native-keyboard-events";
import { KeyboardControllerView } from "react-native-keyboard-controller";

// ...

<KeyboardEventsView color="tomato" />
<KeyboardControllerView color="tomato" />
```

## Contributing
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['KeyboardEvents_kotlinVersion']
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['KeyboardController_kotlinVersion']

repositories {
google()
Expand All @@ -18,11 +18,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['KeyboardEvents_' + name]
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['KeyboardController_' + name]
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['KeyboardEvents_' + name]).toInteger()
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['KeyboardController_' + name]).toInteger()
}

android {
Expand Down
6 changes: 3 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
KeyboardEvents_kotlinVersion=1.3.50
KeyboardEvents_compileSdkVersion=29
KeyboardEvents_targetSdkVersion=29
KeyboardController_kotlinVersion=1.3.50
KeyboardController_compileSdkVersion=29
KeyboardController_targetSdkVersion=29
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reactnativekeyboardevents">
package="com.reactnativekeyboardcontroller">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.reactnativekeyboardevents
package com.reactnativekeyboardcontroller

import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager

class KeyboardEventsPackage : ReactPackage {
class KeyboardControllerPackage : ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
return emptyList()
}

override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
return listOf(KeyboardEventsViewManager(reactContext))
return listOf(KeyboardControllerViewManager(reactContext))
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactnativekeyboardevents
package com.reactnativekeyboardcontroller

import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
Expand All @@ -10,7 +10,7 @@ import com.facebook.react.uimanager.ThemedReactContext
import com.facebook.react.uimanager.UIManagerModule
import com.facebook.react.views.view.ReactViewGroup
import com.facebook.react.views.view.ReactViewManager
import com.reactnativekeyboardevents.events.KeyboardTransitionEvent
import com.reactnativekeyboardcontroller.events.KeyboardTransitionEvent
import java.util.*
import kotlin.concurrent.schedule

Expand All @@ -23,7 +23,7 @@ import kotlin.concurrent.schedule
// 6. (x) Стили не применяются к кастомной вьюшке - унаследовался от реактовской компоненты
// 7. (x) Не мапится ивент на анимейтед (addListener ничего не возвращает) - see 5, 8
// 8. (x) useNativeDriver: false - createAnimatedComponent
class KeyboardEventsViewManager(reactContext: ReactApplicationContext?) : ReactViewManager() {
class KeyboardControllerViewManager(reactContext: ReactApplicationContext?) : ReactViewManager() {
private var mReactContext = reactContext;
init {
/*println("LALALA")
Expand All @@ -46,7 +46,7 @@ class KeyboardEventsViewManager(reactContext: ReactApplicationContext?) : ReactV
)*/
}

override fun getName() = "KeyboardEventsView"
override fun getName() = "KeyboardControllerView"

override fun createViewInstance(reactContext: ThemedReactContext): ReactViewGroup {
val view = ReactViewGroup(reactContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
* limitations under the License.
*/

package com.reactnativekeyboardevents
package com.reactnativekeyboardcontroller

import androidx.core.graphics.Insets
import androidx.core.view.WindowInsetsAnimationCompat
import androidx.core.view.WindowInsetsCompat
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.UIManagerModule
import com.reactnativekeyboardevents.events.KeyboardTransitionEvent
import com.reactnativekeyboardcontroller.events.KeyboardTransitionEvent

/**
* A [WindowInsetsAnimationCompat.Callback] which will translate/move the given view during any
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactnativekeyboardevents.events
package com.reactnativekeyboardcontroller.events

import com.facebook.react.bridge.Arguments
import com.facebook.react.uimanager.events.Event
Expand Down
10 changes: 5 additions & 5 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import com.android.build.OutputFile
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for KeyboardEventsExample: to disable dev mode in the staging build type (if configured)
* // for KeyboardControllerExample: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
Expand All @@ -64,7 +64,7 @@ import com.android.build.OutputFile
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for KeyboardEventsExample, you might want to remove it from here.
* // for KeyboardControllerExample, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
Expand Down Expand Up @@ -100,7 +100,7 @@ def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For KeyboardEventsExample, to use the international variant, you can use:
* For KeyboardControllerExample, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
Expand Down Expand Up @@ -128,7 +128,7 @@ android {
}

defaultConfig {
applicationId "com.example.reactnativekeyboardevents"
applicationId "com.example.reactnativekeyboardcontroller"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
Expand Down Expand Up @@ -204,7 +204,7 @@ dependencies {
implementation jscFlavor
}

implementation project(':reactnativekeyboardevents')
implementation project(':reactnativekeyboardcontroller')
}

// Run this once to be able to run the application with BUCK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
* directory of this source tree.
*/
package com.example.reactnativekeyboardevents;
package com.example.reactnativekeyboardcontroller;

import android.content.Context;
import com.facebook.flipper.android.AndroidFlipperClient;
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.reactnativekeyboardevents">
package="com.example.reactnativekeyboardcontroller">

<uses-permission android:name="android.permission.INTERNET" />

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.reactnativekeyboardevents;
package com.example.reactnativekeyboardcontroller;

import android.os.Bundle;

Expand All @@ -7,14 +7,13 @@
import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "KeyboardEventsExample";
return "KeyboardControllerExample";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.reactnativekeyboardevents;
package com.example.reactnativekeyboardcontroller;

import android.app.Application;
import android.content.Context;
Expand All @@ -10,7 +10,7 @@
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.reactnativekeyboardevents.KeyboardEventsPackage;
import com.reactnativekeyboardcontroller.KeyboardControllerPackage;

public class MainApplication extends Application implements ReactApplication {

Expand All @@ -25,9 +25,9 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for KeyboardEventsExample:
// Packages that cannot be autolinked yet can be added manually here, for KeyboardControllerExample:
// packages.add(new MyReactNativePackage());
packages.add(new KeyboardEventsPackage());
packages.add(new KeyboardControllerPackage());
return packages;
}

Expand Down Expand Up @@ -61,7 +61,7 @@ private static void initializeFlipper(Context context, ReactInstanceManager reac
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.example.reactnativekeyboardevents.ReactNativeFlipper");
Class<?> aClass = Class.forName("com.example.reactnativekeyboardcontroller.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">KeyboardEvents Example</string>
<string name="app_name">KeyboardController Example</string>
</resources>
6 changes: 3 additions & 3 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
rootProject.name = 'KeyboardEventsExample'
rootProject.name = 'KeyboardControllerExample'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

include ':reactnativekeyboardevents'
project(':reactnativekeyboardevents').projectDir = new File(rootProject.projectDir, '../../android')
include ':reactnativekeyboardcontroller'
project(':reactnativekeyboardcontroller').projectDir = new File(rootProject.projectDir, '../../android')
4 changes: 2 additions & 2 deletions example/app.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "KeyboardEventsExample",
"displayName": "KeyboardEvents Example"
"name": "KeyboardControllerExample",
"displayName": "KeyboardController Example"
}
2 changes: 1 addition & 1 deletion example/ios/File.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// File.swift
// KeyboardEventsExample
// KeyboardControllerExample
//

import Foundation
Loading

0 comments on commit 4d4a488

Please sign in to comment.