microsoft / microsoft/react-native-windows

REACT_SYNC_METHOD doesn't allow for void return type

Open
#9,751 0 comments 0 reactions 1 assignee View on GitHub

@vmoroz is already working on this.

Since Mar 30, 2022.

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

Description

Problem Description

REACT_SYNC_METHOD doesn't allow for void return type

e.g.

REACT_SYNC_METHOD(clearBreadcrumbs);    
void clearBreadcrumbs() noexcept {};

1>node_modules\react-native-windows\Microsoft.ReactNative.Cxx\NativeModules.h(629,15): error C2182: 'result': illegal use of type

1> NativeModules.h(629,22): message : Expressions of type void cannot be converted to other types

Steps To Reproduce

Try and compile this function in a react module

REACT_SYNC_METHOD(clearBreadcrumbs);    
void clearBreadcrumbs() noexcept {};
Expected Results

That it would compile successfully and be a no return sync function.

CLI version

npx react-native --version

Environment
npmPackages:
    react: 17.0.2 => 17.0.2
    react-native: ^0.65.1 => 0.65.1
    react-native-windows: 0.65.6 => 0.65.6
Target Platform Version

No response

Target Device(s)

No response

Visual Studio Version

No response

Build Configuration

No response

Snack, code example, screenshot, or link to a repository

No response

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.