Fix SVG issues caused by Chrome 72

This commit is contained in:
Dongyu Zhao 2019-02-12 13:22:11 +08:00
Родитель d370459d3d
Коммит 564590268b
6 изменённых файлов: 27 добавлений и 11 удалений

8
dist/Components/Basic/Svg.js поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
import * as React from 'react';
import { WebView } from 'react-native';
import { Platform, WebView } from 'react-native';
export class Svg extends React.Component {
constructor(props) {
super(props);
@ -30,7 +30,11 @@ export class Svg extends React.Component {
}
get src() {
if (this.props.url) {
return this.props.url.replace('"', '\'');
let url = this.props.url.replace('"', '\'');
if (Platform.OS === 'android') {
return encodeURI(url);
}
return url;
}
return '';
}

Просмотреть файл

@ -1,5 +1,5 @@
import * as React from 'react';
import { WebView } from 'react-native';
import { Platform, WebView } from 'react-native';
export class Svg extends React.Component {
constructor(props) {
super(props);
@ -30,7 +30,11 @@ export class Svg extends React.Component {
}
get src() {
if (this.props.url) {
return this.props.url.replace('"', '\'');
let url = this.props.url.replace('"', '\'');
if (Platform.OS === 'android') {
return encodeURI(url);
}
return url;
}
return '';
}

Просмотреть файл

@ -36,7 +36,7 @@
"devDependencies": {
"@types/lodash": "latest",
"@types/react": "latest",
"@types/react-native": "^0.57.15",
"@types/react-native": "^0.57.35",
"@types/react-native-vector-icons": "^4.6.4",
"del": "latest",
"gulp": "latest",
@ -51,6 +51,6 @@
},
"dependencies": {
"lodash": "latest",
"react-native-vector-icons": "^6.1.0"
"react-native-vector-icons": "^6.2.0"
}
}

Просмотреть файл

@ -1,5 +1,5 @@
import * as React from 'react';
import { StyleProp, ViewStyle, WebView } from 'react-native';
import { Platform, StyleProp, ViewStyle, WebView } from 'react-native';
interface IProps {
url: string;
@ -52,7 +52,11 @@ export class Svg extends React.Component<IProps> {
private get src() {
if (this.props.url) {
return this.props.url.replace('"', '\'');
let url = this.props.url.replace('"', '\'');
if (Platform.OS === 'android') {
return encodeURI(url);
}
return url;
}
return '';
}

Просмотреть файл

@ -49,7 +49,7 @@ export class ImageView extends React.Component<IProps, IState> {
// tslint:disable-next-line:max-line-length
public setState<K extends keyof IState>(state: ((prevState: Readonly<IState>, props: Readonly<IProps>) => (Pick<IState, K> | IState | null)) | (Pick<IState, K> | IState | null), callback?: () => void) {
if (this.mounted) {
super.setState(state, callback);
super.setState(state as any, callback);
}
}

Просмотреть файл

@ -1,5 +1,5 @@
import * as React from 'react';
import { WebView } from 'react-native';
import { Platform, WebView } from 'react-native';
export class Svg extends React.Component {
constructor(props) {
super(props);
@ -30,7 +30,11 @@ export class Svg extends React.Component {
}
get src() {
if (this.props.url) {
return this.props.url.replace('"', '\'');
let url = this.props.url.replace('"', '\'');
if (Platform.OS === 'android') {
return encodeURI(url);
}
return url;
}
return '';
}