react-native-timeline-listview icon indicating copy to clipboard operation
react-native-timeline-listview copied to clipboard

Render Circle displays icons to far right of 2 column

Open shubhamverma27 opened this issue 5 years ago • 3 comments

I am trying to display a custom view which includes an icon for the circle using renderCircle in a single column left. I can see that my custom view is being rendered. The only issue is that the custom circle is being rendered to the far right of the screen instead of down the middle line that is rendered. Do I maybe need to change more styles or is this a bug?

shubhamverma27 avatar Apr 05 '19 06:04 shubhamverma27

Same is happening for me.

bhaskardabhi avatar Jun 19 '19 12:06 bhaskardabhi

Same for me.

alihaider123go avatar Jan 20 '20 11:01 alihaider123go

In case people are still struggling with this the answer is "Yes". You do need to add some additional style, as the native _renderCircle method manually positions the circles relative to other dimensions.

The renderCircle function you pass into the component is bound to the component. So you can do something like this:

<Timeline
  data={data}
  renderCircle={function (item, index) {
    let circleSize = 9;
    if ([some criteria to identify your custom circle]) {
      return (
        <View
          style={{
            width: circleSize,
            height: circleSize,
            backgroundColor: 'blue',
            right: this.state.width - circleSize / 2 - (lineWidth - 1) / 2,
          }}
        />
      );
    }

    return this._renderCircle(item, index);
  }}
/>

jspizziri avatar Oct 30 '20 15:10 jspizziri