Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// (required) Called when a remote or local notification is opened or received
onNotification,
// ANDROID ONLY: GCM or FCM Sender ID (product_number)
senderID: '1025777552500',
// IOS ONLY (optional): default: all - Permissions to register.
permissions: {
alert: true,
badge: true,
sound: true
}
});
addEventListener('change', this.handleLanguagesChange);
if (Platform.OS === 'android') {
Linking.getInitialURL().then((url) => {
if (url) {
this.navigate(url);
}
});
} else {
Linking.addEventListener('url', this.handleOpenURL);
}
}
fallbackLng: {
default: ['en-US'],
'es-US': ['es-LA'],
},
resources: availableResources,
ns: ['common', ...Object.keys(Namespaces)],
defaultNS: 'common',
debug: true,
interpolation: {
escapeValue: false,
},
missingInterpolationHandler: currencyInterpolator,
})
.catch((reason: any) => Logger.error(TAG, 'Failed init i18n', reason))
RNLocalize.addEventListener('change', () => {
i18n
.changeLanguage(getLanguage())
.catch((reason: any) => Logger.error(TAG, 'Failed to change i18n language', reason))
})
// Create HOC wrapper that hoists statics
// https://react.i18next.com/latest/withtranslation-hoc#hoist-non-react-statics
export const withTranslation = (namespace: Namespaces) => (component: React.ComponentType) =>
hoistStatics(withTranslationI18Next(namespace)(component), component)
export default i18n
const { languageTag, isRTL } =
RNLocalize.findBestAvailableLanguage(Object.keys(translationGetters)) ||
fallback
translate.cache.clear();
I18nManager.forceRTL(isRTL)
i18n.translations = { [languageTag]: translationGetters[languageTag]() }
i18n.locale = languageTag
moment.locale(languageTag)
}
setI18nConfig()
RNLocalize.addEventListener("change", () => setI18nConfig())
componentDidMount() {
RNLocalize.addEventListener("change", this.handleLocalizationChange);
}
.then(() => {
this.setState({ isTranslationLoaded: true });
RNLocalize.addEventListener("change", this.handleLocalizationChange);
})
.catch(error => {