React-native: "Expected a constructor" error on app launch

Created on 15 Apr 2019  ·  25Comments  ·  Source: facebook/react-native

🐛 Bug Report


Getting the following error on launching app in debug mode:
IMG_1644

Expected Behavior


The app should run normally.
It does not cause any problem when run a release build.

Environment


React Native Environment Info:
System:
OS: macOS 10.14.4
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 27.63 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 11.11.0 - /usr/local/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 23.0.1, 25.0.0, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3
System Images: android-21 | Google APIs Intel x86 Atom_64, android-25 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.4 => 0.59.4
npmGlobalPackages:
create-react-native-app: 2.0.2
react-native-cli: 2.0.1
react-native-create-library: 3.1.2

Bug Locked

Most helpful comment

I found the problem. The problem was with "react-redux": "7.0.0". In this version connect has been implemented as a functional react component. Due to which the babel @ decorators that I used for my project was not working with connect. This caused was the cause of this issue, closing this now.

All 25 comments

@skb1129 Could you provide some code due to which this error occured ?

@saxenanickk I haven't got any code stack trace to this problem. My code runs totally fine if I run it in release mode.

The problem, I think, is with the debug tools in react-native.

I found the problem. The problem was with "react-redux": "7.0.0". In this version connect has been implemented as a functional react component. Due to which the babel @ decorators that I used for my project was not working with connect. This caused was the cause of this issue, closing this now.

was not working with connect

How did you solved this? i would like to keep decorators. did you rollback to a previous version?

Thanks

@julianklumpers No, I didn't find any solution for this. I just removed all the usages of decorators. We were anyhow moving away from them, only some of our files were still using decorators.

I have encountered this problem recently, I don’t know how to solve it at the moment.

was not working with connect

How did you solved this? i would like to keep decorators. did you rollback to a previous version?

Thanks

"react-redux" not recommend using connect as a decorator, because the spec is unstable.

Any fix for this yet? I'm not using redux, instead I'm using mobx which uses a variety of decorators so I assume it's all the same problem..?

I have encountered this problem too...

对此有任何修复吗?我不使用redux,而是使用mobx,它使用各种装饰器,所以我认为它都是同样的问题..?

Hi ,I think it is a mobx-react version problem. I will fall back to v5.4.3 and it will be solved.

facing the same problem.

@liganghui Yes rollback to previous version of mobx-react (v5.4.3) solved this.

how to fix this probleam?

Go back to react-redux 6.0.0

same problem with redux :(

facing the same problem, can this issue be resolved ?

also facing this issue.

same problem

same problem here. would love to keep the decorators :(

I gave up to use the Decorator.

I came here to see "Hey guys! I've just achieved to use some decorator. Just type yarn add some-magic-stuff"

I am crying right now.

* Music starts *
source

also facing this issue.

also facing this issue.How to solve it?

update to react native 0.61 @konylee

Go back to react-redux 6.0.0

thx, i love you.

Was this page helpful?
0 / 5 - 0 ratings