react-native-sortable-list
react-native-sortable-list copied to clipboard
Disable sorting row + Button on a Row
Hi, I just started working with this module and I found it really usefull. I'm now facing a problem and I'm not sure to understand why.
I've set my sortable list like this :
<SortableList data={{ one: { val: 1, disabled: false }, two: { val: 2, disabled: false }, three: { val: 3, disabled: true } }} style={styles.list} manuallyActivateRows={true} contentContainerStyle={styles.contentContainer} renderRow={this._renderRow} />
I need to set manuallyActivateRows to true because I want to some to be fix. But when I try in my row component to allow some to move (using toggleRowActive function) nothing is working.
render() { const { data, active, toggleRowActive } = this.props; return ( <Animated.View style={[ styles.row, this._style, ]}> <TouchableOpacity onPressIn={toggleRowActive}> <Text style={styles.text}>{data.val}</Text> </TouchableOpacity> </Animated.View> ); }
It seems like OnPressIn is not called as well as OnPress. I also try replacing toggleRowActive by a function which is not called when pressing the row.
I'm not sure ton understand who I'm supposed to make a Row able to be sort again and could'nt find an example about it ,except : https://github.com/gitim/react-native-sortable-list/issues/96
Beyond of this problem of unsortable row I would like to understand how to add buttons on a row to execute some actions.