Fix SVG issues caused by Chrome 72
This commit is contained in:
Родитель
d370459d3d
Коммит
564590268b
|
@ -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 '';
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче