zabojad / haxe-react-native-stack

Tech stack for mobile apps with Haxe, Redux and React native
https://zabojad.github.io/haxe-react-native-stack
MIT License
6 stars 0 forks source link

Runtime Component Exception - Element type is invalid #8

Closed cambiata closed 3 years ago

cambiata commented 3 years ago

Thank you, Thomas, for this repo! Seems to be a good way of combinig haxe and react-native workflows.

When running the Haxe-compiled app, I get the following: "Component Exception - Element type is invalid: expected a string (for built-in components) or a class/function...

exception

I'm on Andriod studio: 4.1.1, react-native-cli: 2.0.1, react-native: 0.56.0 Compiled with Haxe 4.1.4

Maybe something related to this: https://stackoverflow.com/questions/34130539/uncaught-error-invariant-violation-element-type-is-invalid-expected-a-string

Ideas?

/ Jonas

cambiata commented 3 years ago

Hello again! It seems to be a problem with haxe js scoping and exporting. I get it to work by using

-D js-es=6 -D js-classic

and after compile replacing $hx_exports["App"] = App; with export default App; (Maybe it's a problem just with latest something..? react-native: 0.56.0? react-native-cli: 2.0.1?)

With the solution I can go on exploring Haxe & R-N! :-)

zabojad commented 3 years ago

Hey @cambiata ! Thank you for your interest. I will be honest, I interrupted the work on this repo quite some time ago because of lack of interest by anyone else I talked about it to.

Anyway, if you think it can be useful, I might give it some time to get it right. Right now it is obsolete as it is Haxe 3 and an old version of the haxe-react-native lib...

The error "Component Exception - Element type is invalid: expected a string (for built-in components) or a class/function... means you are trying to render something which is neither a String nor a React component...

Can you please share your code here so that I check what's wrong?

cambiata commented 3 years ago

Hello again, Thomas, and sorry for late answer!

No problem with your code - to my newly found understanding. I was expecting Haxe to produce an App.js fully compatible with the default App.js producued by react-native init ..., but obviously it isn't... There are some initiatives to solve this: https://github.com/HaxeFoundation/haxe/pull/10003

I'm closing this now.