Skip to content

Commit c240c86

Browse files
committed
1. 解决安卓9.0无法联网的问题
1 parent 61fa897 commit c240c86

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

.eslintrc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ module.exports = {
2525
"parserOptions": {
2626
"ecmaFeatures": {
2727
"experimentalObjectRestSpread": true,
28-
"jsx": true
28+
"jsx": true,
29+
"legacyDecorators": true
2930
},
3031
"sourceType": "module"
31-
},
32+
},
3233
"plugins": [
3334
"react",
3435
"react-native",

android/app/src/debug/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
66

7-
<application tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" android:networkSecurityConfig="@xml/react_native_config" />
7+
<application tools:targetApi="28" tools:ignore="GoogleAppIndexingWarning" />
88
</manifest>

android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
android:label="@string/app_name"
1818
android:icon="@mipmap/ic_launcher"
1919
android:roundIcon="@mipmap/ic_launcher_round"
20+
android:networkSecurityConfig="@xml/network_security_config"
2021
android:allowBackup="false"
2122
android:largeHeap="true"
2223
android:theme="@style/AppTheme">
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<network-security-config>
4+
5+
<base-config cleartextTrafficPermitted="true" />
6+
7+
</network-security-config>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<network-security-config>
3+
<base-config cleartextTrafficPermitted="true" />
4+
5+
</network-security-config>

app/pages/WebView/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import React from 'react';
7-
import { StyleSheet, Text, View, Image, Alert } from 'react-native';
7+
import { StyleSheet, Text, View, StatusBar, Alert } from 'react-native';
88
import { ProgressBar, Button } from '../../components';
99
import { System } from '../../utils';
1010
import { WebView } from 'react-native-webview';
@@ -50,6 +50,7 @@ export default class index extends React.Component<Props, State> {
5050

5151
componentWillUnmount() {
5252
this.props.configStore.hideLoading();
53+
StatusBar.setHidden(false);
5354
}
5455

5556
reload = () => {
@@ -199,6 +200,7 @@ export default class index extends React.Component<Props, State> {
199200
onLoadEnd={this.onLoadEnd}
200201
onLoadStart={this.onLoadStart}
201202
onError={this.onError}
203+
mediaPlaybackRequiresUserAction={false}
202204
/>
203205
{this.renderActionButton()}
204206
</BaseContainer>

0 commit comments

Comments
 (0)