jemise111/react-native-swipe-list-view

rowMap returns me all the props instead of the actual rowMap. React Native 0.69.3

developerElmo opened this issue · 1 comments

Describe the bug
Hi! So our app recently changed version to 0.69.3 and maintained the react-native-swipe-list-view to 3.2.9.
After upgrading our app crashes whenever it involves closing any row item.

Upon further checking it seems that the reason behind it rowMap returns me the props instead of the actual rowMap object.

To Reproduce
To reproduce the scenario here is the code of my test screen:

`
import { View, Text, TouchableOpacity, StyleSheet } from 'react-native'
import React from 'react'
import { SwipeListView } from 'react-native-swipe-list-view'
import { faker } from '@faker-js/faker'

const SwipeListViewTest = () => {
const dataTest = Array(5)
.fill("")
.map((_, i) => ({
key: ${i},
text: item #${i},
data: [
{
productName: faker.commerce.productName(),
}
]
}))

const keyExtractor = (item: any, index: number) => {
return item.productName + index
}

const renderItem = (data: any, rowMap: any) => {
return (
<TouchableOpacity onPress={() => console.log('on press', rowMap)} style={styles.mainView}>
Test {data.item.productName}

)
}

return (

)
}

const styles = StyleSheet.create({
mainView: {
height: 50,
width: 200,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'yellow',
alignSelf: 'center'
}
})

export default SwipeListViewTest
`

Screenshots
screen:
image

log:
image

Environment (please complete the following information):

  • OS: [Android]
  • RNSLV Version: [v3.2.9]
  • RN Version: [e.g. 0.69.3]

I've read other similar issues like:
#360
#547

But it seems that it involves a keyExtractor problem but I think my keyExtractor works fine.

If you need additional info please let me know. I am not really sure what other packages are needed that could be affecting my app.
Thanks!

I think that error is related on how you handle the data in state. Thanks 👍