mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
- AppRegistry - AppState - AsyncStorage - Dimensions - NativeMethods - NetInfo - PixelRatio - Platform - UIManager
568 B
568 B
Platform
Detect what is the platform in which the app is running. This piece of functionality can be useful when only small parts of a component are platform specific.
Properties
OS: string
Platform.OS will be web when running in a Web browser.
userAgent: string
On Web, the Platform module can be also be used to detect the browser
userAgent.
Examples
const styles = StyleSheet.create({
height: (Platform.OS === 'web') ? 200 : 100,
});
if (Platform.userAgent.includes('Android')) {
console.log('Running on Android!');
}