-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(native): use FS for Android Release Mode #2980
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 052f5bf:
|
@@ -16,6 +16,7 @@ export type { ThreeEvent, Events, EventManager, ComputeFunction } from './core/e | |||
export { createEvents } from './core/events' | |||
export type { ObjectMap, Camera } from './core/utils' | |||
export * from './native/Canvas' | |||
export * from './native/polyfills' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using this for testing? We don't want an asymmetrical export between web and native since that can create broken behavior in isomorphic apps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Monkeypathing on useLayoutEffect is not really correct, because if we are using some loader with preload on top level - it throws. For example this code will thrown, because it's called before monkeypathing.
useGLTF.preload(require('sdfsdf.glb))
Maybe the good way to provide polyfills is to use polyfills
on top level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure. We'll have to polyfill at the native entrypoint.
It affects models too (glb in my case), but I don't know how to solve it in case of monkeypatching, i just modified workaround #2577 (comment). |
For background, looks like the root issue is in -- https://github.com/expo/expo/blob/1277abdd1ecb21aa43b22a48282439c97b1c1798/packages/expo-asset/src/Asset.ts#L166 which is later used https://github.com/expo/expo/blob/1277abdd1ecb21aa43b22a48282439c97b1c1798/packages/expo-asset/src/PlatformUtils.ts#L59C43-L59C43, reflecting the patches here. There is special casing for drawables on Android that is independent of the bundler. Performing the patch after acquiring the asset should give |
I've been making related fixes for GLB and internal image handling in #2982. Can you try with the following to see if it handles your case? Polyfills are added at the top-level and it has a direct fix for Android Release Mode. // package.json
{
"dependencies": {
"@react-three/fiber": "https://pkg.csb.dev/pmndrs/react-three-fiber/commit/0772cfaa/@react-three/fiber"
}
} |
Continuing in #2982. |
#2644
This bug reproduced in my case and I patched fiber with solution from comment and its resolved. I want it to work in react native out of the box