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

How to use an "icon name included in the project" for the action image #331

Open
jacklj opened this issue Mar 5, 2022 · 10 comments
Open

Comments

@jacklj
Copy link
Contributor

jacklj commented Mar 5, 2022

Hi, it says in the README:

   * - Allows icon name included in project or system (Android) resources drawables and
   * in SF Symbol (iOS)

Does it mean you add the icon to the native project, and then you can refer to it? How do you do this?

Thanks

@kayode0x
Copy link

kayode0x commented Mar 5, 2022

You can find all the icons on Hotpot.

  • For Android Icons, click the Material Design option.
  • For iOS Icons, click the SF Symbols option.

Then to select an Icon, just click it, this copies the icon name to your clipboard.

Here's an example to get the Safari (Browser) icon, for iOS only.

{ id: 'open', title: 'Open', image: Platform.select({ ios: 'safari', }), }

Hope this answers your question 😁

@jacklj
Copy link
Contributor Author

jacklj commented Mar 5, 2022

Thanks @kayode0x.

Sorry, I wasn’t clear enough - I know about using SF Symbols and Material Design icons.

The readme implies that you can alternatively use an “icon name that is included in the project” - or am I misreading it?

Thanks

@hanishbasheer
Copy link

hanishbasheer commented May 2, 2022

it is not working for android
the app is crashing when i use the name you mentioned

@lclarkg18
Copy link

  • For Android Icons, click the Material Design option.
  • For iOS Icons, click the SF Symbols option.

Hi there, I'm experiencing the same issue as @hanishbasheer, my android icons are not working (they are working on iOS) It simply doesn't render any image even using the example code in the docs

@Brma1048
Copy link

Brma1048 commented Mar 9, 2023

Same issue on android
React Native: 0.71.2
@react-native-menu/menu": "0.7.3"

@willxy
Copy link

willxy commented Jul 15, 2023

Same for me, for android:

Using eg 'ic_menu_add' works and gives me a plus sign in a circle. But none of the names for android on Hotspot work in the code. And none of the icons for android on Hotspot seem to be named 'ic_menu_add'.

So it looks like the code is using a different set of icon names for android than Hotspot is.

Where do I find the list of icon names, and their images, that work in this code?

@Brma1048
Copy link

@willxy you need to add the icons via android studio In Android Studio, right-click on the “drawable” folder and select “New” » “Vector Asset”.

@ShivamJoker
Copy link

@willxy you need to add the icons via android studio In Android Studio, right-click on the “drawable” folder and select “New” » “Vector Asset”.

Thanks this helped.

@focux
Copy link

focux commented Oct 13, 2023

@willxy you need to add the icons via android studio In Android Studio, right-click on the “drawable” folder and select “New” » “Vector Asset”.

This kinda worked for me but instead of using right-click on the "drawable" folder, I clicked on the "Resource Manager" tab on the left and then clicked the plus button and selected Vector Asset.

@PierreCapo
Copy link

For those wondering, the default icons present for android can be found here (those that don't need an extra-install step): https://developer.android.com/reference/android/R.drawable

For instance: android: "ic_menu_gallery"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants