swipeout icon indicating copy to clipboard operation
swipeout copied to clipboard

Missing custom component support

Open xxvvii opened this issue 7 years ago • 0 comments

In src/Swipeout.tsx:

  renderCustomButton(button) {
    const buttonStyle = button.style || {};
    const bgColor = buttonStyle.backgroundColor || 'transparent';
    const Component = (
      <View
        style={{
          flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: bgColor,
        }}
      >
        {React.isValidElement(button.text) ? button.text : (
          <Text style={[button.style, { textAlign: 'center' }]}>
            {button.text}
          </Text>
        )}
      </View>
    );
    return {
      text: button.text || 'Click',
      onPress: button.onPress,
      type: 'default',
      component: Component,
      backgroundColor: 'transparent',
      color: '#999',
      disabled: false,
    };
  }

button.component is simply ignored but the parameter exists in react-native-swiperout, please add the parameter so we can use custom component like custom icon in swipeout.

xxvvii avatar May 22 '18 08:05 xxvvii