diff --git a/examples/expo/src/App.tsx b/examples/expo/src/App.tsx index e9356a8..a700659 100644 --- a/examples/expo/src/App.tsx +++ b/examples/expo/src/App.tsx @@ -244,9 +244,8 @@ const DropdownMenuExample = () => { )} diff --git a/packages/zeego/src/menu/create-ios-menu/index.ios.tsx b/packages/zeego/src/menu/create-ios-menu/index.ios.tsx index d9c8af9..92a254f 100644 --- a/packages/zeego/src/menu/create-ios-menu/index.ios.tsx +++ b/packages/zeego/src/menu/create-ios-menu/index.ios.tsx @@ -30,6 +30,7 @@ import { MenuActionConfig, } from 'react-native-ios-context-menu' import { menuify } from '../display-names' +import type { ImageSystemConfig } from 'react-native-ios-context-menu/src/types/ImageItemConfig' const createIosMenu = (Menu: 'ContextMenu' | 'DropdownMenu') => { const Trigger = menuify(({ children }: MenuTriggerProps) => { @@ -230,16 +231,19 @@ If you want to use a custom component as your , you can use the menui ItemIcon ).targetChildren - if (iconChildren?.[0]?.props.iosIconName) { - const iconConfiguration = - iconChildren?.[0]?.props.iosIconConfiguration + if ( + iconChildren?.[0]?.props.iosIconName || + iconChildren?.[0]?.props.ios + ) { + const iconConfiguration = iconChildren?.[0]?.props.ios icon = { type: 'IMAGE_SYSTEM', imageValue: { ...iconConfiguration, - systemName: iconChildren[0].props.iosIconName, - }, + systemName: + iconConfiguration?.name ?? iconChildren[0].props.iosIconName, + } as ImageSystemConfig, } } else { const imageChild = pickChildren( @@ -248,20 +252,10 @@ If you want to use a custom component as your , you can use the menui ).targetChildren?.[0] if (imageChild) { - const { iosIconName, iosIconConfiguration } = imageChild.props - if (iosIconName) { - icon = { - type: 'IMAGE_SYSTEM', - imageValue: { - ...iosIconConfiguration, - systemName: iosIconName, - }, - } - } else if (imageChild.props.source) { + if (imageChild.props.source) { const imageValue = Image.resolveAssetSource( imageChild.props.source ) - icon = { type: 'IMAGE_REQUIRE', imageValue, diff --git a/packages/zeego/src/menu/types.ts b/packages/zeego/src/menu/types.ts index 25df8f2..d3b9a53 100644 --- a/packages/zeego/src/menu/types.ts +++ b/packages/zeego/src/menu/types.ts @@ -1,7 +1,7 @@ import type { Text, View, ImageRequireSource, ImageProps } from 'react-native' import type { MenuContentProps as RadixContentProps } from '@radix-ui/react-dropdown-menu' import type { ContextMenuView } from 'react-native-ios-context-menu' -import type { ImageSystemConfig } from 'react-native-ios-context-menu/lib/typescript/types/ImageItemConfig' +import type { ImageSystemSymbolConfiguration } from 'react-native-ios-context-menu/lib/typescript/types/ImageItemConfig' type ViewStyle = React.ComponentProps['style'] type TextStyle = React.ComponentProps['style'] @@ -60,18 +60,21 @@ export type MenuItemProps = ( export interface MenuItemCommonProps { /** * The name of an iOS-only SF Symbol. For a full list, see https://developer.apple.com/sf-symbols/. - * + * @deprecated Please use the `name` inside of the `ios` prop instead. * @platform ios */ iosIconName?: string /** - * Custom configuration for the SF Symbol icon provided by `iosIconName`. This can be used for iOS15+ - * features like weight, scale, colors etc. The options correspond to the ImageSystemConfig in - * react-native-ios-context-menu + * Icon configuration to be used on iOS. You can pass a SF Symbol icon using the `name` prop. + * Additionally, you can configure the SF Symbol's features like weight, scale, color etc. by passing + * the corresponding props. Note that some of those features require iOS 15+. For the full list of options, + * refer to the ImageSystemSymbolConfiguration type in react-native-ios-context-menu * * @platform ios */ - iosIconConfiguration?: ImageSystemConfig + ios?: ImageSystemSymbolConfiguration & { + name: string + } /** * The name of an android-only resource drawable. For a full list, see https://developer.android.com/reference/android/R.drawable.html. *