react-native-sortable-list icon indicating copy to clipboard operation
react-native-sortable-list copied to clipboard

Conflict with TouchableOpacity / TouchableWithoutFeedback...

Open JonathanWi opened this issue 9 years ago • 8 comments

When using any Touchable component (instead of <View>) as the row container, the re-ordering doesn't work.

<Animated.TouchableOpacity style={[
        styles.row,
        this.state.style,
      ]}>
      <Image source={{uri: data.image}} style={styles.image} />
      <Text style={styles.text}>{data.text}</Text>
</Animated.TouchableOpacity>

JonathanWi avatar Nov 11 '16 14:11 JonathanWi

What is Animated.TouchableOpacity? There is no TouchableOpacity in Animated from react-native. I've tried

<TouchableOpacity style={[
        styles.row,
        this.state.style,
      ]}>
        <Image source={{uri: data.image}} style={styles.image} />
        <Text style={styles.text}>{data.text}</Text>
</TouchableOpacity>

and re-ordering works fine. If you want to use TouchableWithoutFeedback instead of TouchableOpacity you need to wrap children into additional View

gitim avatar Nov 16 '16 13:11 gitim

It seems that the explanation is clear and issue is solved. If you still have questions please reopen it.

gitim avatar Nov 26 '16 20:11 gitim

I've run into this issue -- TouchableOpacity causes the re-ordering functionality to fail. My code:

<SortableList
     data={this.state.data}
     renderRow={({ data, active }) => {
         return (
             <TouchableOpacity style={styles.card}>
                 <Text>Row</Text>
             </TouchableOpacity>
         );
     }}
/>

When I change TouchableOpacity into View it works fine.

harrisonturton avatar Dec 19 '17 09:12 harrisonturton

Have the same issue as harrisonturton.

mckrava avatar Feb 12 '18 10:02 mckrava

@gitim Let's reopen this issue. I have the exact same problem as @harrisonturton

rhazegh avatar Apr 26 '18 05:04 rhazegh

@harrisonturton is there a fix for using <TouchableOpacity> in row item?

LiamLuUW avatar May 17 '18 16:05 LiamLuUW

related issue #105 (simplified steps to reproduce the bug)

rhazegh avatar May 17 '18 16:05 rhazegh

I'm also facing same issue. Have to go through with the whole idempotent logic including revamp of handling click events in parent container. would be hugely appreciable of someone to add please status or pull request.

m-alikhizar avatar Jan 08 '19 22:01 m-alikhizar