dominicstop / react-native-ios-context-menu

A react-native component to use context menu's (UIMenu) on iOS 13/14+

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using with New Architecture

baransu opened this issue · comments

First of all, thank you for this amazing package! ❤️

I'm using this package in the NewArchitecture application. Basic functionality of ContextMenuView works great. The problem comes with auxiliary preview. For some reason, it looks like it's incompatible with NewArchitecture despite using New Architecture Interop Layer.

I'm running following react-native.config.js configuration:

module.exports = {
  project: {
    android: {
      unstable_reactLegacyComponentNames: [],
    },
    ios: {
      unstable_reactLegacyComponentNames: [
        'RNIWrapperView',
        'RNIContextMenuView',
      ],
    },
  },
};

For some reason RNIContextMenuView works great while RNIWrapperView always has wrong props and is missing some initialization when added as subview by RNIContextMenuView (I'm not experienced in native iOS components so maybe I misunderstand something when running debugger and setting up breakpoints).

I'm using version 1.15.3 as I don't have Expo setup in my project. I know there is major 2.x version but upgrading and adding Expo to my project causes 100% CPU usage when long pressing on NewArchitecture so I opted out to sticking with 1.15.3.

If you want to test I updated 1.15.3 example to NewArchitecture so it's easy to reproduce: https://github.com/baransu/react-native-ios-context-menu/tree/new-arch.

I'm not a big fan of ExpoModules usage as this project is really valuable outside Expo and not everyone wants to migrate to it. But it is what is it 😅. I would love to contribute somehow or keep 1.x fork for folks not using Expo but I need a little bit of guidance how to fix it.

Result of opening ContextMenuAuxPreviewExample01 on NewArchitecture:
Screenshot 2023-11-15 at 20 27 38

A new Auxiliary view will be released this week, will see if it fixes this

Great. Waiting for the release then. I'll test it then!

I think this is fixed on v2

I am using expo with the following react-native.config.js, for some reason there is no sign of react-native-ios-context-menu doesn't trigger or show up.

When I disable the new architecture it also works as expected. How do I make this work?

"react-native-ios-context-menu": "^2.5.1",

RNCSegmentedControl works in this example.

module.exports = {
  project: {
    android: {
      unstable_reactLegacyComponentNames: ["RNCSegmentedControl"],
    },
    ios: {
      unstable_reactLegacyComponentNames: [
        'RNIWrapperView',
        'RNIContextMenuButton',
        'RNIContextMenuView',
        "RNCSegmentedControl"
      ],
    },
  },
};

Looks like it doesn’t work on the new arch, reopened this issue

Hey guys, moved this to #100. PRs would be appreciated if you figure it out too.