Solution 1 :
You can try with Linking, as WebView is a view that display web pages inside your application.
import * as Linking from 'expo-linking';
Linking.openURL('https://download.microsoft.com/download/1/4/E/14EDED28-6C58-4055-A65C-23B4DA81C4DE/Financial%20Sample.xlsx');
Problem :
I am using Expo .
import { WebView } from "react-native-webview";
and imported webview like above i am trying to load a document file from some https url , it is working fine and loading the xls file in IOS but in android it giving a blank screen.
<WebView
originWhitelist={["*"]}
source={{ uri: 'https://download.microsoft.com/download/1/4/E/14EDED28-6C58-4055-A65C-23B4DA81C4DE/Financial%20Sample.xlsx' }}
onLoadEnd={() => console.log('end' +Platform.OS)}
javaScriptEnabled={true}
domStorageEnabled={true}
useWebKit={true}
style={styles.WebViewStyle}
startInLoadingState={true}
/>
const styles = {
WebViewStyle: {
flex: 1,
marginLeft: 6,
height: "50%",
width: "97%"
}
}
console.log of onLoadEnd is not coming for android but working fine for IOS.
Comments
Comment posted by Gaurav Dixit
Yes i can do this , but this doesn’t solve my purpose. I want to open the document in my app on new screen . My approach is working fine with IOS but i can’t figure out why not on android.
Comment posted by myinitialurl.com.br/arquivos
have you mentioned these props? Thanks for taking your time out for helping me . I have created a snak link for you so that you can understand what is happening actually . When you will run this you will find that it is working fine in IOS but not in android: Comment posted by Gaurav Dixit
Comment posted by snack.expo.io/@gd_11/874548