computerjazz / react-native-draggable-flatlist

A drag-and-drop-enabled FlatList for React Native
MIT License
1.93k stars 403 forks source link

refreshing, onRefresh are not working #114

Open bingbing720 opened 4 years ago

bingbing720 commented 4 years ago

"react": "16.9.0" "react-native": "0.61.4" "react-native-draggable-flatlist": "https://github.com/computerjazz/react-native-draggable-flatlist.git" Jan 8 2020

Karthik-B-06 commented 4 years ago

This worked for me.

Import RefreshControl from react-native import { RefreshControl } from 'react-native';

And use it like this

<DraggableFlatList 
      showsVerticalScrollIndicator={false}
      contentContainerStyle={{
        paddingBottom: 50,
      }} 
      refreshControl={
        <RefreshControl
          tintColor={'#FCF450'}
          onRefresh={_onRefresh}
          refreshing={refreshing}
        />
      }
      data={draggableList}
      renderItem={_renderDraggableItem}
      keyExtractor={(item, index) => `draggable-item-${index}`}
      onDragEnd={_onDragEnd}
/>

The DraggableFlatlist component spreads the props to the interior FlatList.

bingbing720 commented 4 years ago

Thanks @Karthik-B-06 I will check it later. Does it mean this component has prop which name is RefreshControl?

Karthik-B-06 commented 4 years ago

@bingbing720 No. RefreshControl https://reactnative.dev/docs/refreshcontrol is a component used inside a for enabling pull to refresh functionality. The component spreads the props to the inside, accepts refreshControl prop because it inherits all props of .

kevinpiske commented 4 years ago

Same problem here... Using RefreshControl works, but the scroll stop work.

Karthik-B-06 commented 4 years ago

@kevinpiske Are you facing the issue in android ??

kevinpiske commented 4 years ago

@Karthik-B-06 yes, not tested on iOS.

rvieceli commented 4 years ago

Same problem in android here, in iOS looks good (i'm testing).

dev-sathish commented 4 years ago

This worked for me.

Import RefreshControl from react-native import { RefreshControl } from 'react-native';

And use it like this

<DraggableFlatList 
      showsVerticalScrollIndicator={false}
      contentContainerStyle={{
        paddingBottom: 50,
      }} 
      refreshControl={
        <RefreshControl
          tintColor={'#FCF450'}
          onRefresh={_onRefresh}
          refreshing={refreshing}
        />
      }
      data={draggableList}
      renderItem={_renderDraggableItem}
      keyExtractor={(item, index) => `draggable-item-${index}`}
      onDragEnd={_onDragEnd}
/>

The DraggableFlatlist component spreads the props to the interior FlatList.

This one is working fine. guys please follow this props for onRefresh in draggable flat list. Thanks but onScroll is not working..

invibot commented 4 years ago

Looks like pull-to-refresh is still not working on Android

 ...
      refreshControl={
        <RefreshControl
          tintColor={'#FCF450'}
          onRefresh={_onRefresh}
          refreshing={refreshing}
        />
      }
 ...
hakanpinar commented 4 years ago

I'm having the same issue :/

    <DraggableFlatList
                onDragEnd={onDragEnd}
                data={favouriteTeams}
                renderItem={renderTeam}
                keyExtractor={(item, index) => index.toString()}
                refreshControl={<RefreshControl refreshing={favouriteTeamsAreLoading} onRefresh={refreshFavouriteTeams} />}
                contentContainerStyle={isEmpty(favouriteTeams) && ApplicationStyles.center}
                ListEmptyComponent={<Text style={ApplicationStyles.text.regular}> 
                {Language.favouritesScreen.noFavouriteTeamsAdded}</Text>}
            />
dev-sathish commented 3 years ago

This worked for me. Import RefreshControl from react-native import { RefreshControl } from 'react-native'; And use it like this

<DraggableFlatList 
      showsVerticalScrollIndicator={false}
      contentContainerStyle={{
        paddingBottom: 50,
      }} 
      refreshControl={
        <RefreshControl
          tintColor={'#FCF450'}
          onRefresh={_onRefresh}
          refreshing={refreshing}
        />
      }
      data={draggableList}
      renderItem={_renderDraggableItem}
      keyExtractor={(item, index) => `draggable-item-${index}`}
      onDragEnd={_onDragEnd}
/>

The DraggableFlatlist component spreads the props to the interior FlatList.

This one is working fine. guys please follow this props for onRefresh in draggable flat list. Thanks but onScroll is not working..

If not please see #242 and use it in that way but it, not a solution.. you have your swipe at the topmost of the screen.

hraschan commented 3 years ago

Same problem. Works on IOS but not on Android

hraschan commented 3 years ago

Any updates on this issue?

thanhluantl2304 commented 2 years ago

still waiting for solution. Any update???

AhmedAliIS commented 2 years ago

Still Waiting for solution.. Any updates?

bwjohns4 commented 2 years ago

Any updates here?

pardoxKH commented 2 years ago

Any updates on this issue?

mordechaim commented 1 year ago

❗❗

To fix this issue, use the RefreshControl component from react-native-gesture-handler instead:

-import { RefreshControl } from 'react-native'
+import { RefreshControl } from 'react-native-gesture-handler'
WAQAZ0178 commented 1 year ago

NOTE import { RefreshControl } from 'react-native-gesture-handler'

  <DraggableFlatList
                  data={watchlistData}
                  renderItem={({item, drag}) => renderItem(item, drag)}
                  keyExtractor={(item, index) => index.toString()}
                  onDragEnd={onDragEnd}
                  contentContainerStyle={{
                    marginTop: responsiveHeight(2),
                    paddingBottom: responsiveHeight(20),
                  }}
                  refreshing={true}
                  refreshControl={
                    <RefreshControl
                      refreshing={loading}
                      onRefresh={onRefresh}
                    />
                  }
/>
jgudo commented 1 month ago

NOTE import { RefreshControl } from 'react-native-gesture-handler'

  <DraggableFlatList
                  data={watchlistData}
                  renderItem={({item, drag}) => renderItem(item, drag)}
                  keyExtractor={(item, index) => index.toString()}
                  onDragEnd={onDragEnd}
                  contentContainerStyle={{
                    marginTop: responsiveHeight(2),
                    paddingBottom: responsiveHeight(20),
                  }}
                  refreshing={true}
                  refreshControl={
                    <RefreshControl
                      refreshing={loading}
                      onRefresh={onRefresh}
                    />
                  }
/>

The only problem now is that the Refresh control gets triggered upon dragging an item down.