Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

大佬,taro 项目打包rn 与原生通信 #5203

Closed
Leavds opened this issue Dec 27, 2019 · 6 comments
Closed

大佬,taro 项目打包rn 与原生通信 #5203

Leavds opened this issue Dec 27, 2019 · 6 comments
Assignees

Comments

@Leavds
Copy link

Leavds commented Dec 27, 2019

问题描述

复现步骤

如题,我目前的做法是把taro打包生成rn_temp文件夹然后拷到壳子项目根目录用ReactContextBaseJavaModule进行通信,还有其他的方式吗?比如可以直接在taro的包里面直接做可以吗?

/**
 * 这段注释后可以贴代码
 * 提供完整可复现的代码和整理好代码格式,有助于我们快速定位问题,节省你我时间
 * 代码提供不全或代码格式混乱的 issues 【有可能会被忽略】
 * 
 * 查看如何插入代码:https://coding.net/help/doc/project/markdown.html#i-5
 */

期望行为

报错信息

系统信息

补充信息

如果您有功能上的建议,可以提到 FeatHub

使用上的问题,欢迎在「Taro 社区」一起交流

@taro-bot
Copy link

taro-bot bot commented Dec 27, 2019

CC @Pines-Cheng

@taro-bot
Copy link

taro-bot bot commented Dec 27, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@Pines-Cheng
Copy link
Contributor

可以采用和 原生 RN 一样的做法:和原生端通信,必要时写跨端代码。

@Leavds
Copy link
Author

Leavds commented Dec 30, 2019

现在用的就是这种,每次 项目打包 都会覆盖原有的js ,需要恢复修改的代码?我的意思是可不可以直接将依赖导入taro项目的package.json文件中,然后在src目录下的js文件中加判断调用Android的东西 这样可以么?

@Pines-Cheng
Copy link
Contributor

@Leavds 不太懂你的需求~

@Leavds
Copy link
Author

Leavds commented Jan 6, 2020

额 是这个意思,Android,rn通信用的是ReactContextBaseJavaModule这个东西,本身我之前的做法是每次taro项目打包生成rn代码,在这些rn代码里添加与Android的交互,这样的问题就是每次生成的rn代码都需要添加交互代码,现在我的做法是直接在taro代码里添加会话类型判断,加上与Android交互的代码,这样目前操作是可以的。

@Leavds Leavds closed this as completed Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants