-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use Immersive.on() ? #3
Comments
You might want to check if there's files in 'node_modules/react-native-immersive' after And checking the
|
looks like its included? |
Seems like the Java code is included. Have you checked your It should be a JavaScript error. |
Looks OK... Can you try this minimal test code? index.android.jsimport { 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
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.
I upgraded to 16, because of this thread. Anyways.... The only difference between you're installation instructions and what I did, is that I removed the
Not sure if this sparks any ideas? |
Yes, the linking instruction is outdated.. The codes should not be added to 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);
}
} |
Good to know it finally worked! |
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
The text was updated successfully, but these errors were encountered: