-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[0.56] undefined is not an object (evaluating '_this._setComponentRef.bind') #20588
Comments
The issue seems to be that the definition of the flow type for _setComponentRef not only defines the type but also initializes the value with
This is probably a babel setup error, most likely around EDIT |
babel/babel#8417 (comment) + cleaning |
I was also struggling for hours with this issue, and the module.exports = {
'presets': [
'module:metro-react-native-babel-preset',
'module:react-native-dotenv',
],
'sourceMaps': true,
'plugins': [
'@babel/transform-flow-strip-types',
'@babel/proposal-class-properties',
'@babel/proposal-object-rest-spread',
'@babel/transform-runtime'
],
}; Credits for solution to #20150 (comment) |
This worked for me. Thank you! |
@krzysztof-miemiec Should I create a new |
@aerielcruz I had to replace my |
@krzysztof-miemiec Thanks! Will try it out 😄 |
@seeya can you show your |
And my version of dependencies are as follows
If fails, |
If tips above do not help, try to clean cache. |
How to clean cache |
try this
|
these are the steps I have taken to resolve this issue in Windows
|
this really did help! Thanks! |
I hit this error using |
For iOS,adding |
Same here. Make sure you reset the cache after adding $ react-native --version
react-native-cli: 2.0.1
react-native: 0.57.5
{
"presets": [
"module:metro-react-native-babel-preset"
],
"plugins": [
["@babel/plugin-transform-flow-strip-types"],
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
} |
Summary: There are some versions of babel 7's flow support that cause problems with property initializers. I changed this code to use class properties to fix the issue. See #20588 Reviewed By: TheSavior Differential Revision: D13396959 fbshipit-source-id: a76266ac0c8a6a19a1c45f7136de4aba9c72581d
My .babelrc is also this, and all the dependencies are latest.
If still wrong, try |
thank @tangliang1 for point this out. |
Try: Worked for me |
i have the problem because of i use 'react-navigation', when i remove 'react-navigation' its run ok, this is work for me, to add the plugin --> @babel/plugin-transform-flow-strip-types |
"mobx": "4.9.2", |
Those who not solved this issue. Try to run react-native start in terminal before react-native run-android or ios. In my case it was all about node js window |
Thank you so much, I almost gave up using react navigation. |
Environment
React Native Environment Info:
System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
Memory: 802.04 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.10.0 - ~/.nvm/v8.10.0/bin/node
Yarn: 1.9.2 - /usr/local/bin/yarn
npm: 5.6.0 - ~/.nvm/v8.10.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 23.0.1, 25.0.0, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.2, 27.0.3, 28.0.0
API Levels: 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4670197
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: 0.56.0 => 0.56.0
npmGlobalPackages:
react-native-git-upgrade: 0.2.7
Description
I recently upgraded my project from RN 0.55.2 to RN 0.56.0 and ran into following error. I was able to track it down to Animated.View. It first appeared in a library that I was using (react-navigation), but I was able to reproduce it with just a single item.
I noticed that earlier in RN 0.56.0 there were similar errors:
I tried to solve the problem using some of the linked solutions and was not able to make any progress.
Could there be an issue with https://github.com/facebook/react-native/blob/master/Libraries/Animated/src/createAnimatedComponent.js#L39 due to babel 7 changes?
Reproducible Demo
https://github.com/reedyrm/react-native-bind-undefined/tree/broken-animated-view
The text was updated successfully, but these errors were encountered: