Skip to content

image not visible without setting imageColor #1034

Closed

Description

@areknow

Without setting an image color, it appears that the icon does not render:

Image
const USER_MENU: MenuAction[] = [
  {
    id: "add",
    title: "Add",
    image: "plus",
    // imageColor: "black",
  },
];

After setting a color:

Image
const USER_MENU: MenuAction[] = [
  {
    id: "add",
    title: "Add",
    image: "plus",
    imageColor: "black",
  },
];

I believe this may be due to the new architecture migration. In an older project of mine, I do not have the above issue.

Activity

  1. teaualune commented on Mar 10, 2025

    @teaualune

    I've ran into this issue on new arch as well

    After investigation, this is due to a value unboxing issue: in ios/Shared/RCTMenuItem.swift line 35,

    if let imageColor = details["imageColor"] {

    If you don't provide imageColor on the JS side, the imageColor value here will be resolved to 0, thus the image will be converted with RCTConvert.uiColor(0)

    To solve this issue temporarily I add a small patch that rewrites line 35 into:

    if let imageColor = details["imageColor"], (imageColor as? Int) != 0 {

    Although this didn't solve the actual issue, just a workaround.

  2. tmoran-stenoa commented on Apr 23, 2025

    @tmoran-stenoa

    Thank you @teaualune, your patch worked for me.

  3. Naturalclar commented on Nov 22, 2026

    @Naturalclar
    Member

    Fixed by #1195, released in v2.3.2. On the New Architecture, codegen gave an omitted imageColor a default of 0, and the bridge forwarded it, so RCTConvert.uiColor(0) tinted the icon fully transparent (as @teaualune traced). The bridge no longer forwards that default, so an image without imageColor renders with UIKit's default tint again. Thanks everyone for the reports and the investigation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions