mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-04-28 20:34:52 +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
|
## Development
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
import React from 'react';
|
import React, { Image, Text, TextInput, View } from '../dist/react-native-web';
|
||||||
import { Image, Text, TextInput, View, stylingStrategy } from '../dist/main';
|
|
||||||
|
|
||||||
class Example extends React.Component {
|
class Example extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View>
|
<View>
|
||||||
<div {...stylingStrategy({
|
|
||||||
style: {
|
|
||||||
backgroundColor: '#000',
|
|
||||||
height: '10px',
|
|
||||||
opacity: '0.5'
|
|
||||||
}
|
|
||||||
})} />
|
|
||||||
<View style={styles.grid}>
|
<View style={styles.grid}>
|
||||||
{[1,2,3,4,5,6].map((item, i) => {
|
{[1,2,3,4,5,6].map((item, i) => {
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<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>
|
<div id="react-root"></div>
|
||||||
<script src="../dist/example.js"></script>
|
<script src="../dist/example.js"></script>
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { omitProps, pickProps } from './modules/filterObjectProps';
|
// components
|
||||||
import Image from './modules/Image';
|
import Image from './modules/Image';
|
||||||
import Text from './modules/Text';
|
import Text from './modules/Text';
|
||||||
import TextInput from './modules/TextInput';
|
import TextInput from './modules/TextInput';
|
||||||
import View from './modules/View';
|
import View from './modules/View';
|
||||||
import { restyle } from './modules/react-native-web-style';
|
|
||||||
|
|
||||||
export default React;
|
export default React;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
// helpers
|
|
||||||
omitProps,
|
|
||||||
pickProps,
|
|
||||||
restyle,
|
|
||||||
// components
|
|
||||||
Image,
|
Image,
|
||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
|
|||||||
Reference in New Issue
Block a user