SortableList and SwipeRow doesn't seem to work well together
Hi everyone, I'm using react-native-sortable-list and react-native-swipe-list-view in order to create a sortable list with swipeable row, (see code bellow) but currently it results in a list with swipeable row but it is not sortable anymore.
I've seen that after a fix in v 0.0.19, the two lib should be usable together, so maybe I'm doing something wrong. If anyone can figure my error out it would be awesome !
Thanks !
"react-native-sortable-list": "0.0.20",
"react-native-swipe-list-view": "1.0.6",
import React, { PureComponent } from 'react'
import { View, Text } from 'react-native'
import SortableList from 'react-native-sortable-list'
import { SwipeRow } from 'react-native-swipe-list-view'
import RowShadow from './RowShadow'
import RowShadowButton from './RowShadowButton'
import RowContainer from './RowContainer'
class Example extends PureComponent {
renderItem = ({ data: rowID }) => {
return (
<SwipeRow disableRightSwipe={true}
rightOpenValue={-100}>
<RowShadow>
<RowShadowButton onPress={() => {}}>
<Text>Remove !</Text>
</RowShadowButton>
</RowShadow>
<RowContainer id={rowID}/>
</SwipeRow>
)
}
render () {
return <SortableList data={this.props.rowIDs}
renderRow={this.renderItem}/>
}
}
export default Example
Hi Olivier, I am doing the exact same thing, and have gotten it to work using the manuallyActivateRows prop. Not sure if it is possible to sort and swipe yet without it. Within your SortableList: SortableList data={blob} manuallyActivateRows> Within your renderItem: RowContainer onLongPress={() => this.props.toggleRowActive()}; Within your RowContainer wherever you want the trigger to activate the row: Button onLongPress={this.props.onLongPress}
Hi Justin, thank you very much ! this works fine :)