How to do event handling for android and iOS in react native's new architecture for fabric components? #1529
Replies: 6 comments 5 replies
-
iOSAssuming native spec you posted is correct (I'm not really familiar with TypeScript + Codegen duo) when you run link to the screenshot with Pods structure You can then use these classes in your if (_eventEmitter != nullptr) {
std::dynamic_pointer_cast<const facebook::react::$$NAME OF YOUR EVENT EMITTER TYPE$$>(_eventEmitter)
->onEvent(facebook::react::$$NAME OF YOUR EVENT EMITTER TYPE::OnEvent{.value = $$VALUE$$});
} See links below to see how it is done in
Android
|
Beta Was this translation helpful? Give feedback.
-
@kkafar Thanks will check on this. Do you have any idea on how do it for android. I have tried it for android as I have little experience with it but I am not able to transmit click listener event from native side to js side. In case you have time check this https://github.com/PritishSawant/ReactNativeFabricEventListenerExample |
Beta Was this translation helpful? Give feedback.
-
dispatch is deprecated. What's the alternative? |
Beta Was this translation helpful? Give feedback.
-
Can you help me in understanding how to refactor the above highlighted code according to my use case? |
Beta Was this translation helpful? Give feedback.
-
@kkafar Brillaint stuff. Working for ios. Will try for android as well and get back to you |
Beta Was this translation helpful? Give feedback.
-
@kkafar I am facing issue on android. I get below screen when I click on my button. I did override I also override |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to learn Fabric for the new architecture . Can someone please help me with this https://stackoverflow.com/questions/72981626/how-to-do-event-handling-for-android-and-ios-in-react-natives-new-architecture. I was trying to go through this repo on how this lib implemented it but found it extremely challenging due to the codebase.
Beta Was this translation helpful? Give feedback.
All reactions