mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
Reduce size of API; remove helpers
This commit is contained in:
34
README.md
34
README.md
@@ -112,40 +112,6 @@ const buttonStyle = {
|
||||
}
|
||||
```
|
||||
|
||||
The styling strategy can be applied directly to non-SDK elements:
|
||||
|
||||
```js
|
||||
import { stylingStrategy } from 'react-web-sdk';
|
||||
|
||||
class Example extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div {...stylingStrategy({
|
||||
style: {
|
||||
opacity: 0.5
|
||||
}
|
||||
})} />
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Utilities
|
||||
|
||||
#### `getOtherProps(reactComponentInstance)`
|
||||
|
||||
Returns an object containing all the props from `this.props` that are not
|
||||
defined in `propTypes`.
|
||||
|
||||
#### `omitProps(obj, arrayOfExcludedProps)`
|
||||
|
||||
Returns an object with the specified props excluded.
|
||||
|
||||
#### `pickProps(obj, arrayOfIncludedProps)`
|
||||
|
||||
Returns an object with the specified props included.
|
||||
|
||||
## Development
|
||||
|
||||
```
|
||||
|
||||
@@ -1,17 +1,9 @@
|
||||
import React from 'react';
|
||||
import { Image, Text, TextInput, View, stylingStrategy } from '../dist/main';
|
||||
import React, { Image, Text, TextInput, View } from '../dist/react-native-web';
|
||||
|
||||
class Example extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<div {...stylingStrategy({
|
||||
style: {
|
||||
backgroundColor: '#000',
|
||||
height: '10px',
|
||||
opacity: '0.5'
|
||||
}
|
||||
})} />
|
||||
<View style={styles.grid}>
|
||||
{[1,2,3,4,5,6].map((item, i) => {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<!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>
|
||||
|
||||
@@ -1,20 +1,14 @@
|
||||
import React from 'react';
|
||||
|
||||
import { omitProps, pickProps } from './modules/filterObjectProps';
|
||||
// components
|
||||
import Image from './modules/Image';
|
||||
import Text from './modules/Text';
|
||||
import TextInput from './modules/TextInput';
|
||||
import View from './modules/View';
|
||||
import { restyle } from './modules/react-native-web-style';
|
||||
|
||||
export default React;
|
||||
|
||||
export {
|
||||
// helpers
|
||||
omitProps,
|
||||
pickProps,
|
||||
restyle,
|
||||
// components
|
||||
Image,
|
||||
Text,
|
||||
TextInput,
|
||||
|
||||
Reference in New Issue
Block a user