خرید بک لینک

Vote count: 0

I wrote a native module in Android that needs to send data to my React Native JS code.

However, the data I wish to send is a complex model and isn't one of basic types (int, double, array, etc.).

Here is method in the native module:

@ReactMethod
public void getDeviceInfo(final Callback successCallback, final Callback errorCallback) {
    successCallback.invoke(new SomeComplexModel());
}

The application crashes when trying to invoke the success method (same goes when trying to use Promises).

One way to tackle this problem is mapping the complex model into WriteableMap or something like that, but I'd prefer not to.

Do I have another choice?

I followed this tutorial: https://facebook.github.io/react-native/docs/native-modules-android.html

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 26 فروردين 1395 ساعت: 21:17

صفحه بندی