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

[docs] SDK 50 Native Upgrade Helper doesn't show how to properly link a custom Android Native Module #28239

Open
bpeltonc opened this issue Apr 16, 2024 · 1 comment

Comments

@bpeltonc
Copy link
Contributor

Summary

I upgraded my bare React Native project from Expo SDK 49 to 50 following the great new upgrade helper from Expo. This made to process of upgrading much simpler, but there was one slight problem. The MainApplication.kt file seems to have a broken getPackages() method. When I originally migrated the file from Java to Kotlin, I wrote it as described in the Expo Upgrade Helper

override fun getPackages(): List<ReactPackage> {
  // Packages that cannot be autolinked yet can be added manually here, for example:
  // packages.add(new MyReactNativePackage());
  return PackageList(this).packages
}

Uncommenting the packages.add call fails the build.

I looked at the React Native guide for creating a Native Module and found this code block for the getPackages() method.

override fun getPackages(): List<ReactPackage> =
    PackageList(this).packages.apply {
        // Packages that cannot be autolinked yet can be added manually here, for example:
        // packages.add(new MyReactNativePackage());
        add(MyAppPackage())
    }

I rewrote the code as suggested by that documentation and it builds and works as expected.

Please update the documentation accordingly.

Link to the related docs page

https://docs.expo.dev/bare/upgrade/?fromSdk=49&toSdk=50#androidappsrcmainjavacomhelloworldmainapplicationkt

Anything else?

No response

@bpeltonc bpeltonc added the docs label Apr 16, 2024
@bpeltonc bpeltonc changed the title [docs] Following SDK 50 Native Upgrade Helper doesn't show how to properly link a custom Android Native Module [docs] SDK 50 Native Upgrade Helper doesn't show how to properly link a custom Android Native Module Apr 16, 2024
@expo-bot
Copy link
Collaborator

Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.

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

3 participants