Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose blank event as a prop #108

Merged
merged 2 commits into from
Feb 16, 2022
Merged

expose blank event as a prop #108

merged 2 commits into from
Feb 16, 2022

Conversation

naqvitalha
Copy link
Collaborator

@naqvitalha naqvitalha commented Feb 15, 2022

This was supposed to be very simple. Exposing blank area as a RFL prop. Once I did that I noticed the following problem

onBlankAreaEvent from Performance wrapper is bubbled down to children leading to incorrect callback. I don't really see why we need to bubble events for these components so I changed to direct ones which are only limited to the component.

ex. If we listen to this event on RFL events for the perf wrapper will also be passed to the RFL subscriber.

I've checked this both on Android/iOS

resolves #53 resolves #57

* Please note that this event isn't synced with onScroll event but works with native onDraw/layoutSubviews. Events with values > 0 are blanks.
* This event is raised even when there is no visible blank with negative values for extensibility however, for most use cases check blankArea > 0 and use the value.
*/
onBlankArea: BlankAreaEventHandler;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding event suffix to remain consistent with event naming

Copy link
Contributor

@fortmarek fortmarek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this PR, direct events are better here, indeed 👍

@@ -25,13 +25,11 @@ class AutoLayoutViewManager: ReactViewManager() {
return AutoLayoutView(context).also { it.pixelDensity = context.resources.displayMetrics.density.toDouble() }
}

override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
override fun getExportedCustomDirectEventTypeConstants(): MutableMap<String, Any> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does this need to be MutableMap?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just what base class specifies so I can't change it

@naqvitalha naqvitalha merged commit c76c536 into main Feb 16, 2022
@naqvitalha naqvitalha deleted the blankAreaExternal branch February 16, 2022 15:09
@shopify-shipit shopify-shipit bot temporarily deployed to production February 22, 2022 22:10 Inactive
@shopify-shipit shopify-shipit bot temporarily deployed to production March 7, 2022 17:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants