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

Current implementation requires @babel/plugin-proposal-private-methods plugin in RN Babel config, to be added to README #6

Closed
berkaydemir6 opened this issue Jul 17, 2022 · 17 comments
Labels
P3 Small fixes. Easy fixes to do in spare time.

Comments

@berkaydemir6
Copy link

It is fixing when i add
@babel/plugin-proposal-private-methods
to babel file. But then i am getting an error for Flatlist.
hata

@birdofpreyru
Copy link
Owner

Ogh... try to configure it as ['@babel/plugin-proposal-private-methods', {loose: true}],? It turns out I have it in all my RN projects I use this library with, thus haven't realize it is a problem for default babel config.

@berkaydemir6
Copy link
Author

Thanks. Working now.

@thanhnvpk01168
Copy link

Hi @birdofpreyru @b3rkaydem1r .
I still do not understand.
how did you fix it?

@thanhnvpk01168
Copy link

Screen Shot 2022-07-22 at 9 57 27 PM

@birdofpreyru birdofpreyru reopened this Jul 22, 2022
@birdofpreyru
Copy link
Owner

@thanhnvpk01168 didn't it help to add the plugin, like you show in your screenshot?

@thanhnvpk01168
Copy link

@birdofpreyru
oh, so do you have any way to fix this?

@birdofpreyru
Copy link
Owner

I'm not following, what do you mean? Fixing it in the library to not have adding the plugin to the host project? I guess can be done.

@berkaydemir6
Copy link
Author

@thanhnvpk01168 It was working when i add. But a few days later it's started not working. Same error. I am deleting the @babel/plugin-proposal-private-methods line but error is same. It doesnt work with flatlist.

@berkaydemir6
Copy link
Author

is it possible to disable @babel/plugin-proposal-private-methods library? @birdofpreyru

@birdofpreyru
Copy link
Owner

I don't know. I was under impression it is still necessary to make private JS class members to work in RN. It makes no sense to get rid of private members in code, but maybe it can work already without this plugin. Needs investigation.

@berkaydemir6
Copy link
Author

Can you check? I'm stuck at this point.

@birdofpreyru
Copy link
Owner

It is of very low priority for me. It works as is in my projects where I use the library. Also, in my understanding, the root problem is a bug in React Native or in the Babel plugin, as there is nothing wrong with using private class methods in the library.

@berkaydemir6
Copy link
Author

You can use SectionList from react native. @thanhnvpk01168

@EnettyTech
Copy link

You can use SectionList from react native. @thanhnvpk01168

I had been try it, but still error

@berkaydemir6
Copy link
Author

Its have cache problem. Create new project then try on it.

@birdofpreyru
Copy link
Owner

Hey, looking at @thanhnvpk01168's screenshot of Babel config above, I just now noticed that it is missing to also include

"presets": ["module:metro-react-native-babel-preset"]

without that line, Babel would only use a few plugins mentioned in the babel config, and would not apply the rest of Babel plugins RN relies on. Can it be the root problem you having to make the private methods work for you?

@birdofpreyru birdofpreyru changed the title @dr.pogodin\react-native-static-server\src\index.ts: Class private methods are not enabled. Please add @babel/plugin-proposal-private-methods to your configuration. Current implementation requires @babel/plugin-proposal-private-methods plugin in RN Babel config, to be added to README Aug 10, 2022
@birdofpreyru birdofpreyru added the P3 Small fixes. Easy fixes to do in spare time. label Aug 10, 2022
birdofpreyru added a commit that referenced this issue Aug 11, 2022
@birdofpreyru
Copy link
Owner

FYI: After yet another complaint about it (#9) I surrendered, and just released v0.6.0-alpha.4 which gets rid of the private class features for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Small fixes. Easy fixes to do in spare time.
Projects
None yet
Development

No branches or pull requests

4 participants