mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
Reorganize modules
This commit is contained in:
50
example/example.js
Normal file
50
example/example.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import { Image, Text, View } from '../dist/main';
|
||||
|
||||
class Example extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<View style={styles.grid}>
|
||||
{[1,2,3,4,5,6].map((item, i) => {
|
||||
return (
|
||||
<View key={i} style={{ ...styles.box, ...(item === 6 && styles.boxFull) }}>
|
||||
<Text style={{ fontSize: '2rem' }}>{item}</Text>
|
||||
</View>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
|
||||
<View style={{
|
||||
alignItems: 'center',
|
||||
borderWidth: '1px',
|
||||
justifyContent: 'center',
|
||||
marginTop: '10px',
|
||||
height: '200px'
|
||||
}}>
|
||||
<Text>This should be centered</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = {
|
||||
grid: {
|
||||
flexDirection: 'row',
|
||||
flexWrap: 'wrap'
|
||||
},
|
||||
box: {
|
||||
alignItems: 'center',
|
||||
backgroundColor: 'lightblue',
|
||||
flexGrow: 1,
|
||||
justifyContent: 'center',
|
||||
borderColor: 'blue',
|
||||
borderWidth: '5px'
|
||||
},
|
||||
boxFull: {
|
||||
width: '100%'
|
||||
}
|
||||
}
|
||||
|
||||
React.render(<Example />, document.getElementById('react-root'));
|
||||
6
example/index.html
Normal file
6
example/index.html
Normal file
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="../dist/react-web-sdk.css">
|
||||
<div id="react-root"></div>
|
||||
<script src="../dist/example.js"></script>
|
||||
19
example/webpack.config.js
Normal file
19
example/webpack.config.js
Normal file
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
entry: {
|
||||
example: './example.js'
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
test: /\.jsx?$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
query: { cacheDirectory: true }
|
||||
}
|
||||
]
|
||||
},
|
||||
output: {
|
||||
filename: 'example.js',
|
||||
path: '../dist'
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user