Rafał Kuźmiński
01/15/2024, 10:37 AMconst Transition = React.forwardRef(function Transition(
props: TransitionProps & {
children: React.ReactElement<any, any>;
},
ref: React.Ref<unknown>,
) {
return <Slide direction="up" ref={ref} {...props} />;
});
And mine attempt:
val transition = forwardRef<Any, PropsWithRef<Any>> { propsWithRef, ref ->
Slide {
attrs.ref = ref
attrs.direction = SlideDirection.up
Object.assign(this, propsWithRef)
}
}
Dialog {
fullWidth = true
fullScreen = true
...
But it throws error "Cannot read properties of undefined (reading 'ref')"
Can someone guide me how to use forwardRef in Kotlin? Thanks!Artem Kobzar
01/15/2024, 2:56 PMturansky
01/15/2024, 3:10 PMRafał Kuźmiński
01/15/2024, 3:12 PMturansky
01/15/2024, 3:13 PM// in legacy
Object.assign(this, props)
// in modern
+props
Rafał Kuźmiński
01/15/2024, 3:16 PMval Transition = ForwardRef<_, TransitionProps> {
because TransitionProps is just a "Props" not a PropsWithRef.
Is there any example of how to use mui Transitions? I see you are one of contributiors to "kotlin-mui-showcase" so maybe you have an idea how to implement custom transition to dialog?turansky
01/15/2024, 3:18 PMturansky
01/15/2024, 3:29 PMexternal interface MyTransitionProps : TransitionProps, PropsWithref<>
turansky
01/15/2024, 3:31 PMturansky
01/15/2024, 3:32 PMTransitionProps
- your custom interface?Rafał Kuźmiński
01/15/2024, 3:40 PMpackage mui.material.transitions
external interface TransitionProps : react.Props
turansky
01/15/2024, 3:42 PMRafał Kuźmiński
01/15/2024, 3:43 PM