File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
packages/sdk/react-native Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 11import { 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 ( ) ;
You can’t perform that action at this time.
0 commit comments