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

Supported autolinking on the new architecture #642

Merged
merged 22 commits into from
Sep 18, 2022
Merged

Commits on Aug 27, 2022

  1. Renamed codegen library to navigationreactnative

    Autolinking on Android doesn't like hyphens in library name
    grahammendick committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    9595635 View commit details
    Browse the repository at this point in the history
  2. Renamed folder to codegen lib name and run on ios

    And renamed import to match as well, though don't know why needed the folder name before. Plan to drop the subfolders from cpp folder
    grahammendick committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    a744d44 View commit details
    Browse the repository at this point in the history
  3. Moved c++ state into root cpp folder

    There's no need for the subfolders now that React Native autolinks on android. The subfolders were to make the handwritten setup on android more consistent
    grahammendick committed Aug 27, 2022
    Configuration menu
    Copy the full SHA
    ca6288f View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2022

  1. Revert "Moved c++ state into root cpp folder"

    This reverts commit ca6288f.
    grahammendick committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    8227a35 View commit details
    Browse the repository at this point in the history
  2. Added react-native.config.js for android build

    Copying code from react native's autolinking example troZee/react-native-cpp-autolinking@5e1b0f2
    grahammendick committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    e597051 View commit details
    Browse the repository at this point in the history
  3. Added custom android make file

    Copied it from the codegen'ed one and pointed LOCAL_SRC_FILES at both the codegen and the hand-written c++ state files in cpp folder. Just a first go, not tried it yet
    grahammendick committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    dfc5c56 View commit details
    Browse the repository at this point in the history
  4. Added CMakeLists because run-android asked for one

    Don't know why it's needed as well as Android.mk?! Copied the codegen'ed one and added codegen files and c++ state cpp files
    grahammendick committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    9348013 View commit details
    Browse the repository at this point in the history
  5. Copied all codegen-ed into hand-written cpp folder

    Couldn't get it to work using codegen and cpp folder - so followed advice from reactwg/react-native-new-architecture#71 (comment) that said needed own c++ implementation for everything. Gets further but falling over at the NativeMaterial3ModuleSpec - it's not generated now. Wondering if this approach works with ModuleSpecs as well?!
    grahammendick committed Sep 14, 2022
    Configuration menu
    Copy the full SHA
    6258613 View commit details
    Browse the repository at this point in the history

Commits on Sep 17, 2022

  1. Configuration menu
    Copy the full SHA
    374b537 View commit details
    Browse the repository at this point in the history
  2. Renamed to match the .h file

    This file was codegen'ed but clearer to drop the 'generated' from the name
    grahammendick committed Sep 17, 2022
    Configuration menu
    Copy the full SHA
    3999f25 View commit details
    Browse the repository at this point in the history
  3. Deleted redundant Android.mk

    Copying from react native autolinking repo and they only have the CMakeLists.txt troZee/react-native-cpp-autolinking@5e1b0f2
    grahammendick committed Sep 17, 2022
    Configuration menu
    Copy the full SHA
    4d15c46 View commit details
    Browse the repository at this point in the history
  4. Updated version to wip

    Need to put together example repo with android build failing so react native can investigate
    grahammendick committed Sep 17, 2022
    Configuration menu
    Copy the full SHA
    41573b0 View commit details
    Browse the repository at this point in the history
  5. Got a successful build on android

    Had to go through all the files on the example repo 1 by 1 to see what was wrong, JSI_EXPORT. There were 3 key errors
    1. Added JSI_EXPORT to hand-written cpp interfaces
    2. Include "Props.h" instead of <react/renderer/components/navigationreactnative/Props.h>
    3. Removed libraries from codegenConfig in package.json
    These each took me ages to spot
    grahammendick committed Sep 17, 2022
    Configuration menu
    Copy the full SHA
    6f67a69 View commit details
    Browse the repository at this point in the history
  6. Removed library name now reading from package.json

    Also went back to androidMkPath because cmakeListsPath is a later change. Copies the config from React Native's autlink example
    grahammendick committed Sep 17, 2022
    Configuration menu
    Copy the full SHA
    2cb889e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    b66a5df View commit details
    Browse the repository at this point in the history

Commits on Sep 18, 2022

  1. Pointed at codegen because didn't work in ios

    Copying over the codegen didn't work for ios. Ended up with redefinition of EventEmitters errors reactwg/react-native-new-architecture#71 (reply in thread). There's no custom build on ios so it includes the copied over codegen as well as the actual codegen so it gets included twice. Can't just exclude it on ios because the includes on shadownodes point to local "EventEmitters.h'.
    So went with the react native screens approach of pointing at the codegen instead of copying it over reactwg/react-native-new-architecture#71 (comment). It works on android and should work on ios (haven't tested yet) because it's just the hand-written files now
    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    af514f7 View commit details
    Browse the repository at this point in the history
  2. Removed redundant section

    Copied this over from react native screens example but isn't necessary
    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    a8261fe View commit details
    Browse the repository at this point in the history
  3. Pointed at generated modules instead of copying

    This matches approach for generated components
    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    777d180 View commit details
    Browse the repository at this point in the history
  4. Removed redundant directory

    The current directory has no relevant cpp files - they're now all in react/renderer/components/navigationreactnative
    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    20addab View commit details
    Browse the repository at this point in the history
  5. Tweaked format

    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    1838236 View commit details
    Browse the repository at this point in the history
  6. Tweaked format

    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    2adf3eb View commit details
    Browse the repository at this point in the history
  7. Got it working on android and ios!!

    Still copying code from react native screens example reactwg/react-native-new-architecture#71 (comment)
    Couldn't work out how to get the ComponentDescriptor in the generated rncli.cpp because it only includes ComponentDescriptors.h. Noticed it also includes navigationreactnative.h - so the trick is to include the hand-written descriptors in that file!! React native screens did this just didn't notice or realise what it was for. It's very sneaky!
    This allows it to work on android and ios!! And with lower maintenance because not copying over hand-generated - apart from navigationreactnative.h and .cpp. Had to exclude these files from the podspec otherwise doesn't build on ios
    grahammendick committed Sep 18, 2022
    Configuration menu
    Copy the full SHA
    159a56e View commit details
    Browse the repository at this point in the history