Skip to content

Commit

Permalink
Merge pull request facebook#1068 from spicyj/update-04-29
Browse files Browse the repository at this point in the history
Updates from Wed 29 Apr
  • Loading branch information
sophiebits committed Apr 30, 2015
2 parents f89bcac + d8ab648 commit b99744a
Show file tree
Hide file tree
Showing 127 changed files with 5,115 additions and 738 deletions.
3 changes: 3 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ Examples/UIExplorer/ImageMocks.js

[options]
module.system=haste

[version]
0.10.0
20 changes: 19 additions & 1 deletion Examples/UIExplorer/BorderExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ var styles = StyleSheet.create({
borderLeftWidth: 40,
borderLeftColor: 'blue',
},
border5: {
borderRadius: 50,
borderTopWidth: 10,
borderTopColor: 'red',
borderRightWidth: 20,
borderRightColor: 'yellow',
borderBottomWidth: 30,
borderBottomColor: 'green',
borderLeftWidth: 40,
borderLeftColor: 'blue',
},
});

exports.title = 'Border';
Expand All @@ -71,7 +82,7 @@ exports.examples = [
},
{
title: 'Equal-Width / Same-Color',
description: 'borderWidth & borderColor',
description: 'borderWidth & borderColor & borderRadius',
render() {
return <View style={[styles.box, styles.borderRadius]} />;
}
Expand All @@ -97,4 +108,11 @@ exports.examples = [
return <View style={[styles.box, styles.border4]} />;
}
},
{
title: 'Custom Borders',
description: 'border*Width & border*Color',
render() {
return <View style={[styles.box, styles.border5]} />;
}
},
];
3 changes: 2 additions & 1 deletion Examples/UIExplorer/GeolocationExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ var GeolocationExample = React.createClass({
componentDidMount: function() {
navigator.geolocation.getCurrentPosition(
(initialPosition) => this.setState({initialPosition}),
(error) => console.error(error)
(error) => console.error(error),
{enableHighAccuracy: true, timeout: 100, maximumAge: 1000}
);
this.watchID = navigator.geolocation.watchPosition((lastPosition) => {
this.setState({lastPosition});
Expand Down
169 changes: 169 additions & 0 deletions Examples/UIExplorer/SegmentedControlIOSExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/**
* The examples provided by Facebook are for non-commercial testing and
* evaluation purposes only.
*
* Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* @flow
*/
'use strict';

var React = require('react-native');
var {
SegmentedControlIOS,
Text,
View,
StyleSheet
} = React;

var BasicSegmentedControlExample = React.createClass({
render() {
return (
<View>
<View style={{marginBottom: 10}}>
<SegmentedControlIOS values={['One', 'Two']} />
</View>
<View>
<SegmentedControlIOS values={['One', 'Two', 'Three', 'Four', 'Five']} />
</View>
</View>
);
}
});

var PreSelectedSegmentedControlExample = React.createClass({
render() {
return (
<View>
<View>
<SegmentedControlIOS values={['One', 'Two']} selectedIndex={0} />
</View>
</View>
);
}
});

var MomentarySegmentedControlExample = React.createClass({
render() {
return (
<View>
<View>
<SegmentedControlIOS values={['One', 'Two']} momentary={true} />
</View>
</View>
);
}
});

var DisabledSegmentedControlExample = React.createClass({
render() {
return (
<View>
<View>
<SegmentedControlIOS enabled={false} values={['One', 'Two']} selectedIndex={1} />
</View>
</View>
);
},
});

var ColorSegmentedControlExample = React.createClass({
render() {
return (
<View>
<View style={{marginBottom: 10}}>
<SegmentedControlIOS tintColor="#ff0000" values={['One', 'Two', 'Three', 'Four']} selectedIndex={0} />
</View>
<View>
<SegmentedControlIOS tintColor="#00ff00" values={['One', 'Two', 'Three']} selectedIndex={1} />
</View>
</View>
);
},
});

var EventSegmentedControlExample = React.createClass({
getInitialState() {
return {
values: ['One', 'Two', 'Three'],
value: 'Not selected',
selectedIndex: undefined
};
},

render() {
return (
<View>
<Text style={styles.text} >
Value: {this.state.value}
</Text>
<Text style={styles.text} >
Index: {this.state.selectedIndex}
</Text>
<SegmentedControlIOS
values={this.state.values}
selectedIndex={this.state.selectedIndex}
onChange={this._onChange}
onValueChange={this._onValueChange} />
</View>
);
},

_onChange(event) {
this.setState({
selectedIndex: event.nativeEvent.selectedIndex,
});
},

_onValueChange(value) {
this.setState({
value: value,
});
}
});

var styles = StyleSheet.create({
text: {
fontSize: 14,
textAlign: 'center',
fontWeight: '500',
margin: 10,
},
});

exports.title = '<SegmentedControlIOS>';
exports.displayName = 'SegmentedControlExample';
exports.description = 'Native segmented control';
exports.examples = [
{
title: 'Segmented controls can have values',
render(): ReactElement { return <BasicSegmentedControlExample />; }
},
{
title: 'Segmented controls can have a pre-selected value',
render(): ReactElement { return <PreSelectedSegmentedControlExample />; }
},
{
title: 'Segmented controls can be momentary',
render(): ReactElement { return <MomentarySegmentedControlExample />; }
},
{
title: 'Segmented controls can be disabled',
render(): ReactElement { return <DisabledSegmentedControlExample />; }
},
{
title: 'Custom colors can be provided',
render(): ReactElement { return <ColorSegmentedControlExample />; }
},
{
title: 'Change events can be detected',
render(): ReactElement { return <EventSegmentedControlExample />; }
}
];
60 changes: 57 additions & 3 deletions Examples/UIExplorer/TextInputExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,32 @@ var styles = StyleSheet.create({
height: 26,
borderWidth: 0.5,
borderColor: '#0f0f0f',
padding: 4,
flex: 1,
fontSize: 13,
padding: 4,
},
multiline: {
borderWidth: 0.5,
borderColor: '#0f0f0f',
flex: 1,
fontSize: 13,
height: 50,
padding: 4,
marginBottom: 4,
},
multilineWithFontStyles: {
color: 'blue',
fontWeight: 'bold',
fontSize: 18,
fontFamily: 'Cochin',
height: 60,
},
multilineChild: {
width: 50,
height: 40,
position: 'absolute',
right: 5,
backgroundColor: 'red',
},
eventLabel: {
margin: 3,
Expand All @@ -118,7 +134,7 @@ var styles = StyleSheet.create({
});

exports.title = '<TextInput>';
exports.description = 'Single-line text inputs.';
exports.description = 'Single and multi-line text inputs.';
exports.examples = [
{
title: 'Auto-focus',
Expand Down Expand Up @@ -313,7 +329,7 @@ exports.examples = [
},
{
title: 'Clear and select',
render: function () {
render: function() {
return (
<View>
<WithLabel label="clearTextOnFocus">
Expand All @@ -336,4 +352,42 @@ exports.examples = [
);
}
},
{
title: 'Multiline',
render: function() {
return (
<View>
<TextInput
placeholder="multiline text input"
multiline={true}
style={styles.multiline}
/>
<TextInput
placeholder="mutliline text input with font styles and placeholder"
multiline={true}
clearTextOnFocus={true}
autoCorrect={true}
autoCapitalize="words"
placeholderTextColor="red"
keyboardType="url"
style={[styles.multiline, styles.multilineWithFontStyles]}
/>
<TextInput
placeholder="uneditable mutliline text input"
editable={false}
multiline={true}
style={styles.multiline}
/>
<TextInput
placeholder="multiline with children"
multiline={true}
enablesReturnKeyAutomatically={true}
returnKeyType="go"
style={styles.multiline}>
<View style={styles.multilineChild}/>
</TextInput>
</View>
)
}
}
];
4 changes: 4 additions & 0 deletions Examples/UIExplorer/UIExplorerBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var styles = StyleSheet.create({
},
titleContainer: {
borderWidth: 0.5,
borderRadius: 2.5,
borderColor: '#d6d7da',
backgroundColor: '#f6f7f8',
paddingHorizontal: 10,
Expand All @@ -78,8 +79,10 @@ var styles = StyleSheet.create({
titleRow: {
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: 'transparent',
},
titleText: {
backgroundColor: 'transparent',
fontSize: 14,
fontWeight: '500',
},
Expand All @@ -97,6 +100,7 @@ var styles = StyleSheet.create({
height: 8,
},
children: {
backgroundColor: 'transparent',
padding: 10,
}
});
Expand Down
1 change: 1 addition & 0 deletions Examples/UIExplorer/UIExplorerList.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ var COMPONENTS = [
require('./NavigatorIOSExample'),
require('./PickerIOSExample'),
require('./ScrollViewExample'),
require('./SegmentedControlIOSExample'),
require('./SliderIOSExample'),
require('./SwitchIOSExample'),
require('./TabBarIOSExample'),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Examples/UIExplorer/WebViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ var WebViewExample = React.createClass({
automaticallyAdjustContentInsets={false}
style={styles.webView}
url={this.state.url}
javaScriptEnabledAndroid={true}
onNavigationStateChange={this.onNavigationStateChange}
startInLoadingState={true}
/>
Expand Down
Loading

0 comments on commit b99744a

Please sign in to comment.