Skip to content

Error when assigning undefined to optional view property #1184

@OrfeasZ

Description

@OrfeasZ

What happened?

I have a nitro view with an optional prop. If I set that prop to a value, and then back to undefined, I get the error seen below.

Reproduceable Code

Repro can be found here: https://github.com/OrfeasZ/nitro-undefined-issue

Video demonstrating the issue: https://i.nofate.me/Kj7yhtil6Ix2gAW4SKM5fl4X.mp4

Steps I took:

  1. Create a sample nitro view plugin using create-nitro-module.
  2. Make the isRed property optional and run nitrogen.
  3. Adjust the relevant Swift code to handle the optional value.
  4. Adjust App.tsx to have isRed set to undefined initially.
  5. Add buttons to App.tsx to change isRed to have a value and back to undefined.
  6. Run the example app and press on Set Red followed by Clear Color.

Relevant log output

Exception in HostFunction: PropTest.isRed: Value is null, expected a boolean

Device

iPhone 16

Nitro Modules Version

0.33.2

Nitrogen Version

0.33.2

Can you reproduce this issue in the Nitro Example app here?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    nitro-coreIssue is related to the Nitro Modules core runtime/C++ codebase

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions