fixed RN 0.64

This commit is contained in:
sgellar 2019-08-17 13:29:01 +08:00
parent 0ae9a6386c
commit 308a0b9c3d
3 changed files with 32 additions and 65 deletions

View File

@ -1,7 +1,9 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { WebView, View, StyleSheet, Platform } from 'react-native'; import { View, StyleSheet, Platform } from 'react-native';
import renderChart from './renderChart'; import renderChart from './renderChart';
import echarts from './echarts.min'; import echarts from './echarts.min';
import WebView from "react-native-webview";
import getTpl from "./tpl" ;
export default class App extends Component { export default class App extends Component {
@ -34,7 +36,7 @@ export default class App extends Component {
}} }}
scalesPageToFit={Platform.OS !== 'ios'} scalesPageToFit={Platform.OS !== 'ios'}
originWhitelist={['*']} originWhitelist={['*']}
source={require('./tpl.html')} source={{ html:getTpl() }}
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null} onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
/> />
</View> </View>

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
export default ()=>`<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
<title>echarts</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style type="text/css">
html,body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
// overflow: hidden;
}
#main {
height: 100%;
}
</style>
<script src="https://cdn.bootcss.com/echarts/4.2.1/echarts.min.js"></script>
</head>
<body>
<div id="main" ></div>
<body>
<html>
` ;