2015-02-20 04:10:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react-native/addons');
|
|
|
|
var {
|
|
|
|
PixelRatio,
|
|
|
|
ScrollView,
|
|
|
|
StyleSheet,
|
|
|
|
Text,
|
|
|
|
TouchableHighlight,
|
|
|
|
View,
|
|
|
|
invariant,
|
|
|
|
} = React;
|
|
|
|
|
|
|
|
var createExamplePage = require('./createExamplePage');
|
|
|
|
|
|
|
|
var EXAMPLES = [
|
|
|
|
require('./ViewExample'),
|
|
|
|
require('./LayoutExample'),
|
|
|
|
require('./TextExample.ios'),
|
|
|
|
require('./TextInputExample'),
|
|
|
|
require('./ExpandingTextExample'),
|
|
|
|
require('./ImageExample'),
|
|
|
|
require('./ListViewSimpleExample'),
|
|
|
|
require('./ListViewPagingExample'),
|
|
|
|
require('./NavigatorIOSExample'),
|
|
|
|
require('./StatusBarIOSExample'),
|
|
|
|
require('./PointerEventsExample'),
|
|
|
|
require('./TouchableExample'),
|
|
|
|
require('./ActivityIndicatorExample'),
|
|
|
|
require('./ScrollViewExample'),
|
2015-03-10 16:32:20 +00:00
|
|
|
require('./PickerExample'),
|
2015-03-07 01:13:18 +00:00
|
|
|
require('./DatePickerExample'),
|
2015-03-09 10:04:44 +00:00
|
|
|
require('./GeolocationExample'),
|
2015-03-06 00:36:41 +00:00
|
|
|
require('./TabBarExample'),
|
2015-03-09 20:19:07 +00:00
|
|
|
require('./SwitchExample'),
|
2015-03-09 21:42:55 +00:00
|
|
|
require('./SliderExample'),
|
2015-03-11 19:06:03 +00:00
|
|
|
require('./AsyncStorageExample'),
|
2015-03-10 00:08:01 +00:00
|
|
|
require('./CameraRollExample.ios'),
|
2015-03-10 01:05:10 +00:00
|
|
|
require('./MapViewExample'),
|
2015-03-14 08:22:25 +00:00
|
|
|
require('./WebViewExample'),
|
2015-03-12 03:48:43 +00:00
|
|
|
require('./AppStateIOSExample'),
|
2015-03-16 20:57:43 +00:00
|
|
|
require('./NetInfoExample'),
|
2015-03-14 00:48:31 +00:00
|
|
|
require('./AlertIOSExample'),
|
2015-03-10 19:09:35 +00:00
|
|
|
require('./AdSupportIOSExample'),
|
2015-03-11 20:53:30 +00:00
|
|
|
require('./AppStateExample'),
|
2015-03-13 17:45:27 +00:00
|
|
|
require('./ActionSheetIOSExample'),
|
2015-03-17 04:02:57 +00:00
|
|
|
require('./VibrationIOSExample'),
|
2015-02-20 04:10:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
var UIExplorerList = React.createClass({
|
|
|
|
render: function() {
|
|
|
|
return (
|
|
|
|
<ScrollView style={styles.list}>
|
|
|
|
<View style={styles.group}>
|
|
|
|
<View style={styles.line} />
|
|
|
|
{EXAMPLES.map(this._renderRow)}
|
|
|
|
<View style={styles.line} />
|
|
|
|
</View>
|
|
|
|
</ScrollView>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
_renderRow: function(example, i) {
|
|
|
|
invariant(example.title, 'Example must provide a title.');
|
|
|
|
return (
|
|
|
|
<View key={i}>
|
|
|
|
<TouchableHighlight onPress={() => this._onPressRow(example)}>
|
|
|
|
<View style={styles.row}>
|
|
|
|
<Text style={styles.rowTitleText}>
|
|
|
|
{example.title}
|
|
|
|
</Text>
|
|
|
|
<Text style={styles.rowDetailText}>
|
|
|
|
{example.description}
|
|
|
|
</Text>
|
|
|
|
</View>
|
|
|
|
</TouchableHighlight>
|
|
|
|
<View style={styles.separator} />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
_onPressRow: function(example) {
|
|
|
|
var Component = example.examples ?
|
|
|
|
createExamplePage(null, example) :
|
|
|
|
example;
|
|
|
|
this.props.navigator.push({
|
|
|
|
title: Component.title,
|
|
|
|
component: Component,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
list: {
|
|
|
|
backgroundColor: '#eeeeee',
|
|
|
|
},
|
|
|
|
group: {
|
|
|
|
backgroundColor: 'white',
|
|
|
|
marginVertical: 25,
|
|
|
|
},
|
|
|
|
line: {
|
|
|
|
backgroundColor: '#bbbbbb',
|
|
|
|
height: 1 / PixelRatio.get(),
|
|
|
|
},
|
|
|
|
row: {
|
|
|
|
backgroundColor: 'white',
|
|
|
|
justifyContent: 'center',
|
|
|
|
paddingHorizontal: 15,
|
|
|
|
paddingVertical: 8,
|
|
|
|
},
|
|
|
|
separator: {
|
|
|
|
height: 1 / PixelRatio.get(),
|
|
|
|
backgroundColor: '#bbbbbb',
|
|
|
|
marginLeft: 15,
|
|
|
|
},
|
|
|
|
rowTitleText: {
|
|
|
|
fontSize: 17,
|
|
|
|
fontWeight: 'bold',
|
|
|
|
},
|
|
|
|
rowDetailText: {
|
|
|
|
fontSize: 15,
|
|
|
|
color: '#888888',
|
|
|
|
lineHeight: 20,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = UIExplorerList;
|