Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-react-native-web

Package Overview
Dependencies
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-react-native-web

Babel plugin for React Native for Web

  • 0.13.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
760K
decreased by-17.81%
Maintainers
1
Weekly downloads
 
Created

What is babel-plugin-react-native-web?

babel-plugin-react-native-web is a Babel plugin that allows you to use React Native components and APIs in a web environment. It transforms React Native imports to their web equivalents provided by the react-native-web library, enabling code sharing between React Native and web projects.

What are babel-plugin-react-native-web's main functionalities?

Transform React Native imports

This feature allows you to transform React Native imports to their web equivalents. By adding 'react-native-web' to your Babel plugins, you can use React Native components in a web environment seamlessly.

module.exports = {
  plugins: [
    'react-native-web'
  ]
};

Support for React Native APIs

This feature allows you to use React Native APIs like AppRegistry in a web environment. The code sample demonstrates how to register and run a React Native application on the web using AppRegistry.

import { AppRegistry } from 'react-native';
import App from './App';

AppRegistry.registerComponent('MyApp', () => App);
AppRegistry.runApplication('MyApp', { initialProps: {}, rootTag: document.getElementById('app-root') });

StyleSheet transformation

This feature allows you to use React Native's StyleSheet for styling components in a web environment. The code sample demonstrates how to create and apply styles using StyleSheet in a React Native Web application.

import { StyleSheet, Text, View } from 'react-native';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  }
});

const App = () => (
  <View style={styles.container}>
    <Text style={styles.welcome}>Welcome to React Native Web!</Text>
  </View>
);

Other packages similar to babel-plugin-react-native-web

FAQs

Package last updated on 17 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc