react-native-sortable-list
react-native-sortable-list copied to clipboard
Error when setting data in list from state
whenever i try to render data from state i'm getting error, saying 'requested keys of a value that is not an object' and when i stored data as object and called then getting error like 'undefined is not an object (evaluating 'rowsLayout[key].height')'
heres my return function
return (
<View style={styles.container}>
<Text>{this.state.data}</Text>
<SortableList
style={styles.list}
contentContainerStyle={styles.contentContainer}
// onPressRow={() => navigate('List', { data: data })}
data={data}
//onChangeOrder={this.saveData()}
renderRow={this._renderRow} />
<View style={styles.button}>
<TouchableOpacity onPress={() => navigate('New', { date: date })}>
<Icon name={'add-to-list'} size={25} color="snow" />
</TouchableOpacity>
</View>
</View>
);
}
Render function
_renderRow({ data, active }) {
return <Row data={data} active={active} />
}
I'm new to React Native, don't know whether I'm missing anything or not..
The data passed to SortableList should be a object, what's your data like ?
I think this is related to https://github.com/gitim/react-native-sortable-list/issues/75