components icon indicating copy to clipboard operation
components copied to clipboard

Feature request: prefetch capacity in react-native

Open Elindorath opened this issue 11 months ago • 0 comments

Hi there,

Here at Staycation, we have recently made use of your react-native component, but we faced an issue that is not easily resolvable on our end: previously, when we only used the <Image> component from react-native, we were able to call its prefetch method before a navigation step. This ensured that the header image on the next page was already loaded, preventing a loading state from being presented to the user. Transitioning to the <TwicImg>, re-implementing this feature is not easy: the url need to be exactly the same between the prefetch call and the one computed by your component, the parameters must be in the exact same order.

Would you consider to add this capacity to your component?

I see two solutions to this issue:

  • Ideal solution: expose a prefetch function taking an object with the same interface the component takes. It would require to add a size property to replaced the size detection.
  • Otherwise, at least expose the internal functions used to parse the parameters and compute the url (mainly what's inside the src/react-native/parse.ts and the src/react-native/compute.ts files).

What do you think?

Elindorath avatar Feb 11 '25 10:02 Elindorath