as

Settings
Sign out
Notifications
Alexa
亚马逊应用商店
Ring
AWS
文档
Support
Contact Us
My Cases
新手入门
设计和开发
应用发布
参考
支持
感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

expo-constants

@amazon-devices/expo-constants provides system information that remains constant throughout the lifetime of your app's install.

Installation

  1. Add the JavaScript library dependency in the package.json file. Select the tab for your React Native version.


    Copied to clipboard.

     dependencies: {
         ...
         "@amazon-devices/expo-constants": "~2.0.0",
         "expo": "~50.0.0",
         ...
     }
    

    Copied to clipboard.

     dependencies: {
         ...
         "@amazon-devices/expo-constants": "~3.0.0",
         "expo": "~50.0.0",
         ...
     }
    
  2. Reinstall dependencies using npm install command.

Examples

Copied to clipboard.

import React from 'react';
import Constants from '@amazon-devices/expo-constants';
import {StyleSheet, Text, View} from 'react-native';

export const App = () => {
  return (
    <View style={styles.container}>
      <Text style={styles.text}>
        isHeadless: {String(Constants.isHeadless)}
      </Text>
      <Text style={styles.text}>
        statusBarHeight: {Constants.statusBarHeight}
      </Text>
      <Text style={styles.text}>
        systemFonts: {Constants.systemFonts.join(', ')}
      </Text>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white',
    justifyContent: 'center',
    alignItems: 'center',
  },
  text: {
    fontSize: 30,
    color: 'black',
  },
});

API reference

Check out the dedicated documentation page for info about this library, API reference and more: Official Expo documentation for expo-constants.

Implementation details

Currently, all values are mocks. Don't depend on any of the constants inside this package.

Supported versions

NPM package version Vega SDK version Vega OS version React Native version
2.0.1758683737 0.23 and earlier OS 1.1 (1401010009820) and earlier 0.72
3.0.1+15.2.0 0.24 OS 1.2 (2101020054720) 0.72, 0.83

Additional resources

For information on additional libraries, see Supported Third-Party Libraries and Services.


Last updated: Aug 03, 2026