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. sticky session 粘性会话

    New Elastic Load Balancing Feature: Sticky Sessions | AWS News Blog https://amazonaws-china.com/cn/b ...

  2. windows IDA 调试SO

    还是参考了网上的很多资料,感谢这些前辈的分享. ===================================================================== 环境:win ...

  3. HZNU 与班尼特·胡迪一起攻破浮空城 【DP】

    题目链接 http://acm.hznu.edu.cn/OJ/problem.php?id=2264 思路 从终点往起点走 然后每次更新状态 因为要满足 最短路线 所以其实 只能是 往左走,往下走 或 ...

  4. vue程序中组件间的传值方式

    vue程序在组件中进行传值有多种方式,这里记录我在项目中使用到的三种: 1. 父组件向子组件传值 2. 子组件向父组件传值 3. 通过路由传参 父组件通过props向子组件传值 在子组件script中 ...

  5. C++中如何计算程序运行的时间 (转载)

    转载地址:http://blog.csdn.net/wuxuguang123/article/details/8130081 一 个程序的功能通常有很多种方法来实现,怎么样的程序才算得上最优呢?举个例 ...

  6. JavaScript Constructors

    Understanding JavaScript Constructors It was: 1) This article is technically sound. JavaScript doesn ...

  7. Grunt 自动编译 Less 文件配置

    1.安装Grunt http://www.gruntjs.net/getting-started 2.编辑 package.json 文件 { "name": "Grun ...

  8. CentOS6.5 yum源设置

    在安装完CentOS后一般需要修改yum源,才能够在安装更新rpm包时获得比较理想的速度. 国内比较快的有163源.sohu源.这里以163源为例子. 1. cd /etc/yum.repos.d 2 ...

  9. cowboy中分布式节点通信

    项目开发中,web前端节点需要与远端的聊天服节点通信.聊天服使用了otp,但我对otp下的分布式通信不太清楚,造成了一些问题. 1)首先是cowboy节点的命名.具体参数是配置在工程目录rel下的vm ...

  10. bzoj 3160 万径人踪灭 —— FFT

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3160 求出关于一个位置有多少对对称字母,如果 i 位置有 f[i] 对,对答案的贡献是 2^ ...