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

React Native Gradle Plugin Shouldn't only be for New Architecture #547

Closed
1 of 2 tasks
robertwt7 opened this issue Apr 16, 2024 · 7 comments
Closed
1 of 2 tasks

React Native Gradle Plugin Shouldn't only be for New Architecture #547

robertwt7 opened this issue Apr 16, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@robertwt7
Copy link

Description

This line in the build.gradle


if (isNewArchitectureEnabled()) {
  apply plugin: "com.facebook.react"
}

At this point the gradle plugin also helps replacing react-native to react-android from mavenCentral. should this plugin also applies to app without new architecture? I fail to see why is this only needed for new architecture

sorry if this is a dumb report

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

Link to repro

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

Environment

React Native

@robertwt7 robertwt7 added the bug Something isn't working label Apr 16, 2024
@satya164
Copy link
Member

At this point the gradle plugin also helps replacing react-native to react-android from mavenCentral

Isn't the plugin from the app doing that? Have you verified that it's needed?

The example app uses the latest React Native template and this setup works fine.

@robertwt7
Copy link
Author

yeah the plugin is supposed to do that, but the template is only installing the new architecture is enabled from the code here:

 if (isNewArchitectureEnabled()) { 
   apply plugin: "com.facebook.react" 
 } 

When I create new react native app, in the build.gradle, it installs the com.facebook.react anyway without any loop conditions

Try creating with this and see the build.gradle:

npx react-native@latest init AwesomeProject

@satya164
Copy link
Member

Not sure what you mean. What's the problem exactly? Is there an issue when using the module with the old architecture?

@robertwt7
Copy link
Author

The problem is that the template to create new module only installs the plugin on the new architecture while react native example on new projects installs it without any condition.

I'll try my module with the old architecture this week once i've finalised it. but shouldn't the template be the same with react native example? I'm not sure how better I can be at explaining the problem if you still can't see it. I can still try to reproduce it with the old architecture

@satya164
Copy link
Member

satya164 commented Apr 17, 2024

Why should the library template be the same as example app? Library and apps are different things.

The templates are based on examples from Meta which adds the plugin conditionally.

Either way, if the current setup is working without any problems then I don't see why this is an issue. For this to be an issue it needs to be breaking something or causing problems.

@robertwt7
Copy link
Author

robertwt7 commented Apr 17, 2024

Yeah that make sense, I was just curious why initially because my app have some problems that was supposed to be fixed by the gradle plugin but it's not installed because of the condition. I didn't know the reason why is that there that's why.

The templates are based on examples from Meta which adds the plugin conditionally.

Got it. it seems that from one of the main android package in react native repo it doesn't have the conditions though?

I can't see any other examples because the main docs from React Native points to your repo to create a new module

@satya164 satya164 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants