Skip to content
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

ReactTextShadowNode.UNSET is not available on RN 0.74.1 #7881

Open
1 task done
manakuro opened this issue May 26, 2024 · 13 comments
Open
1 task done

ReactTextShadowNode.UNSET is not available on RN 0.74.1 #7881

manakuro opened this issue May 26, 2024 · 13 comments

Comments

@manakuro
Copy link

What happened?

The build failed on Android because of not resolving the symbol ReactTextShadowNode.UNSET on RN 0.74.1 anymore.

        || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
                                                                            ^
  symbol:   variable UNSET
  location: class ReactTextShadowNode

|| ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {

Since the code was refactored in this PR on 0.74.1, instead of using the ReactTextShadowNode.UNSET, we need to switch it to the ReactConstants.UNSET.

What was the expected behaviour?

The build succeeded.

Was it tested on latest react-native-navigation?

  • I have tested this issue on the latest react-native-navigation release and it still reproduces.

Help us reproduce this issue!

Build on RN 0.74.1.

In what environment did this happen?

React Native Navigation version: 7.39.2
React Native version: 0.74.1
Has Fabric (React Native's new rendering system) enabled: no
Node version: 20.12.2
Device model:
Android version: 14

@Pobx
Copy link

Pobx commented May 31, 2024

I have a same problem with you.

@bisak
Copy link

bisak commented May 31, 2024

Yup, same.

@ygundewar
Copy link

Same issue on Android. In iOS navigation is working fine.

@SpiZeak
Copy link

SpiZeak commented Jun 5, 2024

I'm dealing with this aswell, anyone got a temp fix?

@ertugruldogan
Copy link

Workaround
RN: 0.74.2
RNN: 7.40.0

node_modules\react-native-navigation\lib\android\app\src\main\java\com\reactnativenavigation\utils\ReactTypefaceUtils.java

if ((weight == Typeface.BOLD) || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
replace
if ((weight == Typeface.BOLD) || ((oldStyle & Typeface.BOLD) != 0)) {


if ((style == Typeface.ITALIC) || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) {
replace
if ((style == Typeface.ITALIC) || ((oldStyle & Typeface.ITALIC) != 0)) {

@manakuro
Copy link
Author

manakuro commented Jun 13, 2024

The workaround could be to change the ReactTextShadowNode.UNSET to the ReactConstants.UNSET and apply the patch.

diff --git a/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java b/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java
index 834d734f154a9e25cbf53a8ae20de6b9f7e215b7..fe0336d17e8ea689a7ae3cab06554b7da76f5a1b 100644
--- a/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java
+++ b/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java
@@ -18,8 +18,8 @@ import android.graphics.Typeface;
 import android.text.TextUtils;
 import androidx.annotation.Nullable;
 import com.facebook.react.bridge.ReadableArray;
+import com.facebook.react.common.ReactConstants;
 import com.facebook.react.views.text.ReactFontManager;
-import com.facebook.react.views.text.ReactTextShadowNode;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -96,12 +96,12 @@ public class ReactTypefaceUtils {
 
     int want = 0;
     if ((weight == Typeface.BOLD)
-        || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
+        || ((oldStyle & Typeface.BOLD) != 0 && weight == ReactConstants.UNSET)) {
       want |= Typeface.BOLD;
     }
 
     if ((style == Typeface.ITALIC)
-        || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) {
+        || ((oldStyle & Typeface.ITALIC) != 0 && style == ReactConstants.UNSET)) {
       want |= Typeface.ITALIC;
     }

@diolegend
Copy link

Any solution?

@simonecorsato
Copy link

The merge request #7886 is still in draft status

@nicolaosm
Copy link

Still looking forward for this fix to be merged. Thanks

@ygundewar
Copy link

I have resolved this issue by changing navigation library. Used @react-navigation/native-stack for navigation. Change your navigation library & then try it will work.

@sayurimizuguchi
Copy link

sayurimizuguchi commented Jul 24, 2024

The merge request #7886 is still in draft status

I am just waiting for them to remove the CI exception to run and be able to check if everything is all right or if any other changes are needed. I recommend using patch-package for now, while we do not have a version, in the case where it is not so easy to switch a navigation library of your app mainly if you have lots of functionality to use from it.

@fxricky
Copy link

fxricky commented Aug 3, 2024

pending for this fix too

@brifiction
Copy link

brifiction commented Aug 9, 2024

Thanks a bunch @manakuro, for #7881 (comment) solution! ❤️

Also waiting on this patch (see #7821 (comment)) 🙏 .

These issues are halting dev progression for react-native = 0.73.x (and above, including 0.74.5).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests