react-swipeable-tabs icon indicating copy to clipboard operation
react-swipeable-tabs copied to clipboard

Aligning TabList to Center does not move border

Open Paresh-Arvind-Patil opened this issue 8 years ago • 0 comments

Upon setting the alignCenter prop to true, the TabList moves to the center, but the border seems to remain at the start of the component still. Does the borderTranslateX prop of the ListBorder component not get reset in the case where the alignCenter is set to true?

I copied most of my code from the example, and by referring to #3 .Here it is:

class TestTabs extends React.Component {
  constructor(props){
    super(props);
    this.state = {
      activeItemIndex: 0,
      items: []
    }
  }
  componentWillMount() {
    this.setState({
      activeItemIndex: 0,
      items: [
        <div>Item 1</div>,
        <div>Item 2</div>,
        <div>Item 3</div>,
        <div>Item 4</div>,
      ]
    });
  }
 
  render() {
    return (
      <SwipeableTabs
        noFirstLeftPadding={false}
        noLastRightPadding={false}
        fitItems={false}
        alignCenter={true}
        borderWidthRatio={1}
        activeItemIndex={this.state.activeItemIndex}
        onItemClick={(item, index) => this.setState({ activeItemIndex: index })}
        items={this.state.items}
        borderPosition="bottom"
        borderThickness={4}
        borderColor="#4dc4c0"
        activeStyle={{
          color: '#4dc4c0'
        }}
      />


    );  
  }
} 
export default TestTabs;

Paresh-Arvind-Patil avatar Mar 30 '18 05:03 Paresh-Arvind-Patil