Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Realm React) Children prop missing on RealmProvider component #4565

Closed
david-kasznar-benestudio opened this issue May 10, 2022 · 2 comments · Fixed by #4566
Closed

(Realm React) Children prop missing on RealmProvider component #4565

david-kasznar-benestudio opened this issue May 10, 2022 · 2 comments · Fixed by #4566
Assignees

Comments

@david-kasznar-benestudio
Copy link

david-kasznar-benestudio commented May 10, 2022

How frequently does the bug occur?

All the time

Description

Reacts FC type no longer contains children prop. This way when I try to use the provider returned from createRealmContext I got a type error. My suggestion is to add a children prop to ProviderProps or use React's PropsWithChildren generic type.

export const RealmContext = createRealmContext(realmConfig);

// ... rest of the component

<RealmContext.RealmProvider>
     <Stack.Navigator initialRouteName="Home">
            <Stack.Screen name="Home" component={Home} />
            <Stack.Screen name="TodoDetails" component={TodoDetails} />
     </Stack.Navigator>
</RealmContext.RealmProvider>

Stacktrace & log output

TS2322: Type '{ children: Element; }' is not assignable to type 'IntrinsicAttributes & ProviderProps'.

Can you reproduce the bug?

Yes, always

Reproduction Steps

Add any child to RealmProvider.

Version

"realm": "^10.16.0"

What SDK flavour are you using?

MongoDB Realm (i.e. Sync, auth, functions)

Are you using encryption?

No, not using encryption

Platform OS and version(s)

dev env: macOS, 12.3.1

Build environment

No response

Cocoapods version

No response

@takameyer
Copy link
Contributor

@david-kasznar-benestudio Thanks for reporting this! Just found the relevant Stack Overflow suggestion for dealing with this. I'll update it to include the children explicitly.

@david-kasznar-benestudio
Copy link
Author

Thank you for the fast response!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants