Skip to content

Investigate the RN new architecture #2226

Closed

Activity

  1. changed the title [-]Investigate the RN new arquitecture[/-] [+]Investigate the RN new architecture[/+] on May 13, 2022
  2. github-actions commented on Jun 4, 2022

    @github-actions
    Contributor

    This issue has gone three weeks without activity. In another week, I will close it.

    But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


    "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

  3. marandaneto commented on Jul 26, 2022

    @marandaneto
    ContributorAuthor

    Why the new architecture?
    It uses JSI instead of the Bridge and other improvements.

    TurboModules: Ensure your App Provides an RCTCxxBridgeDelegate
    Fabric is the new RN's rendering system.
    Min Gradle and AGP version are 7.x.
    Hermes is enabled by default also here.
    iOS uses C++ 17 language features.
    iOS use Objective C++ and requires .mm extension.
    React 18 enabled by default.
    Min RN version is 0.68.
    CodeGen requires min RN version 0.70.

    SentryNativeBridgeModule is likely going to be auto generated and has to be adapted.

    • Drop RN versions older than 0.60.x 0.70.x, Check "react-native": ">=$version" on package.json
    • Import NativeModules on index.ts
    • Import RCTBridgeModule on RNSentry.h
    • Use RCT_REMAP_METHOD on RNSentry.m
    • Patch build script on Android on build.gradle
    • Add Turbo module on JS on RNSentry.ts NativeRNSentry.ts (naming convention given by the codegen scripts)
    • Add Turbo codegen on iOS on package.json
    • Add Turbo codegen on Android on build.gradle
    • Patch podspec on iOS on RNSentry.podspec
    • Patch RCT_NEW_ARCH_ENABLED on iOS on RNSentry.m RNSentry.mm
    • Make RNSentryPackage backward compatible on Android on RNSentryPackage.java
    • Patch build script with IS_NEW_ARCHITECTURE_ENABLED on Android on build.gradle
    • Patch package with IS_NEW_ARCHITECTURE_ENABLED on Android on RNSentryPackage.java
    • Create Codegen a NativeSentrySpec on Android
    • Create an impl of ReactContextBaseJavaModule on Android
    • Refactor the ModuleImpl to use the implementation created above on Android
    • Unify the JS interface on index.ts
    • Test Android and iOS with new architecture
    • Test Android and iOS with the old architecture
    • Fix sentry-wizard with new iOS command
    • Bump Sentry-CLI

    Ps:

    Autolinking doesn’t work with the new architecture out of the box. Therefore you need to ask the user of your library to do the following steps

    https://github.com/react-native-community/RNNewArchitectureLibraries/tree/feat/back-turbomodule#android-autolinking=

    We could patch https://github.com/getsentry/sentry-wizard to do that but we don't know if the new architecture is enabled or not within the final app.

    Chrome debugging doesn't work on New Architecture

  4. cipolleschi commented on Jul 26, 2022

    @cipolleschi

    Consider upgrading to the latest stable version as well https://react-native-community.github.io/upgrade-helper/?from=0.66.2&to=0.68.1

    The new stable version is 0.69.3

    CodeGen requires min RN version 0.70.

    Not really. Codegen works starting from the 0.67, however we worked on improving it and trying to simplify the setup. The page you linked is a draft of how to use Codegen that will be released together with 0.70, where we changed the syntax of the package.json and we unified how it should work for both ios and android.

    Autolinking doesn’t work with the new architecture out of the box. Therefore you need to ask the user of your library to do the following steps

    Autolinking for iOS works since 0.68.
    Autolinking for Android is coming with 0.70.

  5. marandaneto commented on Jul 26, 2022

    @marandaneto
    ContributorAuthor

    @cipolleschi Thank you.

  6. cipolleschi commented on Jul 26, 2022

    @cipolleschi

    Here you can find a full migration from 0.67.4 to 0.70.0-rc.0

  7. 6 remaining items

  8. cipolleschi commented on Oct 3, 2022

    @cipolleschi

    That link is a bit outdated. I suggest that you use v0.70 as reference instead of 0.68. We changed several things and simplified the migration process a bit.. And we are continuously improving it.
    Migrating to 0.71, as soon as we release that, will be even easier!

  9. krystofwoldrich commented on Oct 5, 2022

    @krystofwoldrich
    Contributor

    @cipolleschi Thanks for the info. I'm now following all the docs for 0.70.

  10. krystofwoldrich commented on Oct 6, 2022

    @krystofwoldrich
    Contributor

    Upgrade to React 18 can be done after JS SDK is also on 18. Since Rect.Component types are not copatible.

  11. krystofwoldrich commented on Oct 7, 2022

    @krystofwoldrich
    Contributor
    • Drop RN versions older than 0.60.x, Check "react-native": ">=$version" on package.json

    @marandaneto So we would change this all the way to 0.70.x for the 5.0.0 release?

  12. marandaneto commented on Oct 7, 2022

    @marandaneto
    ContributorAuthor

    Upgrade to React 18 can be done after JS SDK is also on 18. Since Rect.Component types are not copatible.

    Sounds like a problem, does 0.70.x require React 18?
    Does it work if people use React 18 but the SDK does not?

  13. marandaneto commented on Oct 7, 2022

    @marandaneto
    ContributorAuthor
    • Drop RN versions older than 0.60.x, Check "react-native": ">=$version" on package.json

    @marandaneto So we would change this all the way to 0.70.x for the 5.0.0 release?

    Yes, people can use the v4 of the SDK for < 0.70.x

  14. cipolleschi commented on Oct 7, 2022

    @cipolleschi

    I think that a little bit of extra context can be helpful here.

    React Native rebundle and ships its own version of React internally (which is the same code you find in the React repo, it's not a customized versiono of React for React Native).
    React Native 0.70+ is shipping React 18. New apps created with React Native 0.70+ have the React 18 root enabled by default, but the user can disable it

  15. krystofwoldrich commented on Oct 7, 2022

    @krystofwoldrich
    Contributor

    @cipolleschi So until we can upgrade to react 18 we can just use 17 (but of course, we will miss some features).

  16. cipolleschi commented on Oct 7, 2022

    @cipolleschi

    Yeah, technically if the users turn off this setting for iOS and its equivalent for Android, it should behave like React 17.

  17. krystofwoldrich commented on Oct 10, 2022

    @krystofwoldrich
    Contributor

    React 18 is working now, it wasn't actually JS SDK (they support v18), but it was an error in our RN sdk.

  18. krystofwoldrich commented on Oct 11, 2022

    @krystofwoldrich
    Contributor

    Seems like ReactNavigation and New Arch on Android don't play well yet, I've run into the same issue.

    software-mansion/react-native-screens#1608

    ios works well, but on Android I'm getting the same error

  19. marandaneto commented on Oct 11, 2022

    @marandaneto
    ContributorAuthor

    Also hitting the issue react/react-native#34923

  20. krystofwoldrich commented on Oct 11, 2022

    @krystofwoldrich
    Contributor

    When this will make it to a RN release we will be able to return the modal feedback view to the new arch example.
    react/react-native@9ac437f

    At the moment the modal view is not implemented/included in Fabric Renderer.

  21. marandaneto commented on Oct 14, 2022

    @marandaneto
    ContributorAuthor

    Better stack traces when Java crashes apparently depend on the outcome of this issue getsentry/sentry-native#743 and getsentry/sentry-native#752 (comment) or if the RN engine actually improves something.

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

Metadata

Metadata

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions