React Web 中文 ![npm version](https://camo.githubusercontent.com/9f8d2d38e16f4d4f61ed7c0bed112ec8f88f4e1c8a8d0cfe025e2bcc50eac005/68747470733a2f2f62616467652e667572792e696f2f6a732f72656163742d7765622e737667)
A library for building web apps with React Native compatible API.
npm install --save react-web
Inside your webpack configuration, alias the react-native
package to the react-web
package:
// webpack.config.js
module.exports = {
resolve: {
alias: {
'react-native': 'react-web'
}
}
}
import React, {Component} from 'react';
import {AppRegistry, StyleSheet, Text, View, Platform} from 'react-native';
class App extends Component {
render() {
return (
<View style={styles.box}>
<Text style={styles.text}>Hello, world!</Text>
</View>
);
}
}
const styles = StyleSheet.create({
box: {padding: 10},
text: {fontWeight: 'bold'}
});
AppRegistry.registerComponent('App', () => App);
if (Platform.OS === 'web') {
AppRegistry.runApplication('App', { rootTag: document.getElementById('app') });
}
- ActivityIndicator
- ART
- Button
- CheckBox
- FlatList
- Image
- ImageBackground
- KeyboardAvoidingView
- ListView
- Modal
- Picker
- ProgressBar
- RefreshControl
- SafeAreaView
- ScrollView
- SectionList
- Slider
- StatusBar
- Switch
- Text
- TextInput
- Touchable
- TouchableHighlight
- TouchableNativeFeedback
- TouchableOpacity
- TouchableWithoutFeedback
- View
- VirtualizedList
- WebView
- findNodeHandle
- AccessibilityInfo
- Alert
- Animated
- AppRegistry
- AppState
- AsyncStorage
- BackHandler
- Clipboard
- Dimensions
- Easing
- Geolocation
- I18nManager
- InteractionManager
- Keyboard
- LayoutAnimation
- Linking
- NetInfo
- PanResponder
- PixelRatio
- Platform
- Settings
- StyleSheet
- UIManager
- Vibration
- processColor
- NativeModules
- ColorPropType
- EdgeInsetsPropType
- PointPropType
- ViewPropTypes
React Web is BSD licensed.