How to do event handling for android and iOS in react native's new architecture for fabric components? #56
Unanswered
BraveEvidence
asked this question in
Q&A
Replies: 1 comment
-
Ok this should help in case any one is facing this issue software-mansion/react-native-screens#1529 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create a
Fabric
component. I have got it working for the most part. The only issue I am facing is I am not able to get click listener to work for afabric
component.I created a spec file
For
android
myfabric
component looks like as followsNot sure what to pass
first param as int
,canCoalesceEvent
,customCoalesceKey
andcategory
inreceiveEvent
In
ViewManager
I did add following code as wellFor
android
I am not getting thecallback
fromnative android
tojs
sideI am following https://reactnative.dev/docs/native-components-android but it was for the old architecture and I think is not applicable for fabric components
Same for
iOS
https://reactnative.dev/docs/native-components-ios, the doc is not very helpful for the new architectureFor
iOS
, I created theheader
andobjective-c++
fileTypically if we want to add property we do this
RCT_EXPORT_VIEW_PROPERTY(text, NSString)
Not sure how to do it for event handler
Complete source code is here https://github.com/PritishSawant/ReactNativeFabricEventListenerExample
Beta Was this translation helpful? Give feedback.
All reactions