Git Product home page Git Product logo

Comments (9)

vbuch avatar vbuch commented on July 24, 2024 1

It is not well documented, yes. But it describes where you should fetch docs from. Since FlatList is actually a VirtualizedList: https://facebook.github.io/react-native/docs/virtualizedlist.html#windowsize

from react-native-image-gallery.

Exilz avatar Exilz commented on July 24, 2024

Since v2.0.0, this module relies on FlatList. This is the only thing that will affect the rendering logic of each image.

For now, I left the optional optimizations of the component blank. I will keep an eye on the performance of galleries with a large number of items and/or big images and see if it's important to either provide these optional props for FlatList, or at least let the users provide their own if they need to tweak it.

So, to give you an answer, if FlatList is behaving how react-native describes it, it should render enough images to fill the whole list horizontally, so, only one.

Actually, I'm pretty sure it's not doing that behind the scenes. FlatList is far from being totally finished and is still riddled with bugs and regressions across versions.

I don't want to over-optimize things yet, but if the need arises we'll release a version that renders items in a more optimized way, especially on the first render.

from react-native-image-gallery.

vbuch avatar vbuch commented on July 24, 2024

By default FlatList renders the currently viewed screen + 10 more in any direction. This means you ould normally end up with 21 rendered screens.

from react-native-image-gallery.

Exilz avatar Exilz commented on July 24, 2024

@vbuch this is interesting, is this documented anywhere ? Or did you peak at the source code ? FlatList is still shady right now.

from react-native-image-gallery.

vbuch avatar vbuch commented on July 24, 2024

So in the case of this image gallery setting windowSize={3} should be exactly what's needed.

from react-native-image-gallery.

Exilz avatar Exilz commented on July 24, 2024

I didn't know about this prop, it might be good to allow users to pass props to FlatList directly then.

from react-native-image-gallery.

vbuch avatar vbuch commented on July 24, 2024

Having it set to 3 by default is a good idea though. In most usecases of the gallery you would only need three. You cannot actually scroll past a couple of images, right?

from react-native-image-gallery.

syedabdulbaqi avatar syedabdulbaqi commented on July 24, 2024

I agree with @vbuch, preloading 10 images at the startup is causing initial render of the application slower. This is the reason I rolled back to version 1.1.0 and wrote my own logic using Image.prefetch to preload 3 images.

Version 1.1.0 was not showing any default preloading behavior.

from react-native-image-gallery.

vbuch avatar vbuch commented on July 24, 2024

@syedabdulbaqi you could give this pull request a try and confirm if @Exilz should review it.

from react-native-image-gallery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.