Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
developerElmo opened this issue Aug 26, 2022 · 1 comment

Comments

@developerElmo
Copy link

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!

@lorenz199x
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants