[GH-ISSUE #258] Event callbacks don't respect 'event' parameter #172

Open
opened 2026-05-05 11:52:38 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @apollolux on GitHub (Jan 28, 2020).
Original GitHub issue: https://github.com/kusti8/proton-native/issues/258

Describe the bug
Events like Button.onPress can supposedly handle an event parameter (at least, that's what it looks like in their wrappers in the C++) but the actual passing of the event's data doesn't happen.

To Reproduce
Set a Button's onPress to a function with one parameter and console.log it. Observe undefined is logged in its place.

Expected behavior
I expected an object similar to a web Event to be logged.

Versions:

  • OS: Windows 10
  • Version proton-native 2.0.4
  • Node version 11.15.0

Additional context
I understand an Event is mainly a web construct, but there's no reason we can't copy its basics or use nativeEvent like other RN components. For RN component events that don't take parameters (I'm looking at their list right now and quite a few components have event handlers that seem to be designed as zero-parameter callbacks, but it seems the docs are outdated???) I honestly recommend overloading them with one-parameter versions for this and don't know why upstream doesn't (or if they do why the docs haven't been updated to reflect this).

I guess see react-native#27165 for something recent about it? It really feels like they dropped the ball regarding updating docs since a quick look through the current components' sources seem to indicate an event parameter on quite a few of their callbacks, usually extending from some implementation of SyntheticEvent (which seems to attempt to replicate web Event).

Originally created by @apollolux on GitHub (Jan 28, 2020). Original GitHub issue: https://github.com/kusti8/proton-native/issues/258 **Describe the bug** Events like Button.onPress can supposedly handle an `event` parameter (at least, that's what it looks like in their wrappers in the C++) but the actual passing of the event's data doesn't happen. **To Reproduce** Set a Button's `onPress` to a function with one parameter and `console.log` it. Observe `undefined` is logged in its place. **Expected behavior** I expected an object similar to a web Event to be logged. **Versions:** - OS: Windows 10 - Version proton-native 2.0.4 - Node version 11.15.0 **Additional context** I understand an [Event](https://developer.mozilla.org/en-US/docs/Web/API/Event) is mainly a web construct, but there's no reason we can't copy its basics or use `nativeEvent` like other RN components. For RN component events that don't take parameters (I'm looking at their list right now and quite a few components have event handlers that seem to be designed as zero-parameter callbacks, but it seems the docs are outdated???) I honestly recommend overloading them with one-parameter versions for this and don't know why upstream doesn't (or if they do why the docs haven't been updated to reflect this). I guess see [react-native#27165](https://github.com/facebook/react-native/issues/27165) for something recent about it? It really feels like they dropped the ball regarding updating docs since a quick look through the current components' sources seem to indicate an `event` parameter on quite a few of their callbacks, usually extending from some implementation of [SyntheticEvent](https://github.com/facebook/react-native/blob/master/Libraries/Renderer/implementations/ReactFabric-prod.js#L337) (which seems to attempt to replicate web Event).
gitea-mirror added the
enhancement
label 2026-05-05 11:52:38 -06:00
Author
Owner

@kusti8 commented on GitHub (Mar 16, 2020):

Interesting. I'll take a look later.

<!-- gh-comment-id:599758709 --> @kusti8 commented on GitHub (Mar 16, 2020): Interesting. I'll take a look later.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/proton-native#172
No description provided.