1.native-echarts 的配置是百度echarts

2.模拟器上试了很多次都显示不出来(具体不清楚,我的是这样)

3.真机测试可以显示图表,以下是配置:

  a。将node_modules\native-echarts\src\components\Echarts下的tpl.html复制到android\app\src\main\assets目录下,assets需要自己新建文件夹

  b。在node_modules\native-echarts\src\components\Echarts下的index.js文件进行修改:

    

import React, { Component } from 'react';
import { WebView, View, StyleSheet, Platform } from 'react-native'; // 需要添加一个Platform
import renderChart from './renderChart';
import echarts from './echarts.min'; export default class App extends Component { constructor(props) {
super(props);
this.setNewOption = this.setNewOption.bind(this);
} componentWillReceiveProps(nextProps) {
if(nextProps.option !== this.props.option) {
this.refs.chart.reload();
}
} setNewOption(option) {
this.refs.chart.postMessage(JSON.stringify(option));
} render() {
return (
<View style={{flex: 1, height: this.props.height || 400,}}>
<WebView
ref="chart"
scrollEnabled = {false}
injectedJavaScript = {renderChart(this.props)}
style={{
height: this.props.height || 400,
backgroundColor: this.props.backgroundColor || 'transparent'
}}
scalesPageToFit={Platform.OS !== 'ios'}
originWhitelist={['*']}
source={Platform.OS === 'ios' ? require('./tpl.html') : {uri:'file:///android_asset/tpl.html'}} // 这处需要修改
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
/>
</View>
);
}
}

native-echarts 在安卓上无法显示出来的更多相关文章

  1. [RN] React Native中使用 react-native-scrollable-tab-view嵌套在ScrollView里,导致 子内容 在安卓上无法显示

    React Native中使用 react-native-scrollable-tab-view嵌套在ScrollView里,导致 子内容 在安卓上无法显示 问题: 0.9.0 或 0.8.0 版本的 ...

  2. 如何用 Retrofit 2 在安卓上实现 HTTP 访问?

    最近,笔者对安卓开发的兴趣愈发浓厚,而且不断尝试了许多传闻很棒的开发库 -- 大部分也真的很不错.于是打算写一个系列文章,介绍使用这些让人惊叹的库建立安卓示例应用的实践.这样,读者可以自行判断,这些库 ...

  3. Echarts 设置地图上文字大小及颜色

    Echarts 设置地图上文字大小及颜色,效果如下: 上代码:关键代码用红色 series: [ { //name: '香港18区人口密度', type: 'map', mapType: 'jiang ...

  4. UNITY2018.3 在editor下运行时new memoryprofiler显示 shader占用内存很大的问题在安卓上并没有看到

    在安卓机上完全看不到shader占用的内存,但问题是,shader在安卓上真的几乎不占用内存了?(我们的游戏中只使用了mobile下的shader) 参考下面这个文章,说是真机上也有: Unity3D ...

  5. 安卓上为什么不能用system.io.file读取streammingAssets目录下的文件

    首先,看文档: Streaming Assets   Most assets in Unity are combined into the project when it is built. Howe ...

  6. lighttpd + php for android 安卓上的WEB服务器

    lighttpd + php for android 安卓上的WEBSER 这个项目在 http://hex.ro/wp/blog/php-and-lighttpd-for-android 目前不支持 ...

  7. Android | 教你如何在安卓上实现通用卡证识别,一键各种卡绑定

    目录 前言 通用卡证识别的应用场景 如何使用通用卡证识别服务 集成通用卡证识别服务的关键流程 开发实战 1 开发准备 1.1 在项目级gradle里添加华为maven仓 1.2 在应用级的build. ...

  8. 关于React Native项目在android上UI性能调试实践

    我们尽最大的努力来争取使UI组件的性能如丝般顺滑,但有的时候这根本不可能做到.要知道,Android有超过一万种不同型号的手机,而在框架底层进行软件渲染的时候是统一处理的,这意味着你没办法像iOS那样 ...

  9. ugui SetParent在安卓上一个诡异bug

    问题描述 我的环境:Unity3D 5.3.7 出问题机型:安卓模拟器.部分低配安卓机型(比如:红米2A) 以下代码是设置某个节点的父节点,在PC.Editor.大部分手机上都是正常的,但问题机型上, ...

随机推荐

  1. Windows踩坑笔记之使用_tWinMain报错的解决方案

    对于如下代码 #include <Windows.h> int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, ...

  2. Sleeping Beauty,摘自iOS应用Snow White and more stories

    Once upon a time, there lived a king and queen. 从前,有个国王和王后. They had a beautiful daughter. 他们有一个漂亮的女 ...

  3. imagemap的推荐使用方法,前端自适应image maps库

    1.map在浏览器的兼容性相对来说是比较好的,这是我在项目中的一个处理方法 推荐到下面网站去画map http://imagemap-generator.dariodomi.de/ 2.画完去gith ...

  4. Hadoop合并小文件的几种方法

    1.Hadoop HAR 将众多小文件打包成一个大文件进行存储,并且打包后原来的文件仍然可以通过Map-Reduce进行操作,打包后的文件由索引和存储两大部分组成: 缺点: 一旦创建就不能修改,也不支 ...

  5. RequireJS 加载 js 执行顺序

    初次接触RequireJS 对文档理解不很透彻,自己通过测试测到的执行顺序: 文档结构: |-amaze | -js | -amazeui.js | -jquery.min.js | -main.js ...

  6. Splay模板(序列终结者)

    我只是一个存模板的,详细的请看这里http://blog.csdn.net/whai362/article/details/47298133 题目链接:http://www.codevs.cn/pro ...

  7. c/c++生成预编译文件

    Preprocesses C and C++ source files and writes the preprocessed output to a file.   /P Remarks The f ...

  8. python获取系统信息psutil

    python获取系统信息psutil:psutil获取系统cpu使用率的方法是cpu_percent(),其有两个参数,分别是interval和percpu,interval指定的是计算cpu使用率的 ...

  9. BZOJ_1941_[Sdoi2010]Hide and Seek_KDtree

    BZOJ_1941_[Sdoi2010]Hide and Seek_KDtree Description 小猪iPig在PKU刚上完了无聊的猪性代数课,天资聪慧的iPig被这门对他来说无比简单的课弄得 ...

  10. Battle Ships(复习泛化物品**)

    传送门Battle Ships Time Limit: 2 Seconds      Memory Limit: 65536 KB Battle Ships is a new game which i ...