@rnw-community/platform
TypeScript icon, indicating that this package has built-in type declarations

0.80.0 • Public • Published

Platform - React native web community

Platform specific helpers and utils for react native web.

npm version npm downloads

Platform constants

Global constants for simple identifying of the platform:

  • isWeb
  • isIOS
  • isAndroid
  • isMobile - IOS or Android

Platform styling

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,
        }),
    },
});

getEnv

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');

License

This library is licensed under The MIT License.

Package Sidebar

Install

npm i @rnw-community/platform

Weekly Downloads

1,176

Version

0.80.0

License

MIT

Unpacked Size

23 kB

Total Files

51

Last publish

Collaborators

  • vitalyiegorov