Skip to content

Commit 99e53d8

Browse files
authored
chore(Android): remove legacy architecture related code (#3836)
## Description This PR removes all Paper-related code leftovers on Android. Closes software-mansion/react-native-screens-labs#1033 ## Changes - remove `ReactProp` annotations from `SearchBarManager.kt` - remove new architecture guards from `build.gradle` and `CMakeLists.txt` ## Before & after - visual documentation N/A ## Test plan Build app. ## Checklist - [ ] Ensured that CI passes
1 parent f8eb7de commit 99e53d8

3 files changed

Lines changed: 11 additions & 49 deletions

File tree

android/CMakeLists.txt

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.9.0)
22

33
project(rnscreens)
44

5-
if(${RNS_NEW_ARCH_ENABLED})
65
add_library(rnscreens
76
SHARED
87
../cpp/RNScreensTurboModule.cpp
@@ -11,13 +10,6 @@ add_library(rnscreens
1110
./src/main/cpp/NativeProxy.cpp
1211
./src/main/cpp/OnLoad.cpp
1312
)
14-
else()
15-
add_library(rnscreens
16-
SHARED
17-
../cpp/RNScreensTurboModule.cpp
18-
./src/main/cpp/jni-adapter.cpp
19-
)
20-
endif()
2113

2214
include_directories(
2315
../cpp
@@ -37,18 +29,11 @@ target_compile_definitions(
3729
)
3830

3931
find_package(ReactAndroid REQUIRED CONFIG)
32+
find_package(fbjni REQUIRED CONFIG)
4033

41-
if(${RNS_NEW_ARCH_ENABLED})
42-
find_package(fbjni REQUIRED CONFIG)
43-
target_link_libraries(rnscreens
44-
ReactAndroid::reactnative
45-
ReactAndroid::jsi
46-
fbjni::fbjni
47-
android
48-
)
49-
else()
50-
target_link_libraries(rnscreens
51-
ReactAndroid::jsi
52-
android
53-
)
54-
endif()
34+
target_link_libraries(rnscreens
35+
ReactAndroid::reactnative
36+
ReactAndroid::jsi
37+
fbjni::fbjni
38+
android
39+
)

android/build.gradle

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,6 @@ def isRunningInContextOfScreensRepo() {
3030
return project == rootProject
3131
}
3232

33-
def isNewArchitectureEnabled() {
34-
// To opt-in for the New Architecture, you can either:
35-
// - Set `newArchEnabled` to true inside the `gradle.properties` file
36-
// - Invoke gradle with `-newArchEnabled=true`
37-
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
38-
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
39-
}
40-
4133
def areDebugLogsEnabled() {
4234
return project.hasProperty("rnsDebugLogsEnabled") && project.rnsDebugLogsEnabled == "true"
4335
}
@@ -85,12 +77,12 @@ def resolveReactNativeDirectory() {
8577
"You should set project extension property (in `app/build.gradle`) `REACT_NATIVE_NODE_MODULES_DIR` with path to react-native.")
8678
}
8779

88-
// spotless is only accessible within react-native-screens repo
80+
// spotless is only accessible within react-native-screens repo, while the RN Gradle
81+
// plugin is registered by the host app's settings.gradle — it's not on the classpath
82+
// in standalone repo context, so applying it here would fail during Gradle configuration.
8983
if (isRunningInContextOfScreensRepo()) {
9084
apply from: 'spotless.gradle'
91-
}
92-
93-
if (isNewArchitectureEnabled()) {
85+
} else {
9486
apply plugin: "com.facebook.react"
9587
}
9688
apply plugin: 'com.android.library'
@@ -114,8 +106,6 @@ file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { rea
114106
def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
115107
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()
116108

117-
def IS_NEW_ARCHITECTURE_ENABLED = isNewArchitectureEnabled()
118-
119109
android {
120110
compileSdkVersion safeExtGet('compileSdkVersion', rnsDefaultCompileSdkVersion)
121111
namespace "com.swmansion.rnscreens"
@@ -134,7 +124,6 @@ android {
134124
targetSdkVersion safeExtGet(['targetSdkVersion', 'targetSdk'], rnsDefaultTargetSdkVersion)
135125
versionCode 1
136126
versionName "1.0"
137-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", IS_NEW_ARCHITECTURE_ENABLED.toString()
138127
buildConfigField "boolean", "RNS_GAMMA_ENABLED", isGammaEnabled().toString()
139128
buildConfigField "boolean", "RNS_DEBUG_LOGGING", areDebugLogsEnabled().toString()
140129
ndk {
@@ -143,7 +132,6 @@ android {
143132
externalNativeBuild {
144133
cmake {
145134
arguments "-DANDROID_STL=c++_shared",
146-
"-DRNS_NEW_ARCH_ENABLED=${IS_NEW_ARCHITECTURE_ENABLED}",
147135
"-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON"
148136
}
149137
}

android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.facebook.react.module.annotations.ReactModule
55
import com.facebook.react.uimanager.ThemedReactContext
66
import com.facebook.react.uimanager.ViewGroupManager
77
import com.facebook.react.uimanager.ViewManagerDelegate
8-
import com.facebook.react.uimanager.annotations.ReactProp
98
import com.facebook.react.viewmanagers.RNSSearchBarManagerDelegate
109
import com.facebook.react.viewmanagers.RNSSearchBarManagerInterface
1110
import com.swmansion.rnscreens.events.SearchBarBlurEvent
@@ -36,7 +35,6 @@ class SearchBarManager :
3635
view.onUpdate()
3736
}
3837

39-
@ReactProp(name = "autoCapitalize")
4038
override fun setAutoCapitalize(
4139
view: SearchBarView,
4240
autoCapitalize: String?,
@@ -53,31 +51,27 @@ class SearchBarManager :
5351
}
5452
}
5553

56-
@ReactProp(name = "autoFocus")
5754
override fun setAutoFocus(
5855
view: SearchBarView,
5956
autoFocus: Boolean,
6057
) {
6158
view.autoFocus = autoFocus
6259
}
6360

64-
@ReactProp(name = "barTintColor", customType = "Color")
6561
override fun setBarTintColor(
6662
view: SearchBarView,
6763
color: Int?,
6864
) {
6965
view.tintColor = color
7066
}
7167

72-
@ReactProp(name = "disableBackButtonOverride")
7368
override fun setDisableBackButtonOverride(
7469
view: SearchBarView,
7570
disableBackButtonOverride: Boolean,
7671
) {
7772
view.shouldOverrideBackButton = disableBackButtonOverride != true
7873
}
7974

80-
@ReactProp(name = "inputType")
8175
override fun setInputType(
8276
view: SearchBarView,
8377
inputType: String?,
@@ -94,7 +88,6 @@ class SearchBarManager :
9488
}
9589
}
9690

97-
@ReactProp(name = "placeholder")
9891
override fun setPlaceholder(
9992
view: SearchBarView,
10093
placeholder: String?,
@@ -104,31 +97,27 @@ class SearchBarManager :
10497
}
10598
}
10699

107-
@ReactProp(name = "textColor", customType = "Color")
108100
override fun setTextColor(
109101
view: SearchBarView,
110102
color: Int?,
111103
) {
112104
view.textColor = color
113105
}
114106

115-
@ReactProp(name = "headerIconColor", customType = "Color")
116107
override fun setHeaderIconColor(
117108
view: SearchBarView,
118109
color: Int?,
119110
) {
120111
view.headerIconColor = color
121112
}
122113

123-
@ReactProp(name = "hintTextColor", customType = "Color")
124114
override fun setHintTextColor(
125115
view: SearchBarView,
126116
color: Int?,
127117
) {
128118
view.hintTextColor = color
129119
}
130120

131-
@ReactProp(name = "shouldShowHintSearchIcon")
132121
override fun setShouldShowHintSearchIcon(
133122
view: SearchBarView,
134123
shouldShowHintSearchIcon: Boolean,

0 commit comments

Comments
 (0)