-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Welcome!
I encountered a problem when implementing a native module library (with C++/WinRT):
I have a native module exposing a callback-based function, like so:
REACT_METHOD( CheckAvailabilityCallback, L"checkAvailabilityCallback" );
void CheckAvailabilityCallback( std::function<void( winrt::hstring )> resultCallback ) noexcept
{
auto&& result = provider.getAvailabilityMessage();
resultCallback( winrt::to_hstring(result) );
}which is launched when a button is pressed:
<Button title='Check the availability' onPress={() => {
console.log("Button pressed!");
Fingerprint.checkAvailabilityCallback((result) => {
console.log(`Got here successfully with result: ${result}`);
Alert.alert('SUCCESS!', `${result}`);
console.log("Also got here, but there's no alert shown...");
});
}}/>The problem is that I can see all logs in the console, but instead of Alert being shown, the application hangs - button looks to be constantly pressed and app doesn't respond anymore...
In the logs there are also couple of errors, but I could find anything useful about them on the Internet, sorry if I missed something...
Here is a screen of logs:

At first glance, I thought that this may be related to the UI thread, but launching the native call through:
context.UIDispatcher().Post( [&]() -> {} )
resulted in a crash, so that's not it.
edit:
I completely forgot: version I'm using is:
"react-native-windows": "^0.64.0-0",
I'm posting this issue as a question, as I believe there's something I'm not fully aware of, so perhaps you could share some knowledge I'm missing here.
I would really appreciate your help!