dancormier / react-native-swipeout

iOS-style swipeout buttons behind component
MIT License
2.62k stars 645 forks source link

how can i hidden the button according different state #297

Open daniel031699 opened 5 years ago

daniel031699 commented 5 years ago

i want to hidden button use different state image

lucascordina commented 5 years ago

I'm not certain what you mean. Do you want to show/hide buttons based on the component's state itself?

If so, keep in mind that you are essentially adding objects to an array. You could do something as simple as:

   mySwipeoutButtons = [
      {
        text: 'Remove',
        onPress: () => console.log('removing item')
      },
      {
        text: 'Mark Done',
        onPress: () => console.log('marking item as done')
      },
    ];

    if (state.isEditable) {
        mySwipeoutButtons.push({
          text: 'Edit',
          onPress: () => console.log('editing item'),
      });
    }