Преглед на файлове

fix(AndroidX support): Fixed broken import + added instructions (#583)

Hello, in order to use react-native-webview > 6.0.2 please make your android/gradle.properties contains:
```
android.useAndroidX=true
android.enableJetifier=true
```
This enables AndroidX libraries which are the new standard.

fixes #580 
fixes #581 
fixes #582
Thibault Malbranche преди 5 години
родител
ревизия
585ac7a243
No account linked to committer's email address
променени са 4 файла, в които са добавени 17 реда и са изтрити 6 реда
  1. 1
    0
      README.md
  2. 1
    2
      android/gradle.properties
  3. 1
    1
      android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java
  4. 14
    3
      docs/Getting-Started.md

+ 1
- 0
README.md Целия файл

30
 
30
 
31
 Current Version: ![version](https://img.shields.io/npm/v/react-native-webview.svg)
31
 Current Version: ![version](https://img.shields.io/npm/v/react-native-webview.svg)
32
 
32
 
33
+- [6.0.**2**](https://github.com/react-native-community/react-native-webview/releases/tag/v6.0.2) - Update to AndroidX. Make sure to enable it in your project's `android/gradle.properties`. See [Getting Started Guide](docs/Getting-Started.md).
33
 - [5.0.**1**](https://github.com/react-native-community/react-native-webview/releases/tag/v5.0.0) - Refactored the old postMessage implementation for communication from webview to native.
34
 - [5.0.**1**](https://github.com/react-native-community/react-native-webview/releases/tag/v5.0.0) - Refactored the old postMessage implementation for communication from webview to native.
34
 - [4.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v4.0.0) - Added cache (enabled by default).
35
 - [4.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v4.0.0) - Added cache (enabled by default).
35
 - [3.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v3.0.0) - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).
36
 - [3.0.0](https://github.com/react-native-community/react-native-webview/releases/tag/v3.0.0) - WKWebview: Add shared process pool so cookies and localStorage are shared across webviews in iOS (enabled by default).

+ 1
- 2
android/gradle.properties Целия файл

1
 ReactNativeWebView_kotlinVersion=1.3.11
1
 ReactNativeWebView_kotlinVersion=1.3.11
2
 ReactNativeWebView_compileSdkVersion=28
2
 ReactNativeWebView_compileSdkVersion=28
3
 ReactNativeWebView_buildToolsVersion=28.0.3
3
 ReactNativeWebView_buildToolsVersion=28.0.3
4
-ReactNativeWebView_targetSdkVersion=28
5
-android.useAndroidX=true
4
+ReactNativeWebView_targetSdkVersion=28

+ 1
- 1
android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java Целия файл

10
 import android.net.Uri;
10
 import android.net.Uri;
11
 import android.os.Build;
11
 import android.os.Build;
12
 import android.os.Environment;
12
 import android.os.Environment;
13
-import android.support.annotation.RequiresApi;
13
+import androidx.annotation.RequiresApi;
14
 import android.text.TextUtils;
14
 import android.text.TextUtils;
15
 import android.view.Gravity;
15
 import android.view.Gravity;
16
 import android.view.View;
16
 import android.view.View;

+ 14
- 3
docs/Getting-Started.md Целия файл

12
 
12
 
13
 React Native modules that include native Objective-C, Swift, Java, or Kotlin code have to be "linked" so that the compiler knows to include them in the app.
13
 React Native modules that include native Objective-C, Swift, Java, or Kotlin code have to be "linked" so that the compiler knows to include them in the app.
14
 
14
 
15
-This module does not require any extra step after running the link command 🎉
16
 ```
15
 ```
17
 $ react-native link react-native-webview
16
 $ react-native link react-native-webview
18
 ```
17
 ```
18
+
19
+iOS:
20
+This module does not require any extra step after running the link command 🎉
21
+
22
+Android:
23
+Please make sure AndroidX is enabled in your project by editting `android/gradle.properties` and adding 2 lines:
24
+
25
+```
26
+android.useAndroidX=true
27
+android.enableJetifier=true
28
+```
29
+
19
 For Android manual installation, please refer to [this article](https://engineering.brigad.co/demystifying-react-native-modules-linking-964399ec731b) where you can find detailed step on how to link any react-native project.
30
 For Android manual installation, please refer to [this article](https://engineering.brigad.co/demystifying-react-native-modules-linking-964399ec731b) where you can find detailed step on how to link any react-native project.
20
 
31
 
21
 For iOS, while you can manually link the old way using [react-native own tutorial](https://facebook.github.io/react-native/docs/linking-libraries-ios), we find it easier to use cocoapods.
32
 For iOS, while you can manually link the old way using [react-native own tutorial](https://facebook.github.io/react-native/docs/linking-libraries-ios), we find it easier to use cocoapods.
33
   render() {
44
   render() {
34
     return (
45
     return (
35
       <WebView
46
       <WebView
36
-        source={{uri: 'https://infinite.red'}}
37
-        style={{marginTop: 20}}
47
+        source={{ uri: 'https://infinite.red' }}
48
+        style={{ marginTop: 20 }}
38
       />
49
       />
39
     );
50
     );
40
   }
51
   }