我将表头赋予手风琴渲染内容。通常,它呈现数组中有多少个项目,因此它给我的headerS等于数组长度。
但是我只想拥有标题1次。我该怎么办?
这是我的渲染图:
render() {
return (
<View style={styles.container}>
<ScrollView contentContainerStyle={{}}>
<Accordion
activeSections={this.state.activeSections}
sections={CONTENT2}
touchableComponent={TouchableOpacity}
expandMultiple={false}
renderHeader={this.renderHeader}
renderContent={this.renderContent}
duration={400}
onChange={this.setSections}
/>
</ScrollView>
</View>
);
}
}
这是renderContent:
renderContent(section, _, isActive) {
const tablehead = ['Beyanname','Gümrük','Saat'];
return (
<Animatable.View
duration={200}
style={[styles.content, isActive ? styles.active : styles.inactive]}
transition="backgroundColor"
>
{section.subcategory.map((item, key) => (
<View key={key} style={styles.item}>
<TouchableOpacity onPress={() => alert('Id: ' + item.id + ' val: ' + item.val)}>
<View style={styles.container2}>
--------> <Table borderStyle={{borderWidth: 2, borderColor: '#c8e1ff'}}>
<Row data={tablehead} style={styles.head} textStyle={styles.text}/>
</Table>
</View>
</TouchableOpacity>
<View style={styles.separator} />
</View>
))}
</Animatable.View>
);
}