diff --git a/docs/geolocation.html b/docs/geolocation.html index 1471ea99517..7f8de08e71e 100644 --- a/docs/geolocation.html +++ b/docs/geolocation.html @@ -41,11 +41,15 @@ exports.examples : function() { navigator.geolocation.getCurrentPosition( - (initialPosition) => this.setState({initialPosition}), + (position) => { + var initialPosition = JSON.stringify(position); + this.setState({initialPosition}); + }, (error) => alert(error.message), {enableHighAccuracy: true, timeout: 20000, maximumAge: 1000} ); - this.watchID = navigator.geolocation.watchPosition((lastPosition) => { + this.watchID = navigator.geolocation.watchPosition((position) => { + var lastPosition = JSON.stringify(position); this.setState({lastPosition}); }); }, @@ -59,11 +63,11 @@ exports.examples > <Text> <Text style={styles.title}>Initial position: </Text> - {JSON.stringify(this.state.initialPosition)} + {this.state.initialPosition} </Text> <Text> <Text style={styles.title}>Current position: </Text> - {JSON.stringify(this.state.lastPosition)} + {this.state.lastPosition} </Text> </View> ); diff --git a/docs/image.html b/docs/image.html index f1da2e2a1a9..86dcc0da4e0 100644 --- a/docs/image.html +++ b/docs/image.html @@ -43,6 +43,7 @@ network.

: function() { return { events: [], + mountTime: new Date(), }; }, diff --git a/docs/mapview.html b/docs/mapview.html index 72b017b3472..f82e50bf953 100644 --- a/docs/mapview.html +++ b/docs/mapview.html @@ -34,6 +34,17 @@ Default value is true.

: '0', }; +type MapRegion = { + latitude: number, + longitude: number, + latitudeDelta: number, + longitudeDelta: number, +}; + +type MapRegionInputState = { + region: MapRegion, +}; + var MapRegionInput = React.createClass({ propTypes: { @@ -46,7 +57,7 @@ Default value is true.

: React.PropTypes.func.isRequired, }, - getInitialState: function() { + getInitialState(): MapRegionInputState { return { region: { latitude: 0, @@ -138,19 +149,42 @@ Default value is true.

: function() { this.setState({ - latitude: parseFloat(regionText.latitude), - longitude: parseFloat(regionText.longitude), - latitudeDelta: parseFloat(regionText.latitudeDelta), - longitudeDelta: parseFloat(regionText.longitudeDelta), + region: { + latitude: parseFloat(regionText.latitude), + longitude: parseFloat(regionText.longitude), + latitudeDelta: parseFloat(regionText.latitudeDelta), + longitudeDelta: parseFloat(regionText.longitudeDelta), + }, }); this.props.onChange(this.state.region); }, }); +type Annotations = Array<{ + animateDrop?: boolean, + latitude: number, + longitude: number, + title?: string, + subtitle?: string, + hasLeftCallout?: boolean, + hasRightCallout?: boolean, + onLeftCalloutPress?: Function, + onRightCalloutPress?: Function, + tintColor?: string, + image?: any, + id?: string, +}>; +type MapViewExampleState = { + isFirstLoad: boolean, + mapRegion?: MapRegion, + mapRegionInput?: MapRegion, + annotations?: Annotations, +}; + var MapViewExample = React.createClass({ - getInitialState() { + getInitialState(): MapViewExampleState { return { isFirstLoad: true, }; @@ -174,7 +208,7 @@ Default value is true.

); }, - _getAnnotations(region) { + _getAnnotations(region): Annotations { return [{ longitude: region.longitude, latitude: region.latitude, @@ -208,9 +242,14 @@ Default value is true.

}); +type CalloutMapViewExampleState = { + isFirstLoad: boolean, + annotations?: Annotations, + mapRegion?: MapRegion, +}; var CalloutMapViewExample = React.createClass({ - getInitialState() { + getInitialState(): CalloutMapViewExampleState { return { isFirstLoad: true, }; @@ -246,9 +285,14 @@ Default value is true.

}); +type CustomPinColorMapViewExampleState = { + isFirstLoad: boolean, + annotations?: Annotations, + mapRegion?: MapRegion, +}; var CustomPinColorMapViewExample = React.createClass({ - getInitialState() { + getInitialState(): CustomPinColorMapViewExampleState { return { isFirstLoad: true, }; @@ -281,9 +325,14 @@ Default value is true.

}); +type CustomPinImageMapViewExampleState = { + isFirstLoad: boolean, + annotations?: Annotations, + mapRegion?: MapRegion, +}; var CustomPinImageMapViewExample = React.createClass({ - getInitialState() { + getInitialState(): CustomPinImageMapViewExampleState { return { isFirstLoad: true, }; @@ -316,9 +365,25 @@ Default value is true.

}); +type Overlays = Array<{ + coordinates?: Array<{ + latitude: number, + longitude: number, + }>, + lineWidth?: number, + strokeColor?: string, + fillColor?: string, + id?: string, +}>; +type CustomOverlayMapViewExampleState = { + isFirstLoad: boolean, + overlays?: Overlays, + annotations?: Annotations, + mapRegion?: MapRegion, +}; var CustomOverlayMapViewExample = React.createClass({ - getInitialState() { + getInitialState(): CustomOverlayMapViewExampleState { return { isFirstLoad: true, }; diff --git a/docs/panresponder.html b/docs/panresponder.html index 7ad8297ab73..d4e13c9164f 100644 --- a/docs/panresponder.html +++ b/docs/panresponder.html @@ -123,7 +123,8 @@ are the responder.

}, _highlight: function() { - this.circle && this.circle.setNativeProps({ + const circle = this.circle; + circle && circle.setNativeProps({ style: { backgroundColor: processColor(CIRCLE_HIGHLIGHT_COLOR) } @@ -131,7 +132,8 @@ are the responder.

}, _unHighlight: function() { - this.circle && this.circle.setNativeProps({ + const circle = this.circle; + circle && circle.setNativeProps({ style: { backgroundColor: processColor(CIRCLE_COLOR) } diff --git a/docs/pickerios.html b/docs/pickerios.html index c02629155a6..1945b6e94b9 100644 --- a/docs/pickerios.html +++ b/docs/pickerios.html @@ -84,7 +84,7 @@ {CAR_MAKES_AND_MODELS[this.state.carMake].models.map( (modelName, modelIndex) => ( <PickerItemIOS - key={this.state.carmake + '_' + modelIndex} + key={this.state.carMake + '_' + modelIndex} value={modelIndex} label={modelName} />