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

constrcutor is not callable #79

Open
vaynevayne opened this issue Apr 9, 2024 · 4 comments
Open

constrcutor is not callable #79

vaynevayne opened this issue Apr 9, 2024 · 4 comments

Comments

@vaynevayne
Copy link

import RootSiblings from 'react-native-root-siblings';

image
@vaynevayne
Copy link
Author

var RootSiblings = require('react-native-root-siblings');

I'm not sure how it was generated. I use expo, the project code will become require, and it will load the entry package of commonjs, but rootSiblings does not have a commonjs export.

I am unsure about how to handle this situation.

@sunnylqm
Copy link
Collaborator

do you have a reproducible example? like a expo snack link?

@vaynevayne
Copy link
Author

vaynevayne commented Apr 11, 2024

@sunnylqm
here: https://github.com/vaynevayne/rn-ui
pnpm run ios

click showToast button

image

@sunnylqm
Copy link
Collaborator

sunnylqm commented Apr 13, 2024

the monorepo config is complex and i wont have much time to dig in, but the root cause is the cjs transpiling (which is not ideal and you need to fix it)
in cjs you have to use modules by referring its default property, like

new RootSiblings.default(ToastView)

btw there is no need to use a state management lib in a simple toast component. if you want a queue, a local array is enough isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants