24ark / react-native-step-indicator

A simple react-native implementation of step indicator widget compatible with the ViewPager and ListView.
Apache License 2.0
1.44k stars 312 forks source link

How to pass the translation key for the labels #153

Closed sangayt1997 closed 2 years ago

sangayt1997 commented 2 years ago

Hello everyone, I just want to pass the translation key for labels.

packages version: "react": "18.1.0", "react-native": "0.70.1", "react-i18next": "^11.18.6", "i18next": "^21.9.2", "react-native-step-indicator": "^1.0.3",

Code: const labels = ['TRANSLATION_KEY_1', 'TRANSLATION_KEY_2', 'TRANSLATION_KEY_3'];

<StepIndicator customStyles={customStyles} currentPosition={1} stepCount={3} labels={t(labels)} />

Error message:

Render Error undefined is not a function

sangayt1997 commented 2 years ago

Solution: const labels = [t('TRANSLATION_KEY_1'), t('TRANSLATION_KEY_2'), t('TRANSLATION_KEY_3')];