From 0964ef09bca936d017805b7118a5032422709eda Mon Sep 17 00:00:00 2001 From: Victor Turansky Date: Thu, 20 May 2021 09:50:38 +0300 Subject: [PATCH] #369 Fix `React.lazy` contract (#447) --- kotlin-react/src/main/kotlin/react/Imports.kt | 4 +++- kotlin-react/src/main/kotlin/react/ReactComponent.kt | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/kotlin-react/src/main/kotlin/react/Imports.kt b/kotlin-react/src/main/kotlin/react/Imports.kt index 5284ec0c9c40..313d5b89e2b8 100644 --- a/kotlin-react/src/main/kotlin/react/Imports.kt +++ b/kotlin-react/src/main/kotlin/react/Imports.kt @@ -82,7 +82,9 @@ external fun

memo(fc: FunctionalComponent

): FunctionalComponent< external fun

memo(fc: FunctionalComponent

, areEqual: (P, P) -> Boolean): FunctionalComponent

// Lazy (16.6+) -external fun

lazy(loadComponent: () -> Promise>): RClass

+external fun

lazy( + factory: () -> Promise> +): RClass

// Suspense (16.6+) external interface SuspenseProps : RProps diff --git a/kotlin-react/src/main/kotlin/react/ReactComponent.kt b/kotlin-react/src/main/kotlin/react/ReactComponent.kt index b764e235c12f..85a48f13e6d8 100644 --- a/kotlin-react/src/main/kotlin/react/ReactComponent.kt +++ b/kotlin-react/src/main/kotlin/react/ReactComponent.kt @@ -40,6 +40,10 @@ val RErrorInfo.componentStack: Any // TODO: Should extend RComponentClassStatics, but has problems with generic params external interface RClass : RComponentClassStatics?> +external interface RClassModule { + val default: RClass

+} + external interface RComponentClassStatics

?> { var displayName: String?