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

feat: refactor snapshots when going back on Fabric #2134

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

WoLewicki
Copy link
Member

@WoLewicki WoLewicki commented May 14, 2024

Description

PR refactoring snapshots when going back on Fabric on both platforms.

@WoLewicki WoLewicki marked this pull request as ready for review May 16, 2024 13:21
@WoLewicki WoLewicki changed the title feat: first look at working version on fabric feat: refactor snapshots when going back on Fabric May 16, 2024
Copy link
Member

@tboba tboba left a comment

Choose a reason for hiding this comment

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

Great work! Overall, this code looks good to me. Just left a few remarks there 🎉

@@ -4,7 +4,7 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))

new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
platform = new_arch_enabled ? "11.0" : "9.0"
source_files = new_arch_enabled ? 'ios/**/*.{h,m,mm,cpp}' : ["ios/**/*.{h,m,mm}", "cpp/**/*.{cpp,h}"]
source_files = new_arch_enabled ? 'ios/**/*.{h,m,mm,cpp}' : ["ios/**/*.{h,m,mm}", "cpp/RNScreensTurboModule.cpp", "cpp/RNScreensTurboModule.h"]
Copy link
Member

Choose a reason for hiding this comment

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

Why we're not scoping all .cpp and .h files right now?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because the new files added to the folder should not be compiled on old arch.

Comment on lines 40 to 77
target_include_directories(
rnscreens
PRIVATE
"${REACT_NATIVE_DIR}/ReactAndroid/src/main/jni/react/turbomodule"
"${REACT_NATIVE_DIR}/ReactCommon"
"${REACT_NATIVE_DIR}/ReactCommon/callinvoker"
"${REACT_NATIVE_DIR}/ReactCommon/react/renderer/graphics/platform/cxx"
"${REACT_NATIVE_DIR}/ReactCommon/runtimeexecutor"
"${REACT_NATIVE_DIR}/ReactCommon/yoga"
)

find_package(fbjni REQUIRED CONFIG)

target_link_libraries(
rnscreens
ReactAndroid::jsi
ReactAndroid::folly_runtime
ReactAndroid::react_nativemodule_core
ReactAndroid::react_render_uimanager
ReactAndroid::react_render_scheduler
ReactAndroid::react_utils
ReactAndroid::reactnativejni
ReactAndroid::fabricjni
ReactAndroid::react_debug
ReactAndroid::react_render_core
ReactAndroid::react_render_mounting
ReactAndroid::runtimeexecutor
ReactAndroid::react_render_graphics
ReactAndroid::rrc_view
ReactAndroid::yoga
ReactAndroid::rrc_text
ReactAndroid::rrc_textinput
ReactAndroid::react_render_textlayoutmanager
ReactAndroid::glog
ReactAndroid::react_render_componentregistry
fbjni::fbjni
android
)
Copy link
Member

Choose a reason for hiding this comment

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

Why will we link all of these modules from now?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are all needed to compile the new files. I'll go through them once again to see if we can remove any of those.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok I cleared it a bit. It won't get better than this :D

android/src/main/cpp/NativeProxy.h Outdated Show resolved Hide resolved
@tboba
Copy link
Member

tboba commented May 20, 2024

Hi @WoLewicki! While I was testing all examples from FabricTestExample, I've stumbled onto one app crash while being on the branch from this PR. When I'm trying to run Test640 and I'm coming back to the previous screen (from the screen with TouchableOpacities), I'm getting crash with exception AssertionException and IndexOutOfBoundsException. Do you know what might be the cause of this? 🤔

Exception from Logcat
2024-05-20 15:56:17.375 23934-23978 unknown:SoftAssertions  com.fabrictestexample                E  Unhandled SoftException
                                                                                                    com.facebook.react.bridge.AssertionException: Expected to run on UI thread!
                                                                                                    	at com.facebook.react.bridge.SoftAssertions.assertCondition(SoftAssertions.java:37)
                                                                                                    	at com.facebook.react.bridge.UiThreadUtil.assertOnUiThread(UiThreadUtil.java:44)
                                                                                                    	at com.facebook.react.fabric.FabricUIManager.resolveView(FabricUIManager.java:921)
                                                                                                    	at com.swmansion.rnscreens.NativeProxy.notifyScreenRemoved(NativeProxy.kt:26)
                                                                                                    	at com.facebook.jni.NativeRunnable.run(Native Method)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	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:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:233)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2024-05-20 15:56:17.420 23934-23934 AndroidRuntime          com.fabrictestexample                D  Shutting down VM
2024-05-20 15:56:17.422 23934-23934 AndroidRuntime          com.fabrictestexample                E  FATAL EXCEPTION: main
                                                                                                    Process: com.fabrictestexample, PID: 23934
                                                                                                    java.lang.IndexOutOfBoundsException: getChildDrawingOrder() returned invalid index 1 (child count is 1)
                                                                                                    	at android.view.ViewGroup.getAndVerifyPreorderedIndex(ViewGroup.java:2100)
                                                                                                    	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4314)
                                                                                                    	at android.view.View.draw(View.java:23892)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22756)
                                                                                                    	at android.view.View.draw(View.java:23620)
                                                                                                    	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
                                                                                                    	at com.facebook.react.views.view.ReactViewGroup.drawChild(ReactViewGroup.java:873)
                                                                                                    	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4341)
                                                                                                    	at com.facebook.react.views.view.ReactViewGroup.dispatchDraw(ReactViewGroup.java:846)
                                                                                                    	at android.view.View.draw(View.java:23892)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22756)
                                                                                                    	at android.view.View.draw(View.java:23620)
                                                                                                    	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
                                                                                                    	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4341)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22747)
                                                                                                    	at android.view.View.draw(View.java:23620)
                                                                                                    	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
                                                                                                    	at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1312)
                                                                                                    	at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4317)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22747)
                                                                                                    	at android.view.View.draw(View.java:23620)
                                                                                                    	at android.view.ViewGroup.drawChild(ViewGroup.java:4556)
                                                                                                    	at com.swmansion.rnscreens.ScreenStack.performDraw(ScreenStack.kt:315)
                                                                                                    	at com.swmansion.rnscreens.ScreenStack.access$performDraw(ScreenStack.kt:15)
                                                                                                    	at com.swmansion.rnscreens.ScreenStack$DrawingOp.draw(ScreenStack.kt:327)
                                                                                                    	at com.swmansion.rnscreens.ScreenStack.drawAndRelease(ScreenStack.kt:282)
                                                                                                    	at com.swmansion.rnscreens.ScreenStack.dispatchDraw(ScreenStack.kt:298)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22747)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4540)
                                                                                                    	at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4513)
                                                                                                    	at android.view.View.updateDisplayListIfDirty(View.java:22712)
                                                                                                    	at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:694)
                                                                                                    	at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:700)
                                                                                                    	at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:798)
                                                                                                    	at android.view.ViewRootImpl.draw(ViewRootImpl.java:4939)
                                                                                                    	at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4643)
                                                                                                    	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3822)
                                                                                                    	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2465)
                                                                                                    	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9305)
2024-05-20 15:56:17.422 23934-23934 AndroidRuntime          com.fabrictestexample                E  	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1339)
                                                                                                    	at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1348)
                                                                                                    	at android.view.Choreographer.doCallbacks(Choreographer.java:952)
                                                                                                    	at android.view.Choreographer.doFrame(Choreographer.java:882)
                                                                                                    	at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1322)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                    	at android.os.Looper.loop(Looper.java:294)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8177)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants