Skip to content

debug正常,但是release还是不显示,我的rn是0.38 #12

Closed
@WhatAKitty

Description

@WhatAKitty
No description provided.

Activity

WhatAKitty

WhatAKitty commented on Dec 4, 2016

@WhatAKitty
Author

我把它升级成0.39,但是打包还是不行

zt-boom

zt-boom commented on Dec 7, 2016

@zt-boom

真的感谢这个组件,但是release版本真机测试也是无法显示图标,react-native版本是0.34,急求修复

somonus

somonus commented on Dec 7, 2016

@somonus
Owner

这是react-native的一个bug,解决方案参考facebook/react-native#6004

1610449813

1610449813 commented on Dec 7, 2016

@1610449813

release版本只能使用uri加载资源,android把tpl.html文件放在android/app/src/main/assets文件里,使用uri:'file:///android_asset/tpl.html'这个地址加载,ios在项目目录下建个文件夹,把tpl文件放里面去,使用uri:'文件名/tpl'加载,这样能使用,但是好像无法使用webview和native见得通信

1610449813

1610449813 commented on Dec 8, 2016

@1610449813

无法通信找到解决方法了,但是无法使用官方自己的webview,我使用react-native-webview-bridge这个,打包时忽略这个组建的webview方法就行了

zt-boom

zt-boom commented on Dec 8, 2016

@zt-boom

@1610449813 这个问题解决了么,要我自己去改写这个组件么?

1610449813

1610449813 commented on Dec 8, 2016

@1610449813

@ztMalone 恩,如果你不需要webview和native通信,可以使用原生的webview,把他组件里Echarts文件夹的index文件webview source路径改成我上面说的,要是需要通信的话,使用我上面说的第三方组件

lin493369

lin493369 commented on Jan 4, 2017

@lin493369

facebook/react-native#505
参考 @1610449813 的答案。已解决!

huzhiqi

huzhiqi commented on Jan 10, 2017

@huzhiqi

按照@1610449813 的方法还是没有解决

Rylai-Zihang

Rylai-Zihang commented on Jan 17, 2017

@Rylai-Zihang

@1610449813 android release版本通过“把tpl.html文件放在android/app/src/main/assets文件里,使用uri:'file:///android_asset/tpl.html'这个地址加载”已解决!但是IOS下将tpl.html放在项目的一个新建文件夹下,在报URL was not found 的错误,大家都有遇到吗?

belynnyond

belynnyond commented on Feb 7, 2017

@belynnyond

@Rylai-Zihang 大兄弟,你这个问题解决了么

wangchongwei

wangchongwei commented on Feb 24, 2017

@wangchongwei

@1610449813 请问一下如何实现echarts和native的通信?
点击事件?要如何设置,在html中吗?

zt-boom

zt-boom commented on Feb 24, 2017

@zt-boom

16 remaining items

simonguo

simonguo commented on Nov 9, 2017

@simonguo

@wangchongwei @1610449813 通讯可以使用 onMessage

WebView 上设置一个 onMessage , 然后在 option 里面中的 function 中 可以通过 window.postMessage 传值。

amijabd

amijabd commented on Jan 26, 2018

@amijabd

Please explain why need to modify:

Source = {require ('./tpl.html')}

to

Modify Is: source = {{uri: 'file: ///android_asset/tpl.html'}}

and where do I modify this?

will86

will86 commented on Jan 26, 2018

@will86
Contributor

@amijabd
The component WebView powered by Facebook requires that modify...

File of this path ./node_modules/native-echarts/src/components/Echarts/index.js needs to be modified

amijabd

amijabd commented on Jan 29, 2018

@amijabd

Yes, I made those changes based on the above by putting this:
source = {{uri: 'file: ///android_asset/tpl.html'}}

Still after I made a release, the charts still can't be viewed. Not sure what I'm doing wrong.

*When running the emulator, the chart no longer show after the modified code was made.

amijabd

amijabd commented on Jan 30, 2018

@amijabd

Here's the page I did for one of the charts. Not sure where I'm going wrong.

import React, { Component } from 'react';
import { Container, Header, Content, Card, CardItem, Text, Body, Left, Right, Button, H3 } from 'native-base';
import Echarts from 'native-echarts';
export default class SalesProDepartment extends Component {
  render() {
    const option = {
    title : {
        show: true,
        text: 'Product Department',
        subtext: 'Mar 24-Sept 30, 2016',
        x:'center'
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'horizontal',
        bottom: 'bottom',
        data: [
          "-",
          "F-F&B",
          "R-Retail"
        ]
    },
    series : [
        {
            name: 'Department',
            type: 'pie',
            xAxis: '',
            yAxis: '',
            radius: [0, '50%'],
            data:[
              {name: "-", value: 12198.53},
              {name: "F-F&B", value: 26559.58},
              {name: "R-Retail", value: 29900.57}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};
    return (
      <Container>
        <Content padder>
          <Card>
            <CardItem>
              <Button bordered small style={{marginRight: 10}}>
                <Text>Department</Text>
              </Button>
              <Button bordered small>
                <Text>Net Sales</Text>
              </Button>
            </CardItem>
          </Card>
          <Card style={{height:450}}>
            <CardItem>
              <Body>
                <Echarts option={option} height={400} width={350} />
              </Body>
            </CardItem>
         </Card>
        </Content>
      </Container>
    );
  }
}
will86

will86 commented on Jan 30, 2018

@will86
Contributor

@amijabd
Confirm that, does the file tpl.html exists in the path ./android/app/src/main/assets/tpl.html?

amijabd

amijabd commented on Jan 30, 2018

@amijabd

Nope. Its not there. I did the bundling but its not there.

There is however a file in /android/app/src/main/res/raw with the name node_modules_nativeecharts_src_components_echarts_tpl.html

amijabd

amijabd commented on Jan 30, 2018

@amijabd

@will86
Okay. Managed to figure it out. Thanks for the assist.

priyankverma

priyankverma commented on Feb 27, 2018

@priyankverma

@amijabd I have exactly the same problem, how you fixed the problem?

dongyuekai

dongyuekai commented on Aug 6, 2018

@dongyuekai

我这边遇到一个问题 加载china map的时候,在安卓上一切OK,在iOS上 模拟器正常,连线跑到真机上一切正常,release出ipa包后装到手机上就不显示了,最后找到了原因是因为html模板加载路径问题,解决办法如下:
1.在项目全局运行npm run bundle-ios
2.我把html中引用的加载js路径不正确的js文件直接拷贝到了html中,这样不存在路径问题了
经验证,iOS的release模式可以显示出来了

yangmingfa

yangmingfa commented on Sep 16, 2018

@yangmingfa

iOS的release包下图标无法显示,在项目下建立文件夹来存放tpl.html也是不行,android的配置可以了,求各位大佬指点下iOS的路径到底要怎么配置?

SiroSong

SiroSong commented on Sep 24, 2019

@SiroSong

我这边遇到一个问题 加载china map的时候,在安卓上一切OK,在iOS上 模拟器正常,连线跑到真机上一切正常,release出ipa包后装到手机上就不显示了,最后找到了原因是因为html模板加载路径问题,解决办法如下:
1.在项目全局运行npm run bundle-ios
2.我把html中引用的加载js路径不正确的js文件直接拷贝到了html中,这样不存在路径问题了
经验证,iOS的release模式可以显示出来了

你这个中文是英语老师教的吧,,,,,第二条你自己读试试,能读懂吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @amijabd@simonguo@hanhui@gongchao@WhatAKitty

        Issue actions

          debug正常,但是release还是不显示,我的rn是0.38 · Issue #12 · somonus/react-native-echarts