From 8cf94892a183676a70edb30a547fa9c192c5ea5b Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Wed, 25 Nov 2026 12:41:14 +0900 Subject: [PATCH 1/2] fix: stop MenuView.show() from throwing on Android and iOS Android: show() fell back to UIManager.dispatchViewManagerCommand with `undefined` as the command arguments. That reaches native code as null, and on the New Architecture it throws `UnexpectedNativeTypeException: expected Array, got a null`, leaving the trigger pressed. Pass `[]`. iOS: MenuComponentRef declares show(), but iOS re-exported the native component directly, so `ref.current?.show()` threw `show is not a function`. iOS has no public API to present a UIMenu from code, so wrap the component and expose show() as a no-op that warns in development. Also show the example's "Android only" button only on Android, and say in the README and the type's doc comment that show() is Android-only. Fixes #1228 Fixes #957 Co-Authored-By: Claude Opus 5.5 --- README.md | 6 ++++-- example/src/App.tsx | 10 ++++++---- src/UIMenuView.android.tsx | 5 ++++- src/UIMenuView.ios.tsx | 36 +++++++++++++++++++++++++++++++++++- src/types.ts | 7 +++++++ 5 files changed, 56 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 63d2dae8..2093d25f 100644 --- a/README.md +++ b/README.md @@ -131,9 +131,11 @@ It's also possible to obtain the `action` is a more React-ish, declarative fashi ### Props -#### `ref` (Android only) +#### `ref` -Ref to the menu component. +Ref to the menu component. Call `ref.current?.show()` to open the menu from code. + +`show()` works on Android only. On iOS it does nothing (a warning is logged in development), because iOS has no public API to present a menu from code. | Type | Required | |------|----------| diff --git a/example/src/App.tsx b/example/src/App.tsx index bd180b1d..bd4d5d99 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -51,10 +51,12 @@ export const App = () => { -