|
| 1 | +import _ from 'lodash'; |
| 2 | +import React, {Component} from 'react'; |
| 3 | +import {ScrollView} from 'react-native'; |
| 4 | +import {/* Colors, Typography, */View, Text, Button, StackAggregator} from 'react-native-ui-lib'; //eslint-disable-line |
| 5 | + |
| 6 | + |
| 7 | +const contents = [ |
| 8 | + 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', |
| 9 | + 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.', |
| 10 | + 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.', |
| 11 | + 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum is simply dummy text of the printing and typesetting industry.' |
| 12 | +] |
| 13 | + |
| 14 | +export default class StackAggregatorScreen extends Component { |
| 15 | + |
| 16 | + onItemPress = (index) => { |
| 17 | + console.warn('item pressed: ', index); |
| 18 | + } |
| 19 | + |
| 20 | + onPress = (index) => { |
| 21 | + console.warn('item\'s button pressed: ', index); |
| 22 | + } |
| 23 | + |
| 24 | + renderItem = (item, index) => { |
| 25 | + return ( |
| 26 | + <View key={index} center padding-12> |
| 27 | + <Button label={`${index}`} marginB-10 size={'small'} onPress={() => this.onPress(index)}/> |
| 28 | + <Text>{contents[index]}</Text> |
| 29 | + </View> |
| 30 | + ); |
| 31 | + } |
| 32 | + |
| 33 | + render() { |
| 34 | + return ( |
| 35 | + <ScrollView bg-dark80 keyboardShouldPersistTaps={'handled'} showsVerticalScrollIndicator={false}> |
| 36 | + <Text center dark40 text90 marginT-20>Thu, 10 Dec, 11:29</Text> |
| 37 | + <StackAggregator |
| 38 | + containerStyle={{marginTop: 12}} |
| 39 | + onItemPress={this.onItemPress} |
| 40 | + > |
| 41 | + {_.map(contents, (item, index) => { |
| 42 | + return this.renderItem(item, index); |
| 43 | + })} |
| 44 | + </StackAggregator> |
| 45 | + |
| 46 | + <Text center dark40 text90 marginT-20>Thu, 11 Dec, 13:03</Text> |
| 47 | + <StackAggregator |
| 48 | + containerStyle={{marginTop: 12}} |
| 49 | + onItemPress={this.onItemPress} |
| 50 | + collapsed={false} |
| 51 | + // contentContainerStyle={{backgroundColor: Colors.red30}} |
| 52 | + // itemBorderRadius={10} |
| 53 | + // buttonProps={{color: Colors.green30, labelStyle: {...Typography.text80, fontWeight: '500'}}} |
| 54 | + > |
| 55 | + {_.map(contents, (item, index) => { |
| 56 | + return this.renderItem(item, index); |
| 57 | + })} |
| 58 | + </StackAggregator> |
| 59 | + </ScrollView> |
| 60 | + ); |
| 61 | + } |
| 62 | +} |
0 commit comments