Skip to content

JSX v4 and @string / @int #5724

Closed
rescript-lang/syntax
#672
@cknitt

Description

@cknitt

Consider the following binding (part of rescript-react-native):

@react.component @module("react-native")
external make: (
  ~animated: bool=?,
  ~barStyle: @string
  [
    | #default
    | @as("light-content") #lightContent
    | @as("dark-content") #darkContent
  ]=?,
  ~hidden: bool=?,
  ~backgroundColor: string=?,
  ~translucent: bool=?,
  ~networkActivityIndicatorVisible: bool=?,
  ~showHideTransition: showHideTransition=?,
) => React.element = "StatusBar"

Now <StatusBar barStyle=#darkContent /> gives the following output with JSX v3:

React.createElement(ReactNative.StatusBar, {
  barStyle: "dark-content"
});

but with JSX v4 we get

JsxRuntime.jsx(ReactNative.StatusBar, {
  barStyle: "darkContent"
});

causing a runtime exception.

The problem is of course not limited to React Native, but will affect any React component using @string (or, similarly, @int) for any of its props.

/cc @mattdamon108 @cristianoc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions