Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
return (
render() {
if (!this.state.isTranslationLoaded) {
return ;
}
return (
function findBestAvailableCurrency(supportedCurrencyCodes: LocalCurrencyCode[]) {
const deviceCurrencies = RNLocalize.getCurrencies()
const supportedCurrenciesSet = new Set(supportedCurrencyCodes)
for (const deviceCurrency of deviceCurrencies) {
if (supportedCurrenciesSet.has(deviceCurrency as LocalCurrencyCode)) {
return deviceCurrency as LocalCurrencyCode
}
}
return null
}
export function findBestAvailableCurrency() {
const supportedCurrencyCodes = CURRENCIES.map(currency => currency.code)
const preferredCurrencyCodes = RNLocalize.getCurrencies().filter(code =>
supportedCurrencyCodes.includes(code)
)
const currencyCode = preferredCurrencyCodes.length
? preferredCurrencyCodes[0]
: 'USD'
return CURRENCIES.find(currency => currency.code === currencyCode)
}