Coder Social home page Coder Social logo

Comments (11)

jbroma avatar jbroma commented on June 25, 2024

Hey @krzysztofzaluski

p6 is isTurboModule, it comes from this gradle function:

def isNewArchitectureEnabled() {
  return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

I'm guessing you don't have a variable named newArchEnabled in your <project>/android/gradle.properties. Adding that there should fix this issue. Nevertheless, we should fix this by providing a fallback value of false in this case.

from repack.

krzysztofzaluski avatar krzysztofzaluski commented on June 25, 2024

hey @jbroma

I got this line in my android/gradle.properties file and it's set to false:

newArchEnabled=false

I also searched project for this flag and found this in BuildConfig.java:

  // Field from default config.
  public static final boolean IS_NEW_ARCHITECTURE_ENABLED = false;

which is used in MainApplication.java:

                @Override
                protected boolean isNewArchEnabled() {
                    return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
                }

from repack.

krzysztofzaluski avatar krzysztofzaluski commented on June 25, 2024

@jbroma
I started snooping around in the codes and noticed something like this:
ReactModuleInfo.class:

    public ReactModuleInfo(String name, String className, boolean canOverrideExistingModule, boolean needsEagerInit, boolean hasConstants, boolean isCxxModule, boolean isTurboModule) {
        this.mName = name;
        this.mClassName = className;
        this.mCanOverrideExistingModule = canOverrideExistingModule;
        this.mNeedsEagerInit = needsEagerInit;
        this.mHasConstants = hasConstants;
        this.mIsCxxModule = isCxxModule;
        this.mIsTurboModule = isTurboModule;
    }

it has 7 params but you are passing 6 params here getReactModuleInfoProvider():

            moduleInfos[ScriptManagerModule.NAME] = ReactModuleInfo(
                ScriptManagerModule.NAME,
                ScriptManagerModule.NAME,
                false,  // canOverrideExistingModule
                true,  // needsEagerInit
                false,  // isCxxModule
                isTurboModule // isTurboModule
            )

so there is an error: No value passed for parameter 'isTurboModule'

from repack.

jbroma avatar jbroma commented on June 25, 2024

oh yeah, absolutely right, I miscounted the first time apparently! Great find, feel free to open a PR 🎉

from repack.

krzysztofzaluski avatar krzysztofzaluski commented on June 25, 2024

@jbroma ok, but what value should be passed there as hasConstants?

from repack.

jbroma avatar jbroma commented on June 25, 2024

good question, according to this it's a very rare optimisation and 99% it should be set to true. Seems like this was also deprecated, and new constructor without this hasConstants was introduced, so it's very likely this is an issue only on 0.71 (this needs veryfing)

from repack.

krzysztofzaluski avatar krzysztofzaluski commented on June 25, 2024

@jbroma
in my case if I pass there the value "true" then the application after building immediately closes
for the value "false" it seems to work correctly

I'm going to upgrade my react native version to 0.74 to verify if this is a problem with my current 0.71 version or not and I'll let you know

I have prepared a patch for "patch-package" if anyone needs it:

@callstack+repack+4.0.0.patch

diff --git a/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt b/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
index 8f65da6..480fc41 100644
--- a/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
+++ b/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
@@ -27,6 +27,7 @@ class ScriptManagerPackage : TurboReactPackage() {
                 /** default value is false, but we should initialize it as quick as possible*/
                 true,  // needsEagerInit
                 false,  // isCxxModule
+                false, // hasConstants
                 isTurboModule // isTurboModule
             )
             moduleInfos

from repack.

jbroma avatar jbroma commented on June 25, 2024

So the versions affected are < 0.73, 0.72 falls into that so we need to fix this.

Thanks for the investigation @krzysztofzaluski, would you like to submit a PR with this change? 🙏

from repack.

krzysztofzaluski avatar krzysztofzaluski commented on June 25, 2024

@jbroma I didn't updated RN 0.74 to verify it yet, I'm going to do that and let you know if it's the case and then I can make a PR

from repack.

jbroma avatar jbroma commented on June 25, 2024

I did launch new arch with 0.73 and 0.74 and it didn't seem to be affected, this param was removed so it's essentially ignored from 0.73

from repack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.