Closed
Description
Today we use NativeMethodsMixin likes this:
NativeMethodsMixin.measure.call(ref, callback)
We could do something like:
const NativeMethodsMixinAsPromise = (ref) => {
return new Promise((resolve, reject) => {
try {
NativeMethodsMixin.measure.call(ref, (x, y, width, height) => resolve(x, y, width, height))
} catch (err) {
reject(err);
}
});
}
Something along these lines, so we can use async
and await
and have a more fluid code.
Can't we make it like this on react-native core?