ibitcy / react-native-hole-view

✂️ React-Native component to cut a touch-through holes anywhere you want. Perfect solution for tutorial overlay
400 stars 24 forks source link

[HELP NEEDED] Current work on new architecture support #22

Closed zabojad closed 1 year ago

zabojad commented 1 year ago

Hi there !

I've tried to add support for both new and old architecture.

I'm facing the following issues:

Unhandled SoftException
com.facebook.react.bridge.ReactNoCrashSoftException: Cannot find EventEmitter for receivedTouches: ReactTag[10] UIManagerType[2] EventName[topTouchStart]
    at com.facebook.react.uimanager.events.ReactEventEmitter.receiveTouches(ReactEventEmitter.java:103)
    at com.facebook.react.uimanager.events.TouchEvent.dispatchModern(TouchEvent.java:192)
    at com.facebook.react.uimanager.events.EventDispatcherImpl$DispatchEventsRunnable.run(EventDispatcherImpl.java:370)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
    at java.lang.Thread.run(Thread.java:1012)

This is probably due to the use of UIManager that is obsolete with Fabric:

        val uiManager = (context as ReactContext).getNativeModule(UIManagerModule::class.java)
        mEventDispatcher = uiManager!!.eventDispatcher

The question I don't have the answer yet is: what should be used instead with the new arch?

What should be done here with the new arch so that the mask is applied to the hole view component's children as well?

I need some help to fix above issues and finalize this PR...

Maybe @stephenkopylov or @3c133ps3d could give an hand here?

zabojad commented 1 year ago

https://github.com/reactwg/react-native-new-architecture/discussions/138 https://github.com/reactwg/react-native-new-architecture/discussions/137

zabojad commented 1 year ago

OK, we have now a fully functional Android version (both old and new architecture)

stephenkopylov commented 1 year ago

@zabojad thank you so much for your PR - please give me few days to check and merge it!

zabojad commented 1 year ago

@stephenkopylov don't merge it yet, I need to sort out few issue on iOS with new arch. That's why I've labelled it "Help needed" :)...

zabojad commented 1 year ago

@stephenkopylov you can now review the PR in order to merge it. It works on both iOS and Android (with or without new arch) on my end...