wkh237 / react-native-web

React Native for Web

Home Page:https://necolas.github.io/react-native-web/storybook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Native for Web

Build Status npm version

"React Native for Web" brings React Native's building blocks and touch handling to the Web.

Browser support: Chrome, Firefox, Safari >= 7, IE 10, Edge.

Quick start

NOTE: React Native for Web supports React/ReactDOM 15.4, 15.5, or 15.6.

Install in your existing app using yarn or npm:

yarn add react@15.6 react-dom@15.6 react-native-web

Then read the Getting Started guide.

Documentation

The UI Explorer interactively documents all the supported APIs and Components.

Guides:

Starter kits

Example code

import React from 'react'
import { AppRegistry, Image, StyleSheet, Text, View } from 'react-native'

// Components
const Card = ({ children }) => <View style={styles.card}>{children}</View>
const Title = ({ children }) => <Text style={styles.title}>{children}</Text>
const Photo = ({ uri }) => <Image source={{ uri }} style={styles.image} />
const App = () => (
  <Card>
    <Title>App Card</Title>
    <Photo uri="/some-photo.jpg" />
  </Card>
)

// Styles
const styles = StyleSheet.create({
  card: {
    flexGrow: 1,
    justifyContent: 'center'
  },
  title: {
    fontSize: '1.25rem',
    fontWeight: 'bold'
  },
  image: {
    height: 40,
    marginVertical: 10,
    width: 40
  }
})

// App registration and rendering
AppRegistry.registerComponent('MyApp', () => App)
AppRegistry.runApplication('MyApp', { rootTag: document.getElementById('react-root') })

Related projects

License

React Native for Web is BSD licensed.

About

React Native for Web

https://necolas.github.io/react-native-web/storybook

License:Other


Languages

Language:JavaScript 99.8%Language:CSS 0.1%Language:HTML 0.0%