Skip to content

Commit 2f502a4

Browse files
committed
Simplify API by using ReactElement instead of ReactNode (easier to consume with Fable.React in mind).
1 parent d257272 commit 2f502a4

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/Fable.React.TransitionGroup/Fable.Helpers.React.TransitionGroup.fs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ module TransitionGroup =
3434
| OnExit of (Browser.HTMLElement -> unit)
3535
| OnExiting of (Browser.HTMLElement -> unit)
3636
| OnExited of (Browser.HTMLElement -> unit)
37-
| Children of U2<React.ReactNode, (TransitionStatus -> React.ReactNode)>
37+
| Children of U2<React.ReactElement, (TransitionStatus -> React.ReactElement)>
3838
| Class of string
3939
| Ref of (obj -> obj)
4040
| Key of string
@@ -68,7 +68,7 @@ module TransitionGroup =
6868
| OnExit of (Browser.HTMLElement -> unit)
6969
| OnExiting of (Browser.HTMLElement -> unit)
7070
| OnExited of (Browser.HTMLElement -> unit)
71-
| Children of U2<React.ReactNode, TransitionStatus -> React.ReactNode>
71+
| Children of U2<React.ReactElement, TransitionStatus -> React.ReactElement>
7272
| ClassNames of U2<string, CSSTransitionClassNames>
7373
| Class of string
7474
| Ref of (obj -> obj)
@@ -86,22 +86,19 @@ module TransitionGroup =
8686
static member Custom(key: string, value: obj): TransitionGroupProp =
8787
unbox(key, value)
8888

89-
let private asNode (el: React.ReactElement): React.ReactNode =
90-
!^(!^el: React.ReactChild)
91-
9289
let transition (props: TransitionProp list) (child: React.ReactElement): React.ReactElement =
93-
let props = (TransitionProp.Children !^(asNode child))::props
90+
let props = (TransitionProp.Children !^child)::props
9491
ofImport "Transition" "react-transition-group" (keyValueList CaseRules.LowerFirst props) []
9592

96-
let transitionWithRender (props: TransitionProp list) (render: TransitionStatus -> React.ReactNode): React.ReactElement =
93+
let transitionWithRender (props: TransitionProp list) (render: TransitionStatus -> React.ReactElement): React.ReactElement =
9794
let props = (TransitionProp.Children !^render)::props
9895
ofImport "Transition" "react-transition-group" (keyValueList CaseRules.LowerFirst props) []
9996

10097
let cssTransition (props: CSSTransitionProp list) (child: React.ReactElement): React.ReactElement =
101-
let props = (CSSTransitionProp.Children !^(asNode child))::props
98+
let props = (CSSTransitionProp.Children !^child)::props
10299
ofImport "CSSTransition" "react-transition-group" (keyValueList CaseRules.LowerFirst props) []
103100

104-
let cssTransitionWithRender (props: CSSTransitionProp list) (render: TransitionStatus -> React.ReactNode): React.ReactElement =
101+
let cssTransitionWithRender (props: CSSTransitionProp list) (render: TransitionStatus -> React.ReactElement): React.ReactElement =
105102
let props = (CSSTransitionProp.Children !^render)::props
106103
ofImport "CSSTransition" "react-transition-group" (keyValueList CaseRules.LowerFirst props) []
107104

0 commit comments

Comments
 (0)