You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

78 lines
1.9 KiB

import React, {Component} from 'react';
import {
StyleSheet,
TouchableOpacity,
View
} from 'react-native';
import {Directory} from '../../public/plugin/api';
const DirectoryFlatList = Directory.DirectoryFlatList;
class SubList extends Component {
constructor(props) {
super(props);
this._renderItem = this._renderItem.bind(this);
}
render() {
return <DirectoryFlatList
data={this.getData()}
keyExtractor={(item) => item.id}
renderItem={this._renderItem}
style={styles.list}
/>
}
getData() {
return this.props.currentNode.getChildNodes();
}
_renderItem({item}) {
return (
<View style={styles.itemWrapper}>
<TouchableOpacity
style={styles.item}
onPress={() => {
this.props.navigateNode(item);
}}
>
{
Directory.createIconCell(item,
{
containerStyle: {},
textStyle: styles.text,
iconStyle: styles.cellIcon,
hideTopBorder: true,
hideBottomBorder: true
}
)
}
</TouchableOpacity>
</View>)
}
}
const styles = StyleSheet.create({
list: {
width: '100%'
},
item: {
paddingTop: '4%',
paddingBottom: '4%'
},
itemWrapper: {
borderBottomWidth: 1,
borderColor: '#F5F5F5'
},
text: {
color: '#666'
},
cellIcon: {
height: 34,
width: 34,
borderRadius: 17
}
});
export default SubList;