Open phamha98 opened 1 month ago
import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.Callback; import com.facebook.react.bridge.ReactMethod; @ReactMethod public void test(Callback callback) { WritableMap map = Arguments.createMap(); map.putString("yourKey", "yourValue"); // Kiểm tra callback không null trước khi gọi if (callback != null) { callback.invoke(map); } } import { NativeModules } from 'react-native'; const { YourModuleName } = NativeModules; YourModuleName.test((map) => { console.log(map.yourKey); // "yourValue" });