mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
C++ Turbo Module > Allow Promise<void> types (#52388)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52388 Changelog: [Internal] Similar to `AsyncCallback<>` (the foundation of `AsyncPromise`) we should allow `void` Promise types in C++ such as `AsyncPromise<>` Reviewed By: rbergerjr Differential Revision: D77712020 fbshipit-source-id: d7360df5cc1b77f1e03e5fb73b0b468f6e3a415b
This commit is contained in:
committed by
Facebook GitHub Bot
parent
255977a7b9
commit
e8709355dc
@@ -58,6 +58,7 @@ type Examples =
|
||||
| 'promise'
|
||||
| 'rejectPromise'
|
||||
| 'voidFunc'
|
||||
| 'voidPromise'
|
||||
| 'setMenuItem'
|
||||
| 'optionalArgs'
|
||||
| 'emitDeviceEvent';
|
||||
@@ -138,6 +139,10 @@ class NativeCxxModuleExampleExample extends React.Component<{}, State> {
|
||||
.then(() => {})
|
||||
.catch(e => this._setResult('rejectPromise', e.message)),
|
||||
voidFunc: () => NativeCxxModuleExample?.voidFunc(),
|
||||
voidPromise: () =>
|
||||
NativeCxxModuleExample?.voidPromise().then(valuePromise =>
|
||||
this._setResult('voidPromise', valuePromise),
|
||||
),
|
||||
setMenuItem: () => {
|
||||
let curValue = '';
|
||||
NativeCxxModuleExample?.setMenu({
|
||||
|
||||
Reference in New Issue
Block a user