可以使用Golang mobile与React-Native吗?

huangapple go评论169阅读模式
英文:

Can Golang mobile be used with React-Native?

问题

我正在考虑使用Go的移动库(https://godoc.org/golang.org/x/mobile)编写一个移动应用程序(我知道这是实验性的,所以这更多是等待和观望的情况),用于数据层,并为Android视图提供一个polyfill,同时使用React Native(http://facebook.github.io/react-native/)为iOS视图提供支持,希望在支持Android视图时也能使用(如果支持的话)。

如果这样做,我会遇到多少冲突(如果有的话)?我假设我可以在各自的本地语言(如Objective-C和Java)之间在这两个库之间传递数据(我知道这一切都会编译成本地应用程序)。

澄清一下

Go的移动库和React Native都将编译到移动客户端中。Go库向服务器发出请求,它不是服务器本身。

更新

所以React Native已经支持Android,现在我只想知道如何在同一个应用程序可执行文件中让Go Mobile和React Native之间进行通信。

英文:

I'm considering writing a mobile app using both Go's mobile lib https://godoc.org/golang.org/x/mobile (I know it's experimental, so this is more of a wait and see situation) for a data layer and a polyfill for the android view and use React-native http://facebook.github.io/react-native/ for the iOS view and hopefully the android view once that is supported (if it is/will be supported).

How much conflict would I have in doing this, if any? I assume I could pass data between the two libraries from each respective native (as in obj-c and java, I know this all compiles to a native app) languages.

To Clarify

Go's mobile lib and react-native would both be compiled into the mobile client. The go lib makes requests to a server and is not the server.

UPDATE

So React Native came out for Android, so now I'm just wondering how go mobile and react native and communicate between each other within the same app executable.

答案1

得分: 3

是的,你可以这样做。你可以将生成的代码包含在你的React Native项目中,并编写一些"粘合代码"(一个Objective-C和Java类),该类需要你的Go库,并使用React Native的Native Module扩展来访问提供的功能。

英文:

Yes, you can do that. You may include the generated code in your react native project and write some "glue code" (an objective-c and java class) that requires your go library and uses the Native Module extension by React Native to get access to the provided functionality.

答案2

得分: 0

我相信React Native可以用于使用任何可以在Web上运行的语言制作移动应用程序。目前我正在学习如何使用Golang后端构建React应用程序。稍后我将使用React Native构建此应用程序,并开始使用Golang构建其他应用程序,以查看其能达到的程度。Udemy上有一门教授Golang和React的课程,而且并不太长。

英文:

I believe that React Native can be used to make mobile apps with any language that can run on the web. Currently I am learning how to make React app with a Golang backend. Later I will build this in React Native and start building other apps with Golang to see how far this goes. There is a course on udemy that teaches golang and react and it isn't that long.

huangapple
  • 本文由 发表于 2015年9月9日 00:50:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/32463184.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定