@@ -36,6 +36,7 @@ struct MovingLightProps : winrt::implements<MovingLightProps, winrt::Microsoft::
3636 auto cloneFromProps = cloneFrom.as <MovingLightProps>();
3737 size = cloneFromProps->size ;
3838 color = cloneFromProps->color ;
39+ testMixed = cloneFromProps->testMixed .Copy ();
3940 eventParam = cloneFromProps->eventParam ;
4041 objectProp = cloneFromProps->objectProp ;
4142 }
@@ -51,6 +52,9 @@ struct MovingLightProps : winrt::implements<MovingLightProps, winrt::Microsoft::
5152 REACT_FIELD (color)
5253 winrt::Microsoft::ReactNative::Color color{nullptr };
5354
55+ REACT_FIELD (testMixed)
56+ winrt::Microsoft::ReactNative::JSValue testMixed{nullptr };
57+
5458 REACT_FIELD (eventParam)
5559 std::optional<std::string> eventParam;
5660
@@ -60,8 +64,167 @@ struct MovingLightProps : winrt::implements<MovingLightProps, winrt::Microsoft::
6064 const winrt::Microsoft::ReactNative::ViewProps ViewProps;
6165};
6266
63- REACT_STRUCT (MovingLight_OnSomething)
64- struct MovingLight_OnSomething {
67+ REACT_STRUCT (MovingLightSpec_onEventWithMultipleAliasTypes6)
68+ struct MovingLightSpec_onEventWithMultipleAliasTypes6 {
69+ REACT_FIELD (x)
70+ double x{};
71+
72+ REACT_FIELD (y)
73+ double y{};
74+ };
75+
76+ REACT_STRUCT (MovingLightSpec_onEventWithMultipleAliasTypes5)
77+ struct MovingLightSpec_onEventWithMultipleAliasTypes5 {
78+ REACT_FIELD (width)
79+ double width{};
80+
81+ REACT_FIELD (height)
82+ double height{};
83+ };
84+
85+ REACT_STRUCT (MovingLightSpec_onEventWithMultipleAliasTypes4)
86+ struct MovingLightSpec_onEventWithMultipleAliasTypes4 {
87+ REACT_FIELD (width)
88+ double width{};
89+
90+ REACT_FIELD (height)
91+ double height{};
92+ };
93+
94+ REACT_STRUCT (MovingLightSpec_onEventWithMultipleAliasTypes3)
95+ struct MovingLightSpec_onEventWithMultipleAliasTypes3 {
96+ REACT_FIELD (x)
97+ double x{};
98+
99+ REACT_FIELD (y)
100+ double y{};
101+ };
102+
103+ REACT_STRUCT (MovingLightSpec_onEventWithMultipleAliasTypes2)
104+ struct MovingLightSpec_onEventWithMultipleAliasTypes2 {
105+ REACT_FIELD (top)
106+ double top{};
107+
108+ REACT_FIELD (bottom)
109+ double bottom{};
110+
111+ REACT_FIELD (left)
112+ double left{};
113+
114+ REACT_FIELD (right)
115+ double right{};
116+ };
117+
118+ REACT_STRUCT (MovingLightSpec_onEventWithInlineTypes6)
119+ struct MovingLightSpec_onEventWithInlineTypes6 {
120+ REACT_FIELD (x)
121+ double x{};
122+
123+ REACT_FIELD (y)
124+ double y{};
125+ };
126+
127+ REACT_STRUCT (MovingLightSpec_onEventWithInlineTypes5)
128+ struct MovingLightSpec_onEventWithInlineTypes5 {
129+ REACT_FIELD (width)
130+ double width{};
131+
132+ REACT_FIELD (height)
133+ double height{};
134+ };
135+
136+ REACT_STRUCT (MovingLightSpec_onEventWithInlineTypes4)
137+ struct MovingLightSpec_onEventWithInlineTypes4 {
138+ REACT_FIELD (width)
139+ double width{};
140+
141+ REACT_FIELD (height)
142+ double height{};
143+ };
144+
145+ REACT_STRUCT (MovingLightSpec_onEventWithInlineTypes3)
146+ struct MovingLightSpec_onEventWithInlineTypes3 {
147+ REACT_FIELD (x)
148+ double x{};
149+
150+ REACT_FIELD (y)
151+ double y{};
152+ };
153+
154+ REACT_STRUCT (MovingLightSpec_onEventWithInlineTypes2)
155+ struct MovingLightSpec_onEventWithInlineTypes2 {
156+ REACT_FIELD (top)
157+ double top{};
158+
159+ REACT_FIELD (bottom)
160+ double bottom{};
161+
162+ REACT_FIELD (left)
163+ double left{};
164+
165+ REACT_FIELD (right)
166+ double right{};
167+ };
168+
169+ REACT_STRUCT (MovingLightSpec_onEventWithMultipleAliasTypes)
170+ struct MovingLightSpec_onEventWithMultipleAliasTypes {
171+ REACT_FIELD (target)
172+ int32_t target{};
173+
174+ REACT_FIELD (contentInset)
175+ MovingLightSpec_onEventWithMultipleAliasTypes2 contentInset;
176+
177+ REACT_FIELD (contentOffset)
178+ MovingLightSpec_onEventWithMultipleAliasTypes3 contentOffset;
179+
180+ REACT_FIELD (contentSize)
181+ MovingLightSpec_onEventWithMultipleAliasTypes4 contentSize;
182+
183+ REACT_FIELD (layoutMeasurement)
184+ MovingLightSpec_onEventWithMultipleAliasTypes5 layoutMeasurement;
185+
186+ REACT_FIELD (velocity)
187+ MovingLightSpec_onEventWithMultipleAliasTypes6 velocity;
188+
189+ REACT_FIELD (isUserTriggered)
190+ bool isUserTriggered{};
191+ };
192+
193+ REACT_STRUCT (MovingLightSpec_onEventWithInlineTypes)
194+ struct MovingLightSpec_onEventWithInlineTypes {
195+ REACT_FIELD (target)
196+ int32_t target{};
197+
198+ REACT_FIELD (contentInset)
199+ MovingLightSpec_onEventWithInlineTypes2 contentInset;
200+
201+ REACT_FIELD (contentOffset)
202+ MovingLightSpec_onEventWithInlineTypes3 contentOffset;
203+
204+ REACT_FIELD (contentSize)
205+ MovingLightSpec_onEventWithInlineTypes4 contentSize;
206+
207+ REACT_FIELD (layoutMeasurement)
208+ MovingLightSpec_onEventWithInlineTypes5 layoutMeasurement;
209+
210+ REACT_FIELD (velocity)
211+ MovingLightSpec_onEventWithInlineTypes6 velocity;
212+
213+ REACT_FIELD (isUserTriggered)
214+ bool isUserTriggered{};
215+ };
216+
217+ REACT_STRUCT (MovingLightSpec_onTestObjectEvent)
218+ struct MovingLightSpec_onTestObjectEvent {
219+ REACT_FIELD (target)
220+ int32_t target{};
221+
222+ REACT_FIELD (testObject)
223+ winrt::Microsoft::ReactNative::JSValue testObject{nullptr };
224+ };
225+
226+ REACT_STRUCT (MovingLightSpec_onSomething)
227+ struct MovingLightSpec_onSomething {
65228 REACT_FIELD (value)
66229 std::string value;
67230
@@ -73,10 +236,31 @@ struct MovingLightEventEmitter {
73236 MovingLightEventEmitter (const winrt::Microsoft::ReactNative::EventEmitter &eventEmitter)
74237 : m_eventEmitter(eventEmitter) {}
75238
76- using OnSomething = MovingLight_OnSomething;
239+ using OnSomething = MovingLightSpec_onSomething;
240+ using OnTestObjectEvent = MovingLightSpec_onTestObjectEvent;
241+ using OnEventWithInlineTypes = MovingLightSpec_onEventWithInlineTypes;
242+ using OnEventWithMultipleAliasTypes = MovingLightSpec_onEventWithMultipleAliasTypes;
77243
78244 void onSomething (OnSomething &value) const {
79- m_eventEmitter.DispatchEvent (L" something" , [value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
245+ m_eventEmitter.DispatchEvent (L" something" , [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
246+ winrt::Microsoft::ReactNative::WriteValue (writer, value);
247+ });
248+ }
249+
250+ void onTestObjectEvent (OnTestObjectEvent &value) const {
251+ m_eventEmitter.DispatchEvent (L" testObjectEvent" , [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
252+ winrt::Microsoft::ReactNative::WriteValue (writer, value);
253+ });
254+ }
255+
256+ void onEventWithInlineTypes (OnEventWithInlineTypes &value) const {
257+ m_eventEmitter.DispatchEvent (L" eventWithInlineTypes" , [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
258+ winrt::Microsoft::ReactNative::WriteValue (writer, value);
259+ });
260+ }
261+
262+ void onEventWithMultipleAliasTypes (OnEventWithMultipleAliasTypes &value) const {
263+ m_eventEmitter.DispatchEvent (L" eventWithMultipleAliasTypes" , [&value](const winrt::Microsoft::ReactNative::IJSValueWriter writer) {
80264 winrt::Microsoft::ReactNative::WriteValue (writer, value);
81265 });
82266 }
0 commit comments