microsoft / microsoft/react-native-windows

Dispatching an event with arg value 0 wrongly becomes {}

Open
#8,211 1 comment 0 reactions 1 assignee View on GitHub

@vmoroz is already working on this.

Since Jul 12, 2021.

Area: Native Modules bug Workstream: Module Support
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

int64_t result = foo();
XamlUIService::FromContext(context).DispatchEvent(cd, L"topContentDialogClosed",
  [result](const winrt::Microsoft::ReactNative::IJSValueWriter& evtDataWriter) {
    evtDataWriter.WriteInt64(result);
  });

if result is any non-zero number, this works fine. However if it is zero, then the value of the nativeEvent on the JS side becomes {} i.e. something is converting this to an empty object instead of keeping it as an int as it is intended

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.