react-native/Examples/UIExplorer/UIExplorerList.js
Christopher Chedeau cb9b1f7b29 Big Updates from Fri Mar 6
- [ReactNative] Oss RCTSlider | Tadeu Zagallo
- [ReactNative] Oss RCTSwitch | Tadeu Zagallo
- [ReactNative] Remove ImageSourcePropType | Christopher Chedeau
- [ReactNative] s/Image.sourcePropType/Image.propTypes.source/ | Christopher Chedeau
- [ReactNative] s/Text.stylePropType/Text.propTypes.style/ | Christopher Chedeau
- [ReactNative] s/View.stylePropType/View.propTypes.style/ | Christopher Chedeau
- [ReactNative] Remove nativePropTypes | Christopher Chedeau
- [ReactNative] Inline ScrollViewPropTypes | Christopher Chedeau
- [ReactNative] Unify ScrollView.android and ScrollView.ios | Christopher Chedeau
- [ReactNative] Move around and reformat comments for the documentation | Christopher Chedeau
- Improved Geolocation API | Nick Lockwood
- [React Native] Move copyProperties and mergeHelpers to github dir | Ben Alpert
- Fixed some misspellings that are propagating through our code | Skotch Vail
- [ReactNative] OSS DatePicker | Spencer Ahrens
- [React Native] Update core modules for React 0.13 | Ben Alpert
- [React Native] Update React to v0.13.0-rc2 | Ben Alpert
- [react-packager] onchange endpoint that informs of changes | Amjad Masad
- [react-packager] dev option needs to default to true for backwards compat | Amjad Masad
2015-03-09 16:18:15 -07:00

119 lines
2.7 KiB
JavaScript

/**
* 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'),
require('./DatePickerExample'),
require('./GeolocationExample'),
require('./TabBarExample'),
require('./SwitchExample'),
require('./SliderExample'),
];
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;