Last active
December 2, 2019 11:57
-
-
Save zmnv/53729aace40af35e429e10691ee9e218 to your computer and use it in GitHub Desktop.
RN i18next example with false warning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { PureComponent } from 'react'; | |
import { View } from 'react-native'; | |
import { connect } from 'react-redux'; | |
import i18n from '@app/i18n'; | |
// or import withTranslation('calibration')(Component); | |
import { ButtonBottom } from '@app/theme/components/Button'; | |
class Component extends PureComponent { | |
... | |
render() { | |
return ( | |
<View style={styles.root}> | |
<Text>{i18n.t('calibration:hello')}</Text> | |
</View> | |
); | |
} | |
} | |
const mapStateToProps = { ... }; | |
const mapDispatchToProps = { ... }; | |
export default connect( | |
mapStateToProps, | |
mapDispatchToProps, | |
)(Component); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import i18next from 'i18next'; | |
import { initReactI18next } from 'react-i18next'; | |
import { calibrationLocalesFiles } from '@app/apps/DeviceCalibrationWizard/locales'; | |
import i18nextOptions from './i18nextOptions'; | |
const i18n = i18next.createInstance(); | |
i18n | |
.use(initReactI18next) | |
.init(i18nextOptions({ | |
resources: { | |
en: { | |
calibration: calibrationLocalesFiles.en, | |
}, | |
ru: { | |
calibration: calibrationLocalesFiles.ru, | |
} | |
}, | |
react: { | |
wait: true | |
} | |
})) | |
; | |
export default i18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import '@app/i18n'; | |
.... | |
AppRegistry.registerComponent('appName', () => App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment