React Native: How to export a method with a return value?

前端 未结 3 1209
梦谈多话
梦谈多话 2021-02-18 13:43

What is the best way to export a method with a return value in React Native?

I know there is RCT_EXPORT_METHOD, but that only works for methods that are

3条回答
  •  心在旅途
    2021-02-18 13:55

    Try return values with Callbacks

    RCT_EXPORT_METHOD(findEvents:(RCTResponseSenderBlock)callback)
    {
      NSArray *events = ...
      callback(@[[NSNull null], events]);
    }
    

提交回复
热议问题