@amazon-devices/expo-constants提供系统信息,该信息在应用安装的整个生命周期内保持不变。
安装
- 在
package.json文件中添加JavaScript库依赖项。选择适用于您的React Native版本的选项卡。
- React Native 0.72
- React Native 0.83
- 使用
npm install命令重新安装依赖项。
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
expo-constants 开放Beta测试文档 作为预发布开放Beta测试的一项内容,亚马逊提供了此技术文档。…
@amazon-devices/expo-constants提供系统信息,该信息在应用安装的整个生命周期内保持不变。
package.json文件中添加JavaScript库依赖项。选择适用于您的React Native版本的选项卡。dependencies: {
...
"@amazon-devices/expo-constants": "~2.0.0",
"expo": "~50.0.0",
...
}
dependencies: {
...
"@amazon-devices/expo-constants": "~3.0.0",
"expo": "~50.0.0",
...
}
npm install命令重新安装依赖项。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',
},
});
| NPM程序包版本 | Vega SDK版本 | Vega OS版本 | React Native版本 |
|---|---|---|---|
| 2.0.1758683737 | 0.23及更早版本 | OS 1.1 (1401010009820)及更早版本 | 0.72 |
| 3.0.1+15.2.0 | 0.24 | OS 1.2 (2101020054720) | 0.72、0.83 |
此页面对您有帮助吗?
