Platform specific helpers and utils for react native web.
Global constants for simple identifying of the platform:
isWeb
isIOS
isAndroid
-
isMobile
- IOS or Android
Simple platform-specific styling helpers:
webStyles(style)
androidStyles(style)
iosStyles(style)
iosStyles(style)
mobileStyles(style)
Example usage:
import { StyleSheet } from 'react-native';
import { webStyles, androidStyles } from '@rnw-community/platform';
export const Styles = StyleSheet.create({
root: {
width: 200,
...webStyles({
width: 400,
}),
...androidStyles({
paddingBottom: 5,
}),
},
});
Generic getter of environment variable value supporting web
and native
platforms. Works using react-native-config
on native
platform, uses node process
on web
platform.
Example usage:
import { getEnv } from '@rnw-community/platform';
const myEnvVar = getEnv('ENV_NAME');
This library is licensed under The MIT License.