From 525f61b43892ceda93e60bcb7dcac5227ac25159 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Wed, 13 May 2015 21:51:36 +0000 Subject: [PATCH] update website --- docs/alertios.html | 98 ++++++++++++++++++++++++++++++++++++++++++-- docs/mapview.html | 2 +- docs/navigator.html | 2 +- docs/pixelratio.html | 2 +- docs/scrollview.html | 2 +- docs/text.html | 22 +++++++++- docs/view.html | 2 +- 7 files changed, 121 insertions(+), 9 deletions(-) diff --git a/docs/alertios.html b/docs/alertios.html index b63a9cf0dc5..4d59891b09a 100644 --- a/docs/alertios.html +++ b/docs/alertios.html @@ -10,8 +10,11 @@ it will appear bold.

AlertIOS] )

Methods #

static alert(title: string, message?: string, buttons?: Array<{ text: ?string; - onPress: ?Function; - }>) #

Edit on GitHubExamples #

'use strict'; + onPress?: ?Function; + }>, type?: string) #

static prompt(title: string, value?: string, buttons?: Array<{ + text: ?string; + onPress?: ?Function; + }>, callback?: Function) #

Edit on GitHubExamples #

'use strict'; var React = require('react-native'); var { @@ -93,9 +96,98 @@ exports.examples /TouchableHighlight> </View> ); - }, + } +}, +{ + title: 'Prompt', + render(): React.Component { + return <PromptExample /> + } }]; +class PromptExample extends React.Component { + constructor(props) { + super(props); + + this.promptResponse = this.promptResponse.bind(this); + this.state = { + promptValue: undefined, + }; + + this.title = 'Type a value'; + this.defaultValue = 'Default value'; + this.buttons = [{ + text: 'Custom cancel', + }, { + text: 'Custom OK', + onPress: this.promptResponse + }]; + } + + render() { + return ( + <View> + <Text style={{marginBottom: 10}}> + <Text style={{fontWeight: 'bold'}}>Prompt value:</Text> {this.state.promptValue} + </Text> + + <TouchableHighlight + style={styles.wrapper} + onPress={this.prompt.bind(this, this.title, this.promptResponse)}> + + <View style={styles.button}> + <Text> + prompt with title & callback + </Text> + </View> + </TouchableHighlight> + + <TouchableHighlight + style={styles.wrapper} + onPress={this.prompt.bind(this, this.title, this.buttons)}> + + <View style={styles.button}> + <Text> + prompt with title & custom buttons + </Text> + </View> + </TouchableHighlight> + + <TouchableHighlight + style={styles.wrapper} + onPress={this.prompt.bind(this, this.title, this.defaultValue, this.promptResponse)}> + + <View style={styles.button}> + <Text> + prompt with title, default value & callback + </Text> + </View> + </TouchableHighlight> + + <TouchableHighlight + style={styles.wrapper} + onPress={this.prompt.bind(this, this.title, this.defaultValue, this.buttons)}> + + <View style={styles.button}> + <Text> + prompt with title, default value & custom buttons + </Text> + </View> + </TouchableHighlight> + </View> + ); + } + + prompt() { + // Flow's apply support is broken: #7035621 + ((AlertIOS.prompt: any).apply: any)(AlertIOS, arguments); + } + + promptResponse(promptValue) { + this.setState({ promptValue }); + } +} + var styles = StyleSheet.create({ wrapper: { borderRadius: 5, diff --git a/docs/mapview.html b/docs/mapview.html index a6baac74b5a..d2216c28ae6 100644 --- a/docs/mapview.html +++ b/docs/mapview.html @@ -169,7 +169,7 @@ Default value is true.

/> <MapRegionInput onChange={this._onRegionInputChanged} - region={this.state.mapRegionInput} + region={this.state.mapRegionInput || undefined} /> </View> ); diff --git a/docs/navigator.html b/docs/navigator.html index 18e1e97d6ba..a560cb68229 100644 --- a/docs/navigator.html +++ b/docs/navigator.html @@ -48,7 +48,7 @@ a route in the initialRouteStack if both props are provided. The is provided. Otherwise, it will default to an array containing only the initialRoute

navigationBar node #

Optionally provide a navigation bar that persists across scene transitions

navigator object #

Optionally provide the navigator object from a parent Navigator

onDidFocus function #

Will be called with the new route of each scene after the transition is -complete or after the initial mounting

onItemRef function #

Will be called with (ref, indexInStack) when the scene ref changes

onWillFocus function #

Will emit the target route upon mounting and before each nav transition

renderScene function #

Required function which renders the scene for a given route. Will be +complete or after the initial mounting

onItemRef function #

Will be called with (ref, indexInStack, route) when the scene ref changes

onWillFocus function #

Will emit the target route upon mounting and before each nav transition

renderScene function #

Required function which renders the scene for a given route. Will be invoked with the route and the navigator object

(route, navigator) => <MySceneComponent title={route.title} />

sceneStyle View#style #

Styles to apply to the container of each scene

Next →