Open tharhtet opened 6 years ago
+1 I need to know if this is possible as well
Facing difficulties in using renderLabel
<StepIndicator customStyles={stepIndicatorStyles} currentPosition={currentStepPosition.length} stepCount={Steplabels.length} labels={Steplabels} renderLabel ={() => this.renderLabel(Steplabels.length,"Second",Steplabels,currentStepPosition.length)} direction="vertical" />
renderLabel = ({ position, stepStatus, label, currentPosition }) => { console.log("hhhhhhhhhhhhhhhhhh",position) return ( <Text style={ position === currentPosition ? styles.stepLabelSelected : styles.stepLabel }
{label} )
Facing difficulties in using renderLabel
<StepIndicator customStyles={stepIndicatorStyles} currentPosition={currentStepPosition.length} stepCount={Steplabels.length} labels={Steplabels} renderLabel ={() => this.renderLabel(Steplabels.length,"Second",Steplabels,currentStepPosition.length)} direction="vertical" />
renderLabel = ({ position, stepStatus, label, currentPosition }) => { console.log("hhhhhhhhhhhhhhhhhh",position) return ( <Text style={ position === currentPosition ? styles.stepLabelSelected : styles.stepLabel }
{label}
)
You are using destructurisation for object without the object. renderLabel = ({ position, stepStatus, label, currentPosition }) Try to remove mustaches: renderLabel = (position, stepStatus, label, currentPosition)
worked fine from my side
<View style={{ width: screenWidth + 80, alignSelf: 'center' }}>
<StepIndicator
customStyles={StepIndicatorStyles}
currentPosition={step}
labels={labels}
stepCount={3}
/>
</View>
screen width get in Dimensions from react-native
I achieved this by giving marginHorizontal: -26
to the parent container in which I am using StepIndicator
May I know how can I make full-width even if I use for at least 3 steps?