2015-07-23 13:43:35 +00:00
|
|
|
/**
|
|
|
|
* 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 {
|
|
|
|
AppRegistry,
|
|
|
|
Settings,
|
2015-10-13 18:02:35 +00:00
|
|
|
SnapshotViewIOS,
|
2015-07-23 13:43:35 +00:00
|
|
|
StyleSheet,
|
|
|
|
} = React;
|
|
|
|
|
|
|
|
import type { NavigationContext } from 'NavigationContext';
|
|
|
|
|
|
|
|
var UIExplorerListBase = require('./UIExplorerListBase');
|
|
|
|
|
|
|
|
var COMPONENTS = [
|
|
|
|
require('./ActivityIndicatorIOSExample'),
|
|
|
|
require('./DatePickerIOSExample'),
|
|
|
|
require('./ImageExample'),
|
|
|
|
require('./LayoutEventsExample'),
|
|
|
|
require('./ListViewExample'),
|
|
|
|
require('./ListViewGridLayoutExample'),
|
|
|
|
require('./ListViewPagingExample'),
|
|
|
|
require('./MapViewExample'),
|
2015-07-28 14:31:26 +00:00
|
|
|
require('./ModalExample'),
|
2015-07-23 13:43:35 +00:00
|
|
|
require('./Navigator/NavigatorExample'),
|
|
|
|
require('./NavigatorIOSColorsExample'),
|
|
|
|
require('./NavigatorIOSExample'),
|
|
|
|
require('./PickerIOSExample'),
|
|
|
|
require('./ProgressViewIOSExample'),
|
|
|
|
require('./ScrollViewExample'),
|
|
|
|
require('./SegmentedControlIOSExample'),
|
|
|
|
require('./SliderIOSExample'),
|
|
|
|
require('./SwitchIOSExample'),
|
|
|
|
require('./TabBarIOSExample'),
|
|
|
|
require('./TextExample.ios'),
|
2015-08-22 21:22:43 +00:00
|
|
|
require('./TextInputExample.ios'),
|
2015-07-23 13:43:35 +00:00
|
|
|
require('./TouchableExample'),
|
2015-10-30 11:11:04 +00:00
|
|
|
require('./TransparentHitTestExample'),
|
2015-07-23 13:43:35 +00:00
|
|
|
require('./ViewExample'),
|
|
|
|
require('./WebViewExample'),
|
|
|
|
];
|
|
|
|
|
|
|
|
var APIS = [
|
|
|
|
require('./AccessibilityIOSExample'),
|
|
|
|
require('./ActionSheetIOSExample'),
|
|
|
|
require('./AdSupportIOSExample'),
|
|
|
|
require('./AlertIOSExample'),
|
2015-09-03 20:00:09 +00:00
|
|
|
require('./AnimatedExample'),
|
|
|
|
require('./AnimatedGratuitousApp/AnExApp'),
|
2015-07-23 13:43:35 +00:00
|
|
|
require('./AppStateIOSExample'),
|
|
|
|
require('./AsyncStorageExample'),
|
|
|
|
require('./BorderExample'),
|
|
|
|
require('./CameraRollExample.ios'),
|
|
|
|
require('./GeolocationExample'),
|
|
|
|
require('./LayoutExample'),
|
|
|
|
require('./NetInfoExample'),
|
|
|
|
require('./PanResponderExample'),
|
|
|
|
require('./PointerEventsExample'),
|
|
|
|
require('./PushNotificationIOSExample'),
|
|
|
|
require('./StatusBarIOSExample'),
|
|
|
|
require('./TimerExample'),
|
|
|
|
require('./VibrationIOSExample'),
|
2015-08-19 20:25:00 +00:00
|
|
|
require('./XHRExample.ios'),
|
2015-07-29 22:52:28 +00:00
|
|
|
require('./ImageEditingExample'),
|
2015-07-23 13:43:35 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
// Register suitable examples for snapshot tests
|
|
|
|
COMPONENTS.concat(APIS).forEach((Example) => {
|
|
|
|
if (Example.displayName) {
|
|
|
|
var Snapshotter = React.createClass({
|
|
|
|
render: function() {
|
|
|
|
var Renderable = UIExplorerListBase.makeRenderable(Example);
|
2015-10-02 19:13:48 +00:00
|
|
|
return (
|
2015-10-13 18:02:35 +00:00
|
|
|
<SnapshotViewIOS>
|
2015-10-02 19:13:48 +00:00
|
|
|
<Renderable />
|
2015-10-13 18:02:35 +00:00
|
|
|
</SnapshotViewIOS>
|
2015-10-02 19:13:48 +00:00
|
|
|
);
|
2015-07-23 13:43:35 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
AppRegistry.registerComponent(Example.displayName, () => Snapshotter);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
navigator: {
|
|
|
|
navigationContext: NavigationContext,
|
|
|
|
push: (route: {title: string, component: ReactClass<any,any,any>}) => void,
|
|
|
|
},
|
|
|
|
onExternalExampleRequested: Function,
|
|
|
|
};
|
|
|
|
|
|
|
|
class UIExplorerList extends React.Component {
|
|
|
|
props: Props;
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<UIExplorerListBase
|
|
|
|
components={COMPONENTS}
|
|
|
|
apis={APIS}
|
|
|
|
searchText={Settings.get('searchText')}
|
|
|
|
renderAdditionalView={this.renderAdditionalView.bind(this)}
|
|
|
|
search={this.search.bind(this)}
|
|
|
|
onPressRow={this.onPressRow.bind(this)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderAdditionalView(renderRow: Function, renderTextInput: Function): React.Component {
|
|
|
|
return renderTextInput(styles.searchTextInput);
|
|
|
|
}
|
|
|
|
|
|
|
|
search(text: mixed) {
|
|
|
|
Settings.set({searchText: text});
|
|
|
|
}
|
|
|
|
|
|
|
|
_openExample(example: any) {
|
|
|
|
if (example.external) {
|
|
|
|
this.props.onExternalExampleRequested(example);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var Component = UIExplorerListBase.makeRenderable(example);
|
|
|
|
this.props.navigator.push({
|
|
|
|
title: Component.title,
|
|
|
|
component: Component,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onPressRow(example: any) {
|
|
|
|
this._openExample(example);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
searchTextInput: {
|
|
|
|
height: 30,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = UIExplorerList;
|