jemise111 / react-native-swipe-list-view

A React Native ListView component with rows that swipe open and closed
https://www.npmjs.com/package/react-native-swipe-list-view
MIT License
2.78k stars 528 forks source link

Close previous row on new swipe not working #603

Open ibrar-web opened 2 years ago

ibrar-web commented 2 years ago

<SwipeListView data={custom} renderItem={(data, rowMap) => (

{data.item.name}
                )}
                renderHiddenItem={(data, rowMap) => (
                    <View style={style.rowBack}>
                        <TouchableOpacity style={style.rowBack.button}>
                            <Text>close</Text>
                        </TouchableOpacity>
                        <TouchableOpacity style={style.rowBack.button}>
                            <Text>detail</Text>
                        </TouchableOpacity>

                    </View>
                )}
                leftOpenValue={200}
                rightOpenValue={-200}
            >

            </SwipeListView>
estebanrao commented 2 years ago

Have you tried using closeOnRowBeginSwipe ?

nobane commented 2 years ago

I had this problem recently.

The issue for me was that all my data items needed to have a unique key defined on them.

Make sure all the items in your custom data object have a unique key defined.

marry1822 commented 2 years ago

Doesn't work with the unique key and closeOnRowOpen, closeOnRowBeginSwipe Still several rows are opened at the same time. How to fix it?

<SwipeListView
 closeOnRowOpen
 closeOnRowBeginSwipe
 keyExtractor={item => {
      item.id;
      }}
 data={sortedData()}
 renderItem={renderItem}
 renderHiddenItem={renderHiddenItem}
 rightOpenValue={-300}
 recalculateHiddenLayout={true}
 />
shahanshah87 commented 1 year ago

Doesn't work with the unique key and closeOnRowOpen, closeOnRowBeginSwipe Still several rows are opened at the same time. How to fix it?

<SwipeListView
 closeOnRowOpen
 closeOnRowBeginSwipe
 keyExtractor={item => {
      item.id;
      }}
 data={sortedData()}
 renderItem={renderItem}
 renderHiddenItem={renderHiddenItem}
 rightOpenValue={-300}
 recalculateHiddenLayout={true}
 />

replace id with key

muhammadmahad-debug commented 1 year ago

@Shahanshah87 Sorry for being late but you need to remove bracly brackets or in brackets add return

code-by commented 1 year ago

I have same problem with SwipeRow, how to automatically close row when begin swipe another one

D4RKBR4IN commented 1 year ago

I have same problem with SwipeRow, how to automatically close row when begin swipe another one i have the same problem...

have you been able to resolve this? can you share? thanks

SurajMohanty02 commented 1 year ago

Doesn't work with the unique key and closeOnRowOpen, closeOnRowBeginSwipe Still several rows are opened at the same time. How to fix it?

<SwipeListView
 closeOnRowOpen
 closeOnRowBeginSwipe
 keyExtractor={item => {
      item.id;
      }}
 data={sortedData()}
 renderItem={renderItem}
 renderHiddenItem={renderHiddenItem}
 rightOpenValue={-300}
 recalculateHiddenLayout={true}
 />

It is working