mobx
mobx copied to clipboard
add comment to help react-native users avoid react bug with flatlist
There's a pretty insidious bug (https://github.com/facebook/react-native/issues/21154) where after following the original instructions, the app works seemingly fine. But it's not until the cache of the webpack server is reset that you find out that everything breaks. The error is not that specfiic and trackign it down to this babel change takes a while. Hopefully this will help others out there with the same problem.
The location / wording could use work but just wanted to get this process started
⚠️ No Changeset found
Latest commit: fa147ddb0efa0638d655a65842e32110328720a7
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The
https://babeljs.io/docs/en/babel-plugin-transform-flow-strip-types
is part of:
https://babeljs.io/docs/en/babel-preset-flow
isn't this the plugin one should be using? I mean, sort of automatically, if one uses flow...?
If I follow correctly the relevant option here is:
https://babeljs.io/docs/en/babel-preset-flow#allowdeclarefields
but I am actually not sure, how it should be set: true seems like the way forward (it wil be default in Babel 8), but possibly breaking on existing code that did not migrated to using declare (?).
It's a bit unclear why a bug in an (old version?) of RN should be part of the MobX documentation? I can imagine that would have been convenient in your case, but it is also a bit hard this way to avoid exploding these docs with random problems of other tools, as there is not really a way in which we can track when the comment isn't relevant anymore?
@mweststrate yeah I get that mobx is not tied to RN and at this point I am about 50:50 myself on this being included. But my counterarguemnt is that given that this particular page is very specific to enabling classes, that the bug is very subtle and is very hard to figure out, and that about 25% of public repos of mobx users are using it with RN, I think it's important enough to have some mention somewhere to help some other poor SOB.
Even if it's not mentioned hopefully this thread can get indexed on google and other people can find it that way too
Fair enough, will merge :). Thanks!
@1mike12
Do you exclude node_modules (or wherever react-native sources resides) from transpilation?
Based on other issues, excluding node_modules does not seem to be the stardard procedure when using native. I would like to understand if that's really the case and why.
I think it would be nice to provide some guidance to react-native users, but the proposed solutions around seems to be quite ad-hoc. I would like to understand if these issues originate from the same problem (like applying the plugin to node_modules) or if there is something more to it (like incorrect use of declare in user's sources or bug in specific react-native version, etc).
EDIT: Also, does react-native ship with a specific babel version?