react-native-tabs-section-list
react-native-tabs-section-list copied to clipboard
Invariant Violation: Tried to get frame for out of range index 0
hi, thanks for this good package :
this is my array :
(6) [{…}, {…}, {…}, {…}, {…}, {…}]
and this is object of array :
data: {_id: "60631b49aa0bbe63062f97e7", name: "سوخاری ها", slug: "frize", preparation_duration: 25, show_calory: false, …}
title: "سوخاری ها"
and this is my SectionList
:
{this.state.categories.length > 0 ? <SectionList
renderItem={({ item, index, section }) => {
return (
<Text key={index}>{item.title}</Text>
)
}}
renderSectionHeader={({ section: { title } }) => (
<Text style={{ fontWeight: 'bold' }}>{title}</Text>
)}
renderTab={({ title, isActive }) => {
return (
<View
style={[
styles.tabContainer,
{ borderBottomWidth: isActive ? 1 : 0 }
]}
>
<Text
style={[
styles.tabText,
{ color: isActive ? '#090909' : '#9e9e9e' }
]}
>
{title}
</Text>
</View>
)
}
}
sections={this.state.categories}
keyExtractor={(item, index) => { console.log(item); index.toString() }}
/> :
<View><Text>Nothing</Text></View>}
but get this error :
Invariant Violation: Tried to get frame for out of range index 0
how to solve this ?