React Native lazy loading 250 images in a Scroll View2019 Community Moderator ElectionWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?Hide scrollbar in FlatList (React Native) in AndroidReact Native - Flatlist - onEndReached not called and Infinite ScrollReact Native nested ListView triggers onEndReached multiple times on loadingHow to Scroll Right To Columns in React Native FlatList (2018)Does react-native view not able to scroll without ScrollViewEfficient List for react-native to scroll in both directionsReact-native ScrollView scrolls sometimes in wrong directionTabs with FlatLists inside ScrollView - like Instagram or Twitter profile pages

New passport but visa is in old (lost) passport

Custom alignment for GeoMarkers

Why one should not leave fingerprints on bulbs and plugs?

Math equation in non italic font

Fastest way to pop N items from a large dict

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

I got the following comment from a reputed math journal. What does it mean?

Do the common programs (for example: "ls", "cat") in Linux and BSD come from the same source code?

Is there a symmetric-key algorithm which we can use for creating a signature?

How do you talk to someone whose loved one is dying?

Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?

Are Roman Catholic priests ever addressed as pastor

et qui - how do you really understand that kind of phraseology?

Happy pi day, everyone!

Have the tides ever turned twice on any open problem?

Why Choose Less Effective Armour Types?

What options are left, if Britain cannot decide?

Is it normal that my co-workers at a fitness company criticize my food choices?

I am confused as to how the inverse of a certain function is found.

What is a ^ b and (a & b) << 1?

If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?

What is the relationship between relativity and the Doppler effect?

Why does overlay work only on the first tcolorbox?

How to write cleanly even if my character uses expletive language?



React Native lazy loading 250 images in a Scroll View



2019 Community Moderator ElectionWhat is the difference between using constructor vs getInitialState in React / React Native?What is the difference between React Native and React?Hide scrollbar in FlatList (React Native) in AndroidReact Native - Flatlist - onEndReached not called and Infinite ScrollReact Native nested ListView triggers onEndReached multiple times on loadingHow to Scroll Right To Columns in React Native FlatList (2018)Does react-native view not able to scroll without ScrollViewEfficient List for react-native to scroll in both directionsReact-native ScrollView scrolls sometimes in wrong directionTabs with FlatLists inside ScrollView - like Instagram or Twitter profile pages










1















I have 250 objects in state, that I'm trying to load in a scroll view with an image for each one. I'm using react-native-lazyload, and it works for about the first 75 images, then the scrolling starts slowing down to a halt, almost at the same spot every time.



Is there a different way I can load these images? It seems like a Flatlist would be a better option than a Scrollview, but I have no function I can call onEndReach










share|improve this question






















  • Where are the images stored on the device or on the internet?

    – Andrew
    Mar 6 at 22:21












  • I prefer recycler list view. Although, it is not as easy to use as FlatList, but does the job pretty well

    – Murtaza Raja
    Mar 7 at 2:22











  • @Andrew on the internet

    – peter176
    Mar 7 at 9:03











  • Have you considered using react-native-fast-image?

    – Andrew
    Mar 7 at 9:30











  • @Andrew I tried using it but ran into 'Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.' I'm using crna 2.0.2. I'm not sure if I can use this without ejecting.

    – peter176
    Mar 7 at 11:55















1















I have 250 objects in state, that I'm trying to load in a scroll view with an image for each one. I'm using react-native-lazyload, and it works for about the first 75 images, then the scrolling starts slowing down to a halt, almost at the same spot every time.



Is there a different way I can load these images? It seems like a Flatlist would be a better option than a Scrollview, but I have no function I can call onEndReach










share|improve this question






















  • Where are the images stored on the device or on the internet?

    – Andrew
    Mar 6 at 22:21












  • I prefer recycler list view. Although, it is not as easy to use as FlatList, but does the job pretty well

    – Murtaza Raja
    Mar 7 at 2:22











  • @Andrew on the internet

    – peter176
    Mar 7 at 9:03











  • Have you considered using react-native-fast-image?

    – Andrew
    Mar 7 at 9:30











  • @Andrew I tried using it but ran into 'Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.' I'm using crna 2.0.2. I'm not sure if I can use this without ejecting.

    – peter176
    Mar 7 at 11:55













1












1








1








I have 250 objects in state, that I'm trying to load in a scroll view with an image for each one. I'm using react-native-lazyload, and it works for about the first 75 images, then the scrolling starts slowing down to a halt, almost at the same spot every time.



Is there a different way I can load these images? It seems like a Flatlist would be a better option than a Scrollview, but I have no function I can call onEndReach










share|improve this question














I have 250 objects in state, that I'm trying to load in a scroll view with an image for each one. I'm using react-native-lazyload, and it works for about the first 75 images, then the scrolling starts slowing down to a halt, almost at the same spot every time.



Is there a different way I can load these images? It seems like a Flatlist would be a better option than a Scrollview, but I have no function I can call onEndReach







reactjs react-native react-native-flatlist






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 6 at 21:01









peter176peter176

8810




8810












  • Where are the images stored on the device or on the internet?

    – Andrew
    Mar 6 at 22:21












  • I prefer recycler list view. Although, it is not as easy to use as FlatList, but does the job pretty well

    – Murtaza Raja
    Mar 7 at 2:22











  • @Andrew on the internet

    – peter176
    Mar 7 at 9:03











  • Have you considered using react-native-fast-image?

    – Andrew
    Mar 7 at 9:30











  • @Andrew I tried using it but ran into 'Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.' I'm using crna 2.0.2. I'm not sure if I can use this without ejecting.

    – peter176
    Mar 7 at 11:55

















  • Where are the images stored on the device or on the internet?

    – Andrew
    Mar 6 at 22:21












  • I prefer recycler list view. Although, it is not as easy to use as FlatList, but does the job pretty well

    – Murtaza Raja
    Mar 7 at 2:22











  • @Andrew on the internet

    – peter176
    Mar 7 at 9:03











  • Have you considered using react-native-fast-image?

    – Andrew
    Mar 7 at 9:30











  • @Andrew I tried using it but ran into 'Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.' I'm using crna 2.0.2. I'm not sure if I can use this without ejecting.

    – peter176
    Mar 7 at 11:55
















Where are the images stored on the device or on the internet?

– Andrew
Mar 6 at 22:21






Where are the images stored on the device or on the internet?

– Andrew
Mar 6 at 22:21














I prefer recycler list view. Although, it is not as easy to use as FlatList, but does the job pretty well

– Murtaza Raja
Mar 7 at 2:22





I prefer recycler list view. Although, it is not as easy to use as FlatList, but does the job pretty well

– Murtaza Raja
Mar 7 at 2:22













@Andrew on the internet

– peter176
Mar 7 at 9:03





@Andrew on the internet

– peter176
Mar 7 at 9:03













Have you considered using react-native-fast-image?

– Andrew
Mar 7 at 9:30





Have you considered using react-native-fast-image?

– Andrew
Mar 7 at 9:30













@Andrew I tried using it but ran into 'Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.' I'm using crna 2.0.2. I'm not sure if I can use this without ejecting.

– peter176
Mar 7 at 11:55





@Andrew I tried using it but ran into 'Invariant Violation: requireNativeComponent: "FastImageView" was not found in the UIManager.' I'm using crna 2.0.2. I'm not sure if I can use this without ejecting.

– peter176
Mar 7 at 11:55












1 Answer
1






active

oldest

votes


















1














I found a really good write-up on improving performance of Flatlists here. I ended up using a Flatlist with these setting:



 <FlatList
containerContentStyle=styles.container
data=countries
renderItem=( item ) => (
<View style=styles.results>
<Results
...this.props
country=item
handleUpdate=this.handleUpdate
pendingCountry=pendingCountry
/>
</View>
)
keyExtractor=item => item.alpha2code
ListHeaderComponent=() => this.renderHeader()

// Performance settings
removeClippedSubviews=true // Unmount components when outside of window
initialNumToRender=2 // Reduce initial render amount
maxToRenderPerBatch=1 // Reduce number in each render batch
maxToRenderPerBatch=100 // Increase time between renders
windowSize=7 // Reduce the window size
/>


I can now scroll through my entire list of 250 images at a reasonable pace with no issues. When I start scrolling back up from the bottom, the screen gets a little jerky, but this is the best solution I've gotten to work.






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032060%2freact-native-lazy-loading-250-images-in-a-scroll-view%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I found a really good write-up on improving performance of Flatlists here. I ended up using a Flatlist with these setting:



     <FlatList
    containerContentStyle=styles.container
    data=countries
    renderItem=( item ) => (
    <View style=styles.results>
    <Results
    ...this.props
    country=item
    handleUpdate=this.handleUpdate
    pendingCountry=pendingCountry
    />
    </View>
    )
    keyExtractor=item => item.alpha2code
    ListHeaderComponent=() => this.renderHeader()

    // Performance settings
    removeClippedSubviews=true // Unmount components when outside of window
    initialNumToRender=2 // Reduce initial render amount
    maxToRenderPerBatch=1 // Reduce number in each render batch
    maxToRenderPerBatch=100 // Increase time between renders
    windowSize=7 // Reduce the window size
    />


    I can now scroll through my entire list of 250 images at a reasonable pace with no issues. When I start scrolling back up from the bottom, the screen gets a little jerky, but this is the best solution I've gotten to work.






    share|improve this answer



























      1














      I found a really good write-up on improving performance of Flatlists here. I ended up using a Flatlist with these setting:



       <FlatList
      containerContentStyle=styles.container
      data=countries
      renderItem=( item ) => (
      <View style=styles.results>
      <Results
      ...this.props
      country=item
      handleUpdate=this.handleUpdate
      pendingCountry=pendingCountry
      />
      </View>
      )
      keyExtractor=item => item.alpha2code
      ListHeaderComponent=() => this.renderHeader()

      // Performance settings
      removeClippedSubviews=true // Unmount components when outside of window
      initialNumToRender=2 // Reduce initial render amount
      maxToRenderPerBatch=1 // Reduce number in each render batch
      maxToRenderPerBatch=100 // Increase time between renders
      windowSize=7 // Reduce the window size
      />


      I can now scroll through my entire list of 250 images at a reasonable pace with no issues. When I start scrolling back up from the bottom, the screen gets a little jerky, but this is the best solution I've gotten to work.






      share|improve this answer

























        1












        1








        1







        I found a really good write-up on improving performance of Flatlists here. I ended up using a Flatlist with these setting:



         <FlatList
        containerContentStyle=styles.container
        data=countries
        renderItem=( item ) => (
        <View style=styles.results>
        <Results
        ...this.props
        country=item
        handleUpdate=this.handleUpdate
        pendingCountry=pendingCountry
        />
        </View>
        )
        keyExtractor=item => item.alpha2code
        ListHeaderComponent=() => this.renderHeader()

        // Performance settings
        removeClippedSubviews=true // Unmount components when outside of window
        initialNumToRender=2 // Reduce initial render amount
        maxToRenderPerBatch=1 // Reduce number in each render batch
        maxToRenderPerBatch=100 // Increase time between renders
        windowSize=7 // Reduce the window size
        />


        I can now scroll through my entire list of 250 images at a reasonable pace with no issues. When I start scrolling back up from the bottom, the screen gets a little jerky, but this is the best solution I've gotten to work.






        share|improve this answer













        I found a really good write-up on improving performance of Flatlists here. I ended up using a Flatlist with these setting:



         <FlatList
        containerContentStyle=styles.container
        data=countries
        renderItem=( item ) => (
        <View style=styles.results>
        <Results
        ...this.props
        country=item
        handleUpdate=this.handleUpdate
        pendingCountry=pendingCountry
        />
        </View>
        )
        keyExtractor=item => item.alpha2code
        ListHeaderComponent=() => this.renderHeader()

        // Performance settings
        removeClippedSubviews=true // Unmount components when outside of window
        initialNumToRender=2 // Reduce initial render amount
        maxToRenderPerBatch=1 // Reduce number in each render batch
        maxToRenderPerBatch=100 // Increase time between renders
        windowSize=7 // Reduce the window size
        />


        I can now scroll through my entire list of 250 images at a reasonable pace with no issues. When I start scrolling back up from the bottom, the screen gets a little jerky, but this is the best solution I've gotten to work.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 13:45









        peter176peter176

        8810




        8810





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55032060%2freact-native-lazy-loading-250-images-in-a-scroll-view%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

            Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

            Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved