cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
zendevil 2021-02-27T13:51:06.045500Z

I have a flat-list like so:

[flat-list {:refreshControl
                  (r/as-element
                   [refresh-control {:refreshing @(subscribe [:refreshing])
                                     :onRefresh #(dispatch [:load-videos])}])
                  :data (reverse @(subscribe [:videos]))
                  :renderItem (fn [item]
                                (r/as-element
                                 [video-press (get (js->clj item) "item")
                                                        navigation]))
                  :keyExtractor (fn [item] (str (random-uuid)))}]
where video-press is the following:
(defn video-press [video navigation]
  (js/console.log "video is" video)
  (js/console.log "thumbnail is " (get video "thumbnail"))
  [pressable {:key (random-uuid)
              :style {:borderWidth 1
                      :borderColor :gray
                      :height 300
                      :margin 1
                      :marginTop 3
                      :marginBottom 3
                      }
              :onPress #(doall
                         (.navigate navigation :Video)
                         (dispatch [:show-info video]))}
   [image {:source {:uri (str "<https://d211alragp6msc.cloudfront.net/>"
                              ;;"<https://d1i5nt38vlltuu.cloudfront.net/>"
                              (get video "thumbnail"))}
           #_{:uri (get video "photo")} :style {:height "80%" :width "100%"
                                                :resizeMode :contain}}]
   [view {:style {:flex 1 :flexDirection :column}}
    [text {:style {:fontWeight :bold}} (get video "title")]
    [view {:style {:flex 1 :flexDirection :row}}
     [image {:source {:uri (get video "photo")}
             :style
             {:height 40
              :width 40
              :borderRadius 1000}}]
     [text {:style {:margin 5}} (get video "name")]]]
   #_[:&gt; Text {:style {:fontSize 20}} (get video "name")]
   #_[:&gt; Text (get video "description")]]
  )
However, upon scrolling the flatlist, I’m seeing the images disappear. Moreover, the images take a long time to show as well. How do I fix this?

raspasov 2021-02-27T14:18:16.047200Z

@ps look at the various options listed in the docs for FlatList I’ve typically used VirtualizedList directly (never tried FlatList) but perhaps this here can can give you some guidance for the relevant configs of the component to make it work:

zendevil 2021-02-27T15:16:53.048100Z

@raspasov I couldn’t find anything in the docs of flatlist that would fix the problem