Skip to content

Commit c0d1d6e

Browse files
committed
Implementing the config object to easily change the button's label
1 parent a337e05 commit c0d1d6e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/index.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ function RNMultiStep(props: any): any {
6262
style={props.buttonStyle ? props.buttonStyle : styles.styleBtn}
6363
onPress={onPrevious}
6464
>
65-
<Text style={props.buttonLabelStyle ? props.buttonLabelStyle : styles.styleBtnLabel}>Previous</Text>
65+
<Text style={props.buttonLabelStyle ? props.buttonLabelStyle : styles.styleBtnLabel}>
66+
{props.config.previousButtonLabel ? props.config.previousButtonLabel : 'Previous'}
67+
</Text>
6668
</TouchableOpacity>
6769
}
6870

@@ -71,7 +73,9 @@ function RNMultiStep(props: any): any {
7173
style={props.buttonStyle ? props.buttonStyle : styles.styleBtn}
7274
onPress={onNext}
7375
>
74-
<Text style={props.buttonLabelStyle ? props.buttonLabelStyle : styles.styleBtnLabel}>Next</Text>
76+
<Text style={props.buttonLabelStyle ? props.buttonLabelStyle : styles.styleBtnLabel}>
77+
{props.config.nextButtonLabel ? props.config.nextButtonLabel : 'Next'}
78+
</Text>
7579
</TouchableOpacity>
7680
}
7781
{!canMove.canMoveNext &&
@@ -80,7 +84,9 @@ function RNMultiStep(props: any): any {
8084
style={props.buttonStyle ? props.buttonStyle : styles.styleBtn}
8185
onPress={onSubmit}
8286
>
83-
<Text style={props.buttonLabelStyle ? props.buttonLabelStyle : styles.styleBtnLabel}>Submit</Text>
87+
<Text style={props.buttonLabelStyle ? props.buttonLabelStyle : styles.styleBtnLabel}>
88+
{props.config.submitButtonLabel ? props.config.submitButtonLabel : 'Submit'}
89+
</Text>
8490
</TouchableOpacity>
8591
}
8692
</View>
@@ -129,6 +135,11 @@ RNMultiStep.propTypes = {
129135
buttonLabelStyle: PropTypes.object,
130136
onMoveNext: PropTypes.func,
131137
onMovePrevious: PropTypes.func,
132-
onSubmit: PropTypes.func
138+
onSubmit: PropTypes.func,
139+
config: PropTypes.shape({
140+
nextButtonLabel: PropTypes.string,
141+
previousButtonLabel: PropTypes.string,
142+
submitButtonLabel: PropTypes.string
143+
})
133144
};
134145
export default RNMultiStep;

0 commit comments

Comments
 (0)