Skip to content

Commit

Permalink
Android X support
Browse files Browse the repository at this point in the history
  • Loading branch information
vinzscam authored Jul 9, 2019
2 parents f6aeabd + ab4ec4d commit fba2806
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ Native file viewer for react-native. Preview any type of file supported by the m

**Windows**: Start the default app associated with the specified file.

## Android X Breaking changes

The library supports [Android X](https://developer.android.com/jetpack/androidx/) and React Native 0.60+.

If you're using **React Native < 0.60**, please append the following snippet to your `android/app/build.gradle` file:

```
preBuild.doFirst {
ant.replaceregexp(match:'androidx.core.content.', replace:'android.support.v4.content.', flags:'g', byline:true) {
fileset(dir: '../../node_modules/react-native-file-viewer/android/src/main/java/com/vinzscam/reactnativefileviewer', includes: '*.java')
}
}
```

## Getting started

`$ npm install react-native-file-viewer --save`
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ def safeExtGet(prop, fallback) {
}

android {
compileSdkVersion safeExtGet('compileSdkVersion', 23)
buildToolsVersion safeExtGet('buildToolsVersion', '25.0.0')
compileSdkVersion safeExtGet('compileSdkVersion', 28)
buildToolsVersion safeExtGet('buildToolsVersion', '28.0.3')

defaultConfig {
minSdkVersion safeExtGet('minSdkVersion', 16)
targetSdkVersion safeExtGet('targetSdkVersion', 22)
targetSdkVersion safeExtGet('targetSdkVersion', 28)
versionCode 1
versionName "1.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.vinzscam.reactnativefileviewer;

public class FileProvider extends android.support.v4.content.FileProvider {
public class FileProvider extends androidx.core.content.FileProvider {

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v4.content.FileProvider;
import androidx.core.content.FileProvider;
import android.webkit.MimeTypeMap;

import com.facebook.react.bridge.ActivityEventListener;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-file-viewer",
"version": "1.0.15",
"version": "2.0.0",
"description": "Native file viewer for react-native",
"main": "index.js",
"types": "index.d.ts",
Expand Down

0 comments on commit fba2806

Please sign in to comment.