mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Support emitting typed RCTDeviceEmitter events
Summary: This enables to code-gen base C++ types for custom exported JS types from a RN TM spec - which have been previously excluded from code-gen as these aren't used in any function. The only work around so far was to ‘register’ a random function using the custom type which should be used for RCTDeviceEventEmitter events Changelog: [Internal] Reviewed By: rshest Differential Revision: D56685903 fbshipit-source-id: add9ca40018b91c9fca98609ba3d1f85d3affec1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
cfbee0b7ec
commit
c96c893374
@@ -116,6 +116,17 @@ template <>
|
||||
struct Bridging<MenuItem>
|
||||
: NativeCxxModuleExampleCxxMenuItemBridging<MenuItem> {};
|
||||
|
||||
#pragma mark - RCTDeviceEventEmitter events
|
||||
|
||||
using CustomDeviceEvent = NativeCxxModuleExampleCxxCustomDeviceEvent<
|
||||
std::string,
|
||||
int32_t,
|
||||
std::optional<float>>;
|
||||
|
||||
template <>
|
||||
struct Bridging<CustomDeviceEvent>
|
||||
: NativeCxxModuleExampleCxxCustomDeviceEventBridging<CustomDeviceEvent> {};
|
||||
|
||||
#pragma mark - implementation
|
||||
class NativeCxxModuleExample
|
||||
: public NativeCxxModuleExampleCxxSpec<NativeCxxModuleExample> {
|
||||
@@ -185,7 +196,7 @@ class NativeCxxModuleExample
|
||||
|
||||
void setMenu(jsi::Runtime& rt, MenuItem menuItem);
|
||||
|
||||
void emitCustomDeviceEvent(jsi::Runtime& rt, jsi::String eventName);
|
||||
void emitCustomDeviceEvent(jsi::Runtime& rt, const std::string& eventName);
|
||||
|
||||
void voidFuncThrows(jsi::Runtime& rt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user