What's the best way to get device locale in react native (iOS)?

后端 未结 14 1678
清歌不尽
清歌不尽 2020-12-13 03:35

Something similar to [NSLocale currentLocale] in Objective-C.

14条回答
  •  长情又很酷
    2020-12-13 04:19

    if you develop over Expo... you can use:

    console.log(await NativeModules.ExponentUtil.getCurrentLocaleAsync());
    console.log(await NativeModules.ExponentUtil.getCurrentDeviceCountryAsync());
    console.log(await NativeModules.ExponentUtil.getCurrentTimeZoneAsync());

提交回复
热议问题