OGeek|极客世界-中国程序员成长平台

标题: ios - 在 iOS 应用程序中使用 rct 桥来表示 react native 中的表格 View [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-13 10:35
标题: ios - 在 iOS 应用程序中使用 rct 桥来表示 react native 中的表格 View

我正在尝试使用现有的 iOS sdk 对表格 View 使用react。即我将需要使用 RCT 桥(通过 RCT_EXPORT 函数)来执行此操作。这是我第一次使用这个桥头,谁能告诉我怎么做,下面是代码的样子:

viewcontroller.m

RCT_EXPORT_METHOD(tableViewUITableView *)tableView cellForRowAtIndexPathNSIndexPath *)indexPathRCTResponseSenderBlock)callback)
{
   MyProduct *product = self.products[indexPath.row];
   NSLog(@"products list is gonna be sent now");
   callback(@[product.title]);

}

如何在 react js 表格 View 中显示从上述函数返回的数据?

**注意(下面是我要导出的函数)**

- (UITableViewCell *)tableViewUITableView *)tableView cellForRowAtIndexPathNSIndexPath *)indexPath
{
  UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier"Cell" forIndexPath:indexPath];
  MyProduct *product = self.products[indexPath.row];

  cell.textLabel.text = product.title;

  return cell;
}



Best Answer-推荐答案


为此有一个组件。请查看:aksonov/react-native-tableview

关于ios - 在 iOS 应用程序中使用 rct 桥来表示 react native 中的表格 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32448943/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) Powered by Discuz! X3.4