Closed chyamuna closed 2 years ago
Please attach a reproducible demo to be able to debug your issue 👍
I am also seeing this error on Android physical device. It works when I install the app to the personal profile. However, when I deploy it to the AWP (Android Work Profile), this shows up. I believe Google Chrome may be disabled in our AWP since we do not see the app in our AWP play store. Could this error be related to not having the Google Chrome browser available?
public handleNewsPress = (index: number) => {
const {newsFeed} = this.props;
NativeInAppBrowser(newsFeed.data[index].Link);
};
export const NativeInAppBrowser = async (URL: string) => {
try {
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.open(URL, {
// iOS Properties
dismissButtonStyle: "done",
readerMode: false,
animated: true,
modalPresentationStyle: "pageSheet",
modalTransitionStyle: "coverVertical",
modalEnabled: true,
enableBarCollapsing: false,
ephemeralWebSession: true,
// Android Properties
showTitle: true,
toolbarColor: "#FFFFFF",
enableUrlBarHiding: false,
enableDefaultShare: true,
forceCloseOnRedirection: false,
// Specify full animation resource identifier(package:anim/name)
// or only resource name(in case of animation bundled with app).
animations: {
startEnter: "slide_in_right",
startExit: "slide_out_left",
endEnter: "slide_in_left",
endExit: "slide_out_right"
},
headers: {
"my-custom-header": "my custom header value"
}
});
} else {
Linking.openURL(URL);
}
} catch (error: any) {
Alert.alert(error.message);
}
}
Hey @chyamuna !
I just faced the same issue, and adding those missing lines from the installation doc in our build.gradle
fixed the issues
androidXAnnotation = "1.2.0"
androidXBrowser = "1.3.0"
Does it solves the issue for you too ? (Weirdly enough, we have another project without those lines, but also on AndroidX, that is working fine 🙃 )
This error comes from a fail native Linking (wrong installation), Android Backward compatibility is hard to support 😅
Our app works on another platform. Platform is a hybrid app, where it doesn't support auto linking. I was incorrectly linking the module in our app. when I added this android native module to our platform android native modules, our app could able to consume this module and the error is not coming anymore
In my case, I added these line to android/build.grade, run cd android && ./gradlew clean && cd .. and rebuild
We are facing the error 'Can not read property isAvailable of null' with below simple code
React native version : 0.64.2 react-native-inappbrowser version : 3.6.3 using typescript Android API 30 pixel emulator
Note: