Closed andey closed 7 years ago
undefined is not an object (evaluating 'RNImmersive.setImmersive')
should be a JavaScript error.
You might want to check if there's files in 'node_modules/react-native-immersive' after npm install
And checking the react-native run-android
building output should have logs like:
:react-native-immersive:preBuild UP-TO-DATE
:react-native-immersive:preReleaseBuild UP-TO-DATE
:react-native-immersive:checkReleaseManifest
:react-native-immersive:preDebugAndroidTestBuild UP-TO-DATE
:react-native-immersive:preDebugBuild UP-TO-DATE
:react-native-immersive:preDebugUnitTestBuild UP-TO-DATE
:react-native-immersive:preReleaseUnitTestBuild UP-TO-DATE
:react-native-immersive:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
...
:react-native-immersive:mergeReleaseJniLibFolders UP-TO-DATE
:react-native-immersive:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:react-native-immersive:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:react-native-immersive:bundleRelease UP-TO-DATE
react-native run-android
Scanning 564 folders for symlinks in /home/andey/Dropbox/Projects/wyse/node_modules (11ms)
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:react-native-immersive:compileLint
:react-native-immersive:copyReleaseLint UP-TO-DATE
:react-native-immersive:preBuild UP-TO-DATE
:react-native-immersive:preReleaseBuild UP-TO-DATE
:react-native-immersive:checkReleaseManifest
:react-native-immersive:preDebugAndroidTestBuild UP-TO-DATE
:react-native-immersive:preDebugBuild UP-TO-DATE
:react-native-immersive:preDebugUnitTestBuild UP-TO-DATE
:react-native-immersive:preReleaseUnitTestBuild UP-TO-DATE
:react-native-immersive:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:react-native-immersive:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:react-native-immersive:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:react-native-immersive:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:react-native-immersive:prepareComFacebookReactReactNative0420Library UP-TO-DATE
:react-native-immersive:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:react-native-immersive:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:react-native-immersive:prepareReleaseDependencies
:react-native-immersive:compileReleaseAidl UP-TO-DATE
:react-native-immersive:compileReleaseRenderscript UP-TO-DATE
:react-native-immersive:generateReleaseBuildConfig UP-TO-DATE
:react-native-immersive:generateReleaseAssets UP-TO-DATE
:react-native-immersive:mergeReleaseAssets UP-TO-DATE
:react-native-immersive:generateReleaseResValues UP-TO-DATE
:react-native-immersive:generateReleaseResources UP-TO-DATE
:react-native-immersive:mergeReleaseResources UP-TO-DATE
:react-native-immersive:processReleaseManifest UP-TO-DATE
:react-native-immersive:processReleaseResources UP-TO-DATE
:react-native-immersive:generateReleaseSources UP-TO-DATE
:react-native-immersive:processReleaseJavaRes UP-TO-DATE
:react-native-immersive:compileReleaseJavaWithJavac UP-TO-DATE
:react-native-immersive:extractReleaseAnnotations UP-TO-DATE
:react-native-immersive:mergeReleaseProguardFiles UP-TO-DATE
:react-native-immersive:packageReleaseJar UP-TO-DATE
:react-native-immersive:compileReleaseNdk UP-TO-DATE
:react-native-immersive:packageReleaseJniLibs UP-TO-DATE
:react-native-immersive:packageReleaseLocalJar UP-TO-DATE
:react-native-immersive:packageReleaseRenderscript UP-TO-DATE
:react-native-immersive:packageReleaseResources UP-TO-DATE
:react-native-immersive:bundleRelease UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library UP-TO-DATE
:app:prepareComFacebookFrescoDrawee0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFbcore0110Library UP-TO-DATE
:app:prepareComFacebookFrescoFresco0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipeline0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineBase0110Library UP-TO-DATE
:app:prepareComFacebookFrescoImagepipelineOkhttp30110Library UP-TO-DATE
:app:prepareComFacebookReactReactNative0420Library UP-TO-DATE
:app:prepareComFacebookSoloaderSoloader010Library UP-TO-DATE
:app:prepareOrgWebkitAndroidJscR174650Library UP-TO-DATE
:app:prepareWyseReactNativeImmersiveUnspecifiedLibrary UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug UP-TO-DATE
:app:validateDebugSigning
:app:packageDebug UP-TO-DATE
:app:zipalignDebug UP-TO-DATE
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on '7_WSVGA_Tablet_API_22(AVD) - 6.0'
Installed on 1 device.
BUILD SUCCESSFUL
Total time: 13.619 secs
looks like its included?
Seems like the Java code is included.
Have you checked your node_modules
for node_modules/react-native-immersive/index.js
, and the import
code?
It should be a JavaScript error.
I'm not sure what im suppose to be looking for
Looks OK... Can you try this minimal test code?
import { AppRegistry, View, Text } from 'react-native';
import React, {Component} from 'react';
import {Immersive} from 'react-native-immersive'
Immersive.setImmersive(true)
setTimeout(() => Immersive.setImmersive(true), 2000)
setTimeout(() => Immersive.setImmersive(false), 4000)
setTimeout(() => Immersive.setImmersive(true), 6000)
AppRegistry.registerComponent('[[APP-NAME]]', () => () => {
console.warn('Immersive', Immersive)
console.warn('Immersive', Immersive.setImmersive)
return <View><Text>TEST</Text></View>
})
OK, so this is not at JavaScript Error...
This error means the code in node_modules/react-native-immersive/index.js
can not get RNImmersive
from NativeModules
.
import {NativeModules, Platform} from 'react-native';
const {RNImmersive} = NativeModules;
You should check if the linking process is right. (similar Issue)
Or it might be the simulator, you can try if an Android device (4.4+) works.
I upgraded react, react-dom, react-native to the latest, and I'm using an Android 6.0 Emulator.
"dependencies": {
"react": "16.0.0-alpha.6",
"react-dom": "16.0.0-alpha.6",
"react-native": "0.44.0",
"react-native-immersive": "0.0.4",
"whatwg-fetch": "^1.0.0"
},
I upgraded to 16, because of this thread. https://github.com/facebook/react-native/issues/13017
Anyways....
The only difference between you're installation instructions and what I did, is that I removed the @Override
from my MainActivity.java. This reason I did this, is because when I add it, I get the following error.
...
...
:app:bundleDebugJsAndAssets SKIPPED
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
/home/andey/Dropbox/Projects/wyse/android/app/src/main/java/com/wyse/MainActivity.java:21: error: method does not override or implement a method from a supertype
@Override
^
1 error
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Not sure if this sparks any ideas?
Yes, the linking instruction is outdated..
The codes should not be added to MainActivity.java
, but to MainApplication.java
instead, like this:
package COM.PACKAGE.NAME;
import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import java.util.Arrays;
import java.util.List;
import com.rnimmersive.RNImmersivePackage;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
, new RNImmersivePackage()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
beautiful
looks like you solved the issue.
Thank you so much!
Good to know it finally worked! Will update the README file later.
Hi I can't seem to get Immersive to work. I get an error "undefined is not an object (evaluating 'RNImmersive.setImmersive')
package.json
settings.gradle
build.gradle
MainActivity.java
index.android.js