Skip to content

Commit

Permalink
[RNKC-067] - android autolinking (#77)
Browse files Browse the repository at this point in the history
## 📜 Description

Removed all C++ code that was responsible for autolinking.

## 💡 Motivation and Context

Since RN 0.70 supports autolinking we need to remove old code that we
used before for automatic autolinking.

## 📢 Changelog

### JS
- use new CLI declaration for codegen;

### iOS
- renamed imports;

### Android
- removed Android.mk code;
- removed related C++ code;

## 🤔 How Has This Been Tested?

Tested manually on iOS/Android devices.

## 📝 Checklist

- [x] CI successfully passed
  • Loading branch information
kirillzyusko authored Oct 5, 2022
1 parent 5cd0e84 commit 0121aa0
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 250 deletions.
40 changes: 0 additions & 40 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,41 +46,11 @@ android {
versionCode 1
versionName "1.0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {
var appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21",
"APP_STL=c++_shared",
"NDK_TOOLCHAIN_VERSION=clang",
"GENERATED_SRC_DIR=${appProject.buildDir}/generated/source",
"PROJECT_BUILD_DIR=${appProject.buildDir}",
"REACT_ANDROID_DIR=${appProject.rootDir}/../node_modules/react-native/ReactAndroid",
"REACT_ANDROID_BUILD_DIR=${appProject.rootDir}/../node_modules/react-native/ReactAndroid/build"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17"
targets "reactnativekeyboardcontroller_modules"
}
}
}
ndk {
abiFilters (*reactNativeArchitectures())
}
}

if (isNewArchitectureEnabled()) {
externalNativeBuild {
ndkBuild {
path "src/main/jni/Android.mk"
}
}

packagingOptions {
exclude "**/libreact_render_*.so"
exclude "**/librrc_root.so"
}
}

sourceSets {
main {
if (isNewArchitectureEnabled()) {
Expand Down Expand Up @@ -186,13 +156,3 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0-beta03'
}

if (isNewArchitectureEnabled()) {
react {
reactNativeDir = rootProject.file("../node_modules/react-native/")
jsRootDir = file("../src/specs/")
codegenDir = rootProject.file("../node_modules/react-native-codegen/")
libraryName = "reactnativekeyboardcontroller"
codegenJavaPackageName = "com.reactnativekeyboardcontroller"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ import com.facebook.react.ReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
import com.facebook.soloader.SoLoader

class KeyboardControllerPackage : ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
return listOf(KeyboardControllerModule(reactContext), StatusBarManagerCompatModule(reactContext))
}

override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
SoLoader.loadLibrary("reactnativekeyboardcontroller_modules")
}

return listOf(KeyboardControllerViewManager(reactContext))
}
}
42 changes: 0 additions & 42 deletions android/src/main/jni/Android.mk

This file was deleted.

71 changes: 0 additions & 71 deletions android/src/main/jni/KeyboardControllerComponentsRegistry.cpp

This file was deleted.

35 changes: 0 additions & 35 deletions android/src/main/jni/KeyboardControllerComponentsRegistry.h

This file was deleted.

9 changes: 0 additions & 9 deletions android/src/main/jni/OnLoad.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion ios/KeyboardControllerModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Thanks to this guard, we won't import this header when we build for the old architecture.
#ifdef RCT_NEW_ARCH_ENABLED
#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import "RNKeyboardControllerSpec.h"
#import <reactnativekeyboardcontroller/reactnativekeyboardcontroller.h>
#endif

#import "KeyboardControllerModule-Header.h"
Expand Down
8 changes: 4 additions & 4 deletions ios/KeyboardControllerView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
#import "KeyboardMoveEvent.h"
#import "react_native_keyboard_controller-Swift.h"

#import <react/renderer/components/RNKeyboardControllerViewSpec/ComponentDescriptors.h>
#import <react/renderer/components/RNKeyboardControllerViewSpec/EventEmitters.h>
#import <react/renderer/components/RNKeyboardControllerViewSpec/Props.h>
#import <react/renderer/components/RNKeyboardControllerViewSpec/RCTComponentViewHelpers.h>
#import <react/renderer/components/reactnativekeyboardcontroller/ComponentDescriptors.h>
#import <react/renderer/components/reactnativekeyboardcontroller/EventEmitters.h>
#import <react/renderer/components/reactnativekeyboardcontroller/Props.h>
#import <react/renderer/components/reactnativekeyboardcontroller/RCTComponentViewHelpers.h>

#import <React/RCTBridge+Private.h>

Expand Down
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,11 @@
]
},
"codegenConfig": {
"libraries": [
{
"name": "RNKeyboardControllerSpec",
"type": "modules",
"jsSrcsDir": "src/specs"
},
{
"name": "RNKeyboardControllerViewSpec",
"type": "components",
"jsSrcsDir": "src/specs"
}
]
"name": "reactnativekeyboardcontroller",
"type": "all",
"jsSrcsDir": "./src/specs",
"android": {
"javaPackageName": "com.reactnativekeyboardcontroller"
}
}
}

0 comments on commit 0121aa0

Please sign in to comment.