react-native-shimmer icon indicating copy to clipboard operation
react-native-shimmer copied to clipboard

New architecture support

Open prajnab opened this issue 3 years ago • 13 comments

Added support for the fabric architecture along with backward compatibility for the old architecture.

https://user-images.githubusercontent.com/4522175/197780755-c184e008-b1c6-4931-a4a8-847058da7ae1.mp4

prajnab avatar Sep 30 '22 08:09 prajnab

resolves #35

prajnab avatar Sep 30 '22 08:09 prajnab

Hi, thank you for this PR! I've only run-tested this PR on iOS so far and didn't dive into the code much but I've found two major issues;

  • In Fabric on iOS, initial props and changed props are ignored, it seems it only uses the default props at all times.
  • In Fabric on iOS the app crashes when unmounting the component or reloading the app.

oblador avatar Oct 05 '22 15:10 oblador

Bumped the example app to latest stable which should help you debug this issue

oblador avatar Oct 05 '22 15:10 oblador

Hi, thank you for this PR! I've only run-tested this PR on iOS so far and didn't dive into the code much but I've found two major issues;

  • In Fabric on iOS, initial props and changed props are ignored, it seems it only uses the default props at all times.
  • In Fabric on iOS the app crashes when unmounting the component or reloading the app.

The example is bumped to latest RN version but fabric was not enabled. Let me add two separate examples for the new and old architecture. And let me check again regarding the issues mentioned

prajnab avatar Oct 06 '22 06:10 prajnab

Enabling/disabling fabric is pretty trivial, i prefer having just one example project as it is less maintenance

oblador avatar Oct 06 '22 06:10 oblador

@oblador The issue has been fixed. Please review the updated PR

prajnab avatar Oct 14 '22 04:10 prajnab

Thanks for the update, however the app is still crashing if I reload/hot refresh or toggle the animation enabled switch.

oblador avatar Oct 14 '22 13:10 oblador

Example project crashes on start for me 🤔 Screenshot 2022-10-28 at 15 28 05

oblador avatar Oct 28 '22 13:10 oblador

Example project crashes on start for me 🤔

@oblador Can you please check if you have the latest pull and have deleted the node_modules and build folders before running the app? It looks like the error is due using property "direction" instead of "shimmeringDirection".

In the last commit(d9aef78) I had updated two properties(direction->shimmeringDirection and opacity->shimmeringOpacity) for the old architecture apps as the new ones were accepting shimmeringDirection and shimmeringOpacity.

prajnab avatar Oct 30 '22 16:10 prajnab

Yep, can get it to work now thanks! 👍 Some new/other bugs I found:

  • On Android using Fabric the Loading text is not visible.
  • On iOS using Fabric the animation duration on the Logo seems to be wrong (it's veery slow)

Screenshot_1667212632

oblador avatar Oct 31 '22 10:10 oblador

@oblador Had a look at these issues and here are my observations:

- On Android using Fabric the Loading text is not visible. Had seen this during development, but I confused it was shimmer-android issue due to this previous issue. I was not able to identify what exactly is the reason for the text component to disappear as the image component is working fine.

Also, I noticed that if I comment the text, save it and then uncomment and save it(which makes it render twice), the "Loading..." label will be visible.

- On iOS using Fabric the animation duration on the Logo seems to be wrong (it's very slow) The duration is as expected when we first run the app. But it slows down on reload and will work fine only on relaunch. This could be due to the debug mode.

prajnab avatar Nov 02 '22 18:11 prajnab

Hmm, the linked issue was already fixed by bumping the native dependency. The iOS issue i think is related to how the prop is updated (or not updated). That prop is applied and calculated in a special way on iOS where the order seems to matter.

oblador avatar Nov 02 '22 18:11 oblador

Regarding android, yes I realised it when i rechecked it after you reported. And it is working fine even in my PR for the old architecture. But I am not able to identify what exactly is the issue with new architecture.

Regarding iOS, yes i did see and realise that. Hence i am updating the duration at the end(file - on load line 44 and on update line 111.

prajnab avatar Nov 02 '22 18:11 prajnab