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

Support lazy/turbo packages #356

Open
lithin opened this issue Apr 25, 2019 · 3 comments
Open

Support lazy/turbo packages #356

lithin opened this issue Apr 25, 2019 · 3 comments
Labels
feature request no-stale-bot This issue cannot be marked as stale by stale bot

Comments

@lithin
Copy link
Contributor

lithin commented Apr 25, 2019

Describe the Feature

As described by Ram in his article, Android can greatly benefit from using LazyReactPackage or TurboReactPackage to decrease startup time.

It requires adding annotations to native modules themselves but is also backwards compatible in the sense that if annotation is missing, the module still gets loaded, only not lazily.

From performance perspective, it's also better not to wrap every module in its own package - instead of nesting them, we can only have one package to wrap all native modules.

Possible Implementations

As part of the work on react-native config, we could update the MainApplication.java changes to include only one TurboReactPackage with all native modules in it.

@janicduplessis
Copy link
Contributor

janicduplessis commented Aug 3, 2019

Here's what the generated code should look like: https://gist.github.com/janicduplessis/6256d4bda0a59dd345654dacae106ea2.

Also this confirms that the approach of using a single TurboReactPackage is right https://twitter.com/nparashuram/status/1157483387864489984.

Instead of adding a package per module we should add all native modules and view managers from each linked library to a single TurboReactPackage. We might need a way for libs to declare view manager and native modules classes. For native modules it could be possible to find them by checking for the @ReactModule annotation. For view managers this might be more complex since there is no annotation and we'd have to follow the inheritance chain to find if a class is a subclass of ViewManager.

@sbearben
Copy link

sbearben commented Dec 29, 2019

@janicduplessis thank you for sharing that gist! From the twitter thread regarding using ReactModuleSpecProcessor:

Actually it looks super easy to do, just need to tell the java compiler where the annotation processor is

Can you explain how you did this with gradle?

@github-actions
Copy link

github-actions bot commented Dec 1, 2022

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

@github-actions github-actions bot added the stale label Dec 1, 2022
@thymikee thymikee added no-stale-bot This issue cannot be marked as stale by stale bot and removed stale labels Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request no-stale-bot This issue cannot be marked as stale by stale bot
Projects
None yet
Development

No branches or pull requests

4 participants