Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native WebView file download/upload not working in Android

I am developing a react-native application and in it i am using the WebView component to render web pages inside the app. But i cannot download the files from the website in the android mobile app.

<View style={styles.container}>
    <WebView
          source={{ uri: 'https://********** }}
          ref={'WEBVIEW_REF'}
          startInLoadingState={true}
          scalesPageToFit={true}
          onNavigationStateChange={this.onNavigationStateChange.bind(this)}
          javaScriptEnabled={true}
     />
</View>

I found there are issues reported in the GitHub react-native repository and still they are open. But is there any solution for this ?

like image 745
Amila Dulanjana Avatar asked Feb 24 '26 14:02

Amila Dulanjana


1 Answers

ReactNative's WebView on Android does not support file input.

You can use this npm Module:

https://www.npmjs.com/package/react-native-webview-file-upload-android

  • File input for any type of file Support for downloading files using the Android DownloadManager
  • Permission requests for Android SDK
  • Version >26 (required for new Play Store builds now, and for updates from November 2018)
like image 91
yogeshwar nair Avatar answered Feb 26 '26 02:02

yogeshwar nair