rnc-archive / react-native-webgl

DEPRECATED: use expo-gl – Implements WebGL for react-native
296 stars 73 forks source link

Invariant Violation: Native component for 'RNWebGLView' does not exist #48

Closed AndyEsser closed 4 years ago

AndyEsser commented 6 years ago

Hello,

I'm trying to implement some WebGL code within a React Native application and I'm stumbling at the first hurdle.

I've tried to follow the instructions in the README about how to set up the React Native application to support the react-native-webgl Component but I am very new t React Native so suspect I'm doing something very silly and simple to fix but I'm just not sure where to look. Any help would be appreciated.

When testing the React Native application either on my Android phone or an Android Emulator I am receiving the following error and stack trace:

`Invariant Violation: Native component for "RNWebGLView" does not exist

This error is located at: in RNWebGLView (created by WebGLView) in RCTView (at View.js:78) in View (created by WebGLView) in WebGLView (at Game.js:14) in Game (at App.js:8) in App (at registerRootComponent.js:35) in RootErrorBoundary (at registerRootComponent.js:34) in ExpoRootComponent (at renderApplication.js:35) in RCTView (at View.js:78) in View (at AppContainer.js:102) in RCTView (at View.js:78) in View (at AppContainer.js:122) in AppContainer (at renderApplication.js:34)`

Are there any additional steps after the README steps that I need to do to make this component available to the build process?

lukas1596 commented 6 years ago

This may be basic, but I was getting the exact same error and was able to solve with the following steps (some of it is the config on the README file, nonetheless it's included in case it helps someone)

This solved the error for me, hope it helps anyone that has the same issue.

lukas1596 commented 6 years ago

Also, make sure your MainApplication.java has the following line inside the getPackages() method:

protected List getPackages() { return Arrays.asList( // eg. new VectorIconsPackage() new RNWebGLPackage() ); }