How to use the react-native-localize.getCountry function in react-native-localize

To help you get started, we’ve selected a few react-native-localize examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alexakasanjeev / magento_react_native / src / screens / EditAccountAddressScreen / EditAccountAddressScreen.js View on Github external
useEffect(() => {
    if (countries && countries.length > 0) {
      if (customer.addresses.length === 0) {
        // Get country by locale
        const userCountryByLocale = RNLocalize.getCountry();
        const isUserCountrySupported = countries.find(country => country.id === userCountryByLocale);
        if (isUserCountrySupported) {
          setValues({
            ...form,
            firstName: customer.firstname,
            lastName: customer.lastname,
            country: isUserCountrySupported.id,
            state: '',
          });
        }
      }
    }
  }, [countries]);
github buttercup / buttercup-mobile / source / shared / i18n / index.js View on Github external
detect: () =>
        RNLocalize.getLocales().find(locale => locale.countryCode === RNLocalize.getCountry())
            .languageCode || localesConfig.fallbackLng,
    cacheUserLanguage: Function.prototype