mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add function properties to C++ TM complex datatyes (#41810)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41810 Changelog: [Internal] Reviewed By: zeyap Differential Revision: D51858746 fbshipit-source-id: e45ee68fc40e8b7ae3388ecdcedfec646d022e19
This commit is contained in:
committed by
Facebook GitHub Bot
parent
616a907798
commit
db609ff0c6
@@ -57,6 +57,7 @@ type Examples =
|
||||
| 'promise'
|
||||
| 'rejectPromise'
|
||||
| 'voidFunc'
|
||||
| 'setMenuItem'
|
||||
| 'optionalArgs'
|
||||
| 'emitDeviceEvent';
|
||||
|
||||
@@ -135,6 +136,28 @@ class NativeCxxModuleExampleExample extends React.Component<{||}, State> {
|
||||
.then(() => {})
|
||||
.catch(e => this._setResult('rejectPromise', e.message)),
|
||||
voidFunc: () => NativeCxxModuleExample?.voidFunc(),
|
||||
setMenuItem: () => {
|
||||
let curValue = '';
|
||||
NativeCxxModuleExample?.setMenu({
|
||||
label: 'File',
|
||||
onPress: (value: string, flag: boolean) => {
|
||||
curValue = `${value}: ${flag.toString()}`;
|
||||
this._setResult('setMenuItem', curValue);
|
||||
},
|
||||
items: [
|
||||
{
|
||||
label: 'Open',
|
||||
onPress: (value: string, flag: boolean) => {
|
||||
this._setResult(
|
||||
'setMenuItem',
|
||||
`${curValue} - ${value}: ${flag.toString()}`,
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
shortcut: 'ctrl+shift+f',
|
||||
});
|
||||
},
|
||||
optionalArgs: () => NativeCxxModuleExample?.getWithWithOptionalArgs(),
|
||||
emitDeviceEvent: () => {
|
||||
const CUSTOM_EVENT_TYPE = 'myCustomDeviceEvent';
|
||||
|
||||
Reference in New Issue
Block a user