I am using a code snippet from whatsapp to if sticker is whitelisted or not. It always returns false while in logs it shows proper result.
if (cursor != null && cursor.moveToFirst()) {
final int whiteListResult = cursor.getInt(cursor.getColumnIndexOrThrow(QUERY_RESULT_COLUMN_NAME));
Log.d("ReactNative","whiteListResult for "+identifier+" is "+whiteListResult);
return whiteListResult == 1;
}
// getting the value and sending to React Native caller
...
boolean flag = isWhiteListed(...);
// here also logging flag shows correct result
promise.resolve(flag)
...
```js
...
isAdded.then(result => log(result))
// result is always false . tried whitelisted and non whitelisted stickers.
Ok the problem is passing the boolean values to React Native. Do not know how it true becomes false but solution is convert the boolean into string and then pass it to promise.resolve().
Or you can use
WritableArrayorWrittableHash. These objects has methods for pushing boolean values like pushBoolean()/ putBoolean()