mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-04 19:05:49 +00:00
[fix] doc examples
This commit is contained in:
@@ -76,11 +76,11 @@ Used to locate a view in end-to-end tests.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
import placeholderAvatar from './placeholderAvatar.png'
|
import placeholderAvatar from './placeholderAvatar.png'
|
||||||
import React, { Image } from 'react-native-web'
|
import React, { Image, StyleSheet } from 'react-native-web'
|
||||||
|
|
||||||
const { Component, PropTypes } = React;
|
const { Component, PropTypes } = React;
|
||||||
|
|
||||||
class Avatar extends Component {
|
export default class Avatar extends Component {
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props, context)
|
super(props, context)
|
||||||
this.state = { loading: true }
|
this.state = { loading: true }
|
||||||
@@ -118,7 +118,7 @@ class Avatar extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = {
|
const styles = StyleSheet.create({
|
||||||
base: {
|
base: {
|
||||||
borderColor: 'white',
|
borderColor: 'white',
|
||||||
borderRadius: '5px',
|
borderRadius: '5px',
|
||||||
@@ -139,5 +139,5 @@ const styles = {
|
|||||||
height: '64px',
|
height: '64px',
|
||||||
width: '64px'
|
width: '64px'
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -159,11 +159,9 @@ user edits to the value set `editable={false}`.
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import React, { TextInput } from 'react-native-web'
|
import React, { StyleSheet, TextInput } from 'react-native-web'
|
||||||
|
|
||||||
const { Component } = React
|
export default class AppTextInput extends React.Component {
|
||||||
|
|
||||||
class AppTextInput extends Component {
|
|
||||||
constructor(props, context) {
|
constructor(props, context) {
|
||||||
super(props, context)
|
super(props, context)
|
||||||
this.state = { isFocused: false }
|
this.state = { isFocused: false }
|
||||||
@@ -182,16 +180,16 @@ class AppTextInput extends Component {
|
|||||||
numberOfLines={2}
|
numberOfLines={2}
|
||||||
onFocus={this._onFocus.bind(this)}
|
onFocus={this._onFocus.bind(this)}
|
||||||
placeholder={`What's happening?`}
|
placeholder={`What's happening?`}
|
||||||
style={
|
style={{
|
||||||
...styles.default
|
...styles.default
|
||||||
...(this.state.isFocused && styles.focused)
|
...(this.state.isFocused && styles.focused)
|
||||||
}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = {
|
const styles = StyleSheet.create({
|
||||||
default: {
|
default: {
|
||||||
borderColor: 'gray',
|
borderColor: 'gray',
|
||||||
borderWidth: '0 0 2px 0'
|
borderWidth: '0 0 2px 0'
|
||||||
@@ -199,5 +197,5 @@ const styles = {
|
|||||||
focused: {
|
focused: {
|
||||||
borderColor: 'blue'
|
borderColor: 'blue'
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user