This repository was archived by the owner on Nov 13, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +31
-11
lines changed
reason-react-example/src/interop Expand file tree Collapse file tree 3 files changed +31
-11
lines changed Original file line number Diff line number Diff line change 1- /**
2- * ReactJS used by ReasonReact
3- * This component wraps a ReactJS one, so that ReasonReact components can consume it
4- * Typing the myBanner.js component's output as a `reactClass`.
5- */
6- [@ genFlow ]
7- [@ bs . module ]
8- external myBanner : ReasonReact . reactClass = "./MyBanner" ;
1+ /* The @genFlow annotation is ignored if there's also a .rei file */
2+ [@ genFlow ] [@ bs . module ]
3+ external myBanner : ReasonReact . reactClass = "./MyBanner" ;
94
105[@ bs . deriving abstract]
116type jsProps = {
127 show: bool ,
138 message: string ,
149};
1510
16- /** This is like declaring a normal ReasonReact component 's `make` function, except the body is a the interop hook wrapJsForReason */
11+ /* The @genFlow annotation is ignored if there 's also a .rei file */
1712[@ genFlow ]
1813let make = (~show, ~message, children) =>
1914 ReasonReact . wrapJsForReason(
Original file line number Diff line number Diff line change 1+ [@ genFlow ] [@ bs . module ]
2+ external myBanner : ReasonReact . reactClass = "./MyBanner" ;
3+
4+ [@ bs . deriving abstract]
5+ type jsProps = {
6+ show: bool ,
7+ message: string ,
8+ };
9+
10+ [@ genFlow ]
11+ let make :
12+ (~show : bool , ~message : string , ' a ) =>
13+ ReasonReact . component (
14+ ReasonReact . stateless ,
15+ ReasonReact . noRetainedProps ,
16+ ReasonReact . actionless ,
17+ );
Original file line number Diff line number Diff line change @@ -113,8 +113,16 @@ let translateSignatureItem =
113113 |> CodeItem . combineTranslations
114114
115115 | {Typedtree . sig_desc: Tsig_value (valueDescription ), _ } =>
116- valueDescription
117- |> CodeItem . translateSignatureValue(~language, ~propsTypeGen, ~moduleName)
116+ if (valueDescription. val_prim != [] ) {
117+ valueDescription |> CodeItem . translatePrimitive;
118+ } else {
119+ valueDescription
120+ |> CodeItem . translateSignatureValue(
121+ ~language,
122+ ~propsTypeGen,
123+ ~moduleName,
124+ );
125+ }
118126
119127 | _ => {CodeItem . dependencies: [] , CodeItem . codeItems: [] }
120128 };
You can’t perform that action at this time.
0 commit comments