1

It's the first time I'm asking here. Been using Stackoverflow from a while but this time, I got stuck for a while for a important long-term school project. I'm also new with React-native.

I'm developping an application in React-Native on Windows, but this application works only on an emulator and not on a real device (tested on a Nexus 5X and a Google Pixel) with an unsigned generated APK and with developpement (câble and Metro bundler)

I checked many solutions here but it not seems to be an error of calls. The code is a bit fat so i can't leave all the code here, i neither have logs, but i can provide on demand (i don't know what could i provide)

Here's the error i'm always getting on devices :

enter image description here

Thanks in advance, this is really important :(

EDIT : I just spotted the fact Metro Bundler aren't bundling (with a progress bar and delta) with the mobile device, but works with the emulator.

Community
  • 1
  • 1
codeinu
  • 21
  • 4
  • Probable duplicate of https://stackoverflow.com/questions/34130539/uncaught-error-invariant-violation-element-type-is-invalid-expected-a-string – Sateesh Yemireddi Oct 25 '18 at 17:25
  • Did you try all the solutions mentioned in link which given by @Sateesh – Samitha Nanayakkara Oct 25 '18 at 17:59
  • Yes...!!! One of the solutions in the mentioned link worked for me when I was facing the same issue. – Sateesh Yemireddi Oct 25 '18 at 18:07
  • @SamithaNanayakkara yes, i saw that and i checked but all seems to be ok, the problem is, i don't understand why this is working on emulator and not in device ? (metro bundler don't do anything with the device :() – codeinu Oct 25 '18 at 20:25

1 Answers1

0

Based on the RN GitHub issues, are you sure that you're exporting your App?

https://github.com/facebook/react-native/issues/16332#issuecomment-336925116

class YourApp extends Component { -> export default class YourApp extends Component<{}> {

If so, is it being registered in the correct way? AppRegistry.registerComponent('yourApp', () => App);

  • Hello, thanks for the answer ! Yeah, every classes (including the main one) are exported with "export default", with `<{]>` after `Component`, i just separate the declaration of the class and his exportation. `class YourApp extends React.Component<{}>` and `export default YourApp;` Also yeah, its registered in the same way. :( – codeinu Oct 25 '18 at 17:39