From bf5046415c4390ac0a987a22af18ab4701f87ae7 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 19 Oct 2015 09:42:30 -0700 Subject: [PATCH] [fix] doc examples --- docs/components/Image.md | 8 ++++---- docs/components/TextInput.md | 14 ++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/docs/components/Image.md b/docs/components/Image.md index f8089a1d..ab30d7c0 100644 --- a/docs/components/Image.md +++ b/docs/components/Image.md @@ -76,11 +76,11 @@ Used to locate a view in end-to-end tests. ```js import placeholderAvatar from './placeholderAvatar.png' -import React, { Image } from 'react-native-web' +import React, { Image, StyleSheet } from 'react-native-web' const { Component, PropTypes } = React; -class Avatar extends Component { +export default class Avatar extends Component { constructor(props, context) { super(props, context) this.state = { loading: true } @@ -118,7 +118,7 @@ class Avatar extends Component { } } -const styles = { +const styles = StyleSheet.create({ base: { borderColor: 'white', borderRadius: '5px', @@ -139,5 +139,5 @@ const styles = { height: '64px', width: '64px' } -} +}) ``` diff --git a/docs/components/TextInput.md b/docs/components/TextInput.md index 50da55ea..ce10e008 100644 --- a/docs/components/TextInput.md +++ b/docs/components/TextInput.md @@ -159,11 +159,9 @@ user edits to the value set `editable={false}`. ## Examples ```js -import React, { TextInput } from 'react-native-web' +import React, { StyleSheet, TextInput } from 'react-native-web' -const { Component } = React - -class AppTextInput extends Component { +export default class AppTextInput extends React.Component { constructor(props, context) { super(props, context) this.state = { isFocused: false } @@ -182,16 +180,16 @@ class AppTextInput extends Component { numberOfLines={2} onFocus={this._onFocus.bind(this)} placeholder={`What's happening?`} - style={ + style={{ ...styles.default ...(this.state.isFocused && styles.focused) - } + }} /> ); } } -const styles = { +const styles = StyleSheet.create({ default: { borderColor: 'gray', borderWidth: '0 0 2px 0' @@ -199,5 +197,5 @@ const styles = { focused: { borderColor: 'blue' } -} +}) ```