react-native-static-server icon indicating copy to clipboard operation
react-native-static-server copied to clipboard

Re-evaluate the possibility to use private methods (and `@babel/plugin-proposal-private-methods`) in the codebase again

Open NqCompiler opened this issue 3 years ago • 2 comments

Hi,

thank you for fixing this project!

How to reproduce this error: Just use FlatList and this project with the recommended plugin @babel/plugin-proposal-private-methods. Here are two issues from stackoverflow (FYI: I am not using Expo): https://stackoverflow.com/questions/69178384/react-native-typeerror-undefined-is-not-an-object-evaluating-props-getitem https://stackoverflow.com/questions/69922302/react-native-flatlist-undefined-is-not-an-object-evaluating-props-getitem

Is this a possible solution?

  1. make all private functions public by removing the hashtag prefix in src/index.ts
  2. remove @babel/plugin-proposal-private-methods

NqCompiler avatar Sep 04 '22 21:09 NqCompiler

Ok, whatever, I just released v0.6.0-alpha.4 which gets rid of the private class features for now.

birdofpreyru avatar Sep 05 '22 11:09 birdofpreyru

It turns out (https://github.com/facebook/react-native/issues/36828#issuecomment-1610324511) adding @babel/plugin-transform-flow-strip-types allows to avoid problems with <FlatList> when using private methods. Perhaps, with this in mind we can use them again.

birdofpreyru avatar Oct 04 '23 09:10 birdofpreyru