【发布时间】:2019-08-26 03:32:17
【问题描述】:
我是一个使用 react-native 的跨平台项目的新手,我想知道如何将 javascript 字符串数组转换为 Java 数组 (String[]) 和 iOS NSArray。
例如, 我的 JS 组件有
constructor(props) {
super(props);
this.state = {
isLoading: false,
devices: [],
selectedDevices:[]
};
}
我的 Android 原生模块期望如下 -
public void disableDevices(String[] deviceNames){
...
}
有人可以帮忙吗?
【问题讨论】:
-
为什么要在 iOS 中将其数组 [] 转换为 NSArray 而在 Android 中转换为 string[]?
-
我需要将此结果传递给本机模块。
标签: reactjs react-native react-router