Skip to content

Improve support for React v18 #144

@kennethlynne

Description

@kennethlynne

Hi! 👋

Firstly, thanks for your work on this project! 🙂

With React v18 children is expected to be explicitly typed

I've used patch-package to patch @callstack/react-theme-provider@3.0.8

Here is the diff that solved my problem:

diff --git a/node_modules/@callstack/react-theme-provider/typings/index.d.ts b/node_modules/@callstack/react-theme-provider/typings/index.d.ts
index fd76d0e..df3cf54 100644
--- a/node_modules/@callstack/react-theme-provider/typings/index.d.ts
+++ b/node_modules/@callstack/react-theme-provider/typings/index.d.ts
@@ -8,7 +8,7 @@ type $Without<T, K extends keyof any> = T extends any ? Pick<T, Exclude<keyof T,
 type $DeepPartial<T> = { [P in keyof T]?: $DeepPartial<T[P]> };
 
 export type ThemingType<Theme> = {
-  ThemeProvider: React.ComponentType<{ theme?: Theme }>;
+  ThemeProvider: React.ComponentType<{ theme?: Theme; children: React.ReactNode }>;
   withTheme: <Props extends { theme: Theme }, C>(
     WrappedComponent: React.ComponentType<Props> & C
   ) => React.ComponentType<

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions