-
-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] Make module compatible with RN 0.73.0 #439
Closed
ivanignatiev opened this issue
Oct 10, 2023
· 3 comments
· Fixed by #462 · 4 remaining pull requests
Closed
[Android] Make module compatible with RN 0.73.0 #439
ivanignatiev opened this issue
Oct 10, 2023
· 3 comments
· Fixed by #462 · 4 remaining pull requests
Labels
Comments
It seems that deleted from RN0.73. |
I added patch file with patch-package and passed build error, but I'm not sure that this is same behavior with previous working library. Can anybody check this change? // react-native-safe-area-context+4.5.0.patch
diff --git a/node_modules/react-native-safe-area-context/android/build.gradle b/node_modules/react-native-safe-area-context/android/build.gradle
index bfdc938..985ea34 100644
--- a/node_modules/react-native-safe-area-context/android/build.gradle
+++ b/node_modules/react-native-safe-area-context/android/build.gradle
@@ -32,6 +32,7 @@ if (isNewArchitectureEnabled()) {
}
android {
+ namespace 'com.th3rdwave.safeareacontext'
compileSdkVersion getExtOrDefault('compileSdkVersion', 30)
// Used to override the NDK path/version on internal CI or by allowing
diff --git a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt
index 2d29dbd..6480fef 100644
--- a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt
+++ b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt
@@ -4,39 +4,41 @@ import android.content.Context
import android.util.Log
import android.view.View
import android.view.ViewTreeObserver
-import com.facebook.react.bridge.Arguments
-import com.facebook.react.uimanager.FabricViewStateManager
-import com.facebook.react.uimanager.FabricViewStateManager.HasFabricViewStateManager
+import com.facebook.react.bridge.WritableNativeMap
+import com.facebook.react.uimanager.StateWrapper
import com.facebook.react.uimanager.UIManagerModule
import com.facebook.react.views.view.ReactViewGroup
-import java.util.*
+import java.util.EnumSet
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.withLock
+
private const val MAX_WAIT_TIME_NANO = 500000000L // 500ms
class SafeAreaView(context: Context?) :
- ReactViewGroup(context), ViewTreeObserver.OnPreDrawListener, HasFabricViewStateManager {
+ ReactViewGroup(context), ViewTreeObserver.OnPreDrawListener {
private var mMode = SafeAreaViewMode.PADDING
private var mInsets: EdgeInsets? = null
private var mEdges: EnumSet<SafeAreaViewEdges>? = null
private var mProviderView: View? = null
- private val mFabricViewStateManager = FabricViewStateManager()
+ private var mStateWrapper: StateWrapper? = null
+
+ fun getStateWrapper(): StateWrapper? {
+ return mStateWrapper
+ }
- override fun getFabricViewStateManager(): FabricViewStateManager {
- return mFabricViewStateManager
+ fun setStateWrapper(stateWrapper: StateWrapper?) {
+ mStateWrapper = stateWrapper
}
private fun updateInsets() {
val insets = mInsets
if (insets != null) {
val edges = mEdges ?: EnumSet.allOf(SafeAreaViewEdges::class.java)
- if (mFabricViewStateManager.hasStateWrapper()) {
- mFabricViewStateManager.setState {
- val map = Arguments.createMap()
- map.putMap("insets", edgeInsetsToJsMap(insets))
- map
- }
+ if (mStateWrapper != null) {
+ val map = WritableNativeMap()
+ map.putMap("insets", edgeInsetsToJsMap(insets))
+ mStateWrapper?.updateState(map)
} else {
val localData = SafeAreaViewLocalData(insets = insets, mode = mMode, edges = edges)
val reactContext = getReactContext(this)
diff --git a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.kt b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.kt
index cc62a62..d921779 100644
--- a/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.kt
+++ b/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaViewManager.kt
@@ -67,7 +67,7 @@ class SafeAreaViewManager : ReactViewManager(), RNCSafeAreaViewManagerInterface<
props: ReactStylesDiffMap?,
stateWrapper: StateWrapper?
): Any? {
- (view as SafeAreaView).fabricViewStateManager.setStateWrapper(stateWrapper)
+ (view as SafeAreaView).setStateWrapper(stateWrapper)
return null
}
|
@lafest Thank you for patch! I have tested on my app and all screens are acting normally without any difference. |
mateusz1913
added a commit
to mateusz1913/react-native-safe-area-context
that referenced
this issue
Dec 19, 2023
…sage FabricStateViewManager is deprecated in RN core and it should be migrated just to direct usage of StateWrapper (it should be safe to use it even with older versions of RN)
janicduplessis
pushed a commit
that referenced
this issue
Dec 20, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Geting Unresolved reference errors when building for Android.
New architecture is disabled. I have tried to add
export USE_FABRIC=1
but it has not changed anything.There is some breaking changes in RN 0.73 react-native-community/discussions-and-proposals#671 but I have not found anything related to this issue.
The text was updated successfully, but these errors were encountered: