Skip to content

Commit f8eca98

Browse files
committed
chore: addressing PR comments
1 parent d9f43a5 commit f8eca98

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

packages/sdk/react-native/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"tsw": "yarn tsc --watch",
3232
"start": "rimraf dist && yarn tsw",
3333
"lint": "eslint . --ext .ts,.tsx",
34+
"lint:fix": "eslint . --ext .ts,.tsx --fix",
3435
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore",
3536
"test": "jest",
3637
"coverage": "yarn test --coverage",
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import { NativeModules, Platform } from 'react-native';
2+
23
/**
3-
* Apps opted into Fabric (the new architecture of React Native)
4+
* Apps opted into Fabric (the new architecture of React Native)
45
* may not have access to the SettingsManager.settings.AppleLocale property.
56
* It is now common to use the `getConstants` method to access these constant properties with Fabric enabled apps.
67
*/
7-
const getAppleLocale = () => {
8-
const settings = NativeModules.SettingsManager?.settings ?? NativeModules.SettingsManager?.getConstants()?.settings;
9-
return settings?.AppleLocale;
10-
}
8+
const localeIdentifier = Platform.select({
9+
ios: () => {
10+
const settings =
11+
NativeModules.SettingsManager?.settings ??
12+
NativeModules.SettingsManager?.getConstants()?.settings;
13+
return settings?.AppleLocale;
14+
},
15+
default: () => NativeModules.I18nManager?.localeIdentifier,
16+
});
1117

12-
export default Platform.select({
13-
ios: getAppleLocale(),
14-
android: NativeModules.I18nManager?.localeIdentifier,
15-
})
18+
export default localeIdentifier();

0 commit comments

Comments
 (0)