2015-01-30 01:10:49 +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'),
|
2015-02-19 01:39:09 +00:00
|
|
|
require('./ListViewPagingExample'),
|
2015-01-30 01:10:49 +00:00
|
|
|
require('./NavigatorIOSExample'),
|
2015-02-06 23:46:31 +00:00
|
|
|
require('./StatusBarIOSExample'),
|
2015-01-30 01:10:49 +00:00
|
|
|
require('./PointerEventsExample'),
|
|
|
|
require('./TouchableExample'),
|
2015-02-19 01:51:14 +00:00
|
|
|
require('./ActivityIndicatorExample'),
|
2015-01-30 01:10:49 +00:00
|
|
|
require('./ScrollViewExample'),
|
2015-03-11 02:11:28 +00:00
|
|
|
require('./PickerExample'),
|
2015-03-09 23:18:15 +00:00
|
|
|
require('./DatePickerExample'),
|
2015-03-11 02:11:28 +00:00
|
|
|
require('./GeolocationExample'),
|
2015-03-06 17:54:10 +00:00
|
|
|
require('./TabBarExample'),
|
2015-03-09 23:18:15 +00:00
|
|
|
require('./SwitchExample'),
|
|
|
|
require('./SliderExample'),
|
2015-03-12 19:51:44 +00:00
|
|
|
require('./AsyncStorageExample'),
|
2015-03-11 02:11:28 +00:00
|
|
|
require('./CameraRollExample.ios'),
|
|
|
|
require('./MapViewExample'),
|
2015-03-12 19:51:44 +00:00
|
|
|
require('./AppStateIOSExample'),
|
2015-03-11 02:11:28 +00:00
|
|
|
require('./AdSupportIOSExample'),
|
2015-03-12 19:51:44 +00:00
|
|
|
require('./AppStateExample'),
|
2015-03-13 22:30:31 +00:00
|
|
|
require('./ActionSheetIOSExample'),
|
2015-01-30 01:10:49 +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>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2015-02-08 01:23:25 +00:00
|
|
|
_renderRow: function(example, i) {
|
2015-01-30 01:10:49 +00:00
|
|
|
invariant(example.title, 'Example must provide a title.');
|
|
|
|
return (
|
2015-02-08 01:23:25 +00:00
|
|
|
<View key={i}>
|
2015-01-30 01:10:49 +00:00
|
|
|
<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;
|