Chuyển tới nội dung chính

SDK 1.0.0

Device, locale, theme

const locale = await sdk.getLocale() // 'vi' | 'en' | 'es' | 'pt' | 'fr' | 'it' …
const theme = await sdk.getTheme() // 'light' | 'dark'
const device = await sdk.getDeviceInfo() // { platform: 'ios' | 'android', appVersion: '3.3.0' }
const insets = await sdk.getSafeArea() // { top, bottom, left, right } in px
const cached = sdk.safeArea // sync copy from the last nativeReady; zeros before it
  • Theme changes arrive as the themeChange event (useTheme() follows it for you).
  • The app sends no locale-change event. Read the locale at start-up.
  • getSDKVersion() returns the bridge version, a constant '2.0.0' on every app version. Do not use it to check for features.