/** * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule SwipeableFlatListExample * @flow * @format */ 'use strict'; const React = require('react'); const createReactClass = require('create-react-class'); const ReactNative = require('react-native'); const { Image, SwipeableFlatList, TouchableHighlight, StyleSheet, Text, View, Alert, } = ReactNative; const RNTesterPage = require('./RNTesterPage'); const data = [ { key: 'like', icon: require('./Thumbnails/like.png'), data: 'Like!', }, { key: 'heart', icon: require('./Thumbnails/heart.png'), data: 'Heart!', }, { key: 'party', icon: require('./Thumbnails/party.png'), data: 'Party!', }, ]; const SwipeableFlatListExample = createReactClass({ displayName: 'SwipeableFlatListExample', statics: { title: '', description: 'Performant, scrollable, swipeable list of data.', }, render: function() { return ( '} noSpacer={true} noScroll={true}> ); }, _renderItem: function({item}): ?React.Element { return ( {item.data} ); }, _renderQuickActions: function({item}: Object): ?React.Element { return ( { Alert.alert( 'Tips', 'You could do something with this edit action!', ); }}> Edit { Alert.alert( 'Tips', 'You could do something with this remove action!', ); }}> Remove ); }, }); var styles = StyleSheet.create({ row: { flexDirection: 'row', justifyContent: 'center', alignItems: 'center', padding: 10, backgroundColor: '#F6F6F6', }, rowIcon: { width: 64, height: 64, marginRight: 20, }, rowData: { flex: 1, }, rowDataText: { fontSize: 24, }, actionsContainer: { flex: 1, flexDirection: 'row', justifyContent: 'flex-end', alignItems: 'center', }, actionButton: { padding: 10, width: 80, backgroundColor: '#999999', }, actionButtonDestructive: { backgroundColor: '#FF0000', }, actionButtonText: { textAlign: 'center', }, }); module.exports = SwipeableFlatListExample;