Wrong drag offset after changing ListHeaderComponent's height
See original GitHub issue"react-native": "0.61.5",
"react-native-draggable-flatlist": "2.1.2"
<DraggableFlatList
//...
ListHeaderComponent={this.props.HeaderComponent}
ListHeaderComponentStyle={styles.header}
//...
/>
const styles = StyleSheet.create({
header: {
paddingTop: 72,
paddingHorizontal: '13%',
marginBottom: 36,
},
//...
});
HeaderComponent is a some view. After some async actions (~3 sec after did mount) HeaderComponent’s height will be changed. DraggableFlatList will get wrong offset while any element is dragging (wrong hovering position), so looks like it’s not recalculated.
Any suggestions?
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
FlatList with sticky ListHeaderComponent ... - GitHub
When using <FlatList /> with the props ListHeaderComponent , and stickyHeaderIndices , the scroll area is the full height of the scree. When...
Read more >react native - FlatList Weird Behavior after appending new data
<FlatList keyboardDismissMode = 'on-drag' keyboardShouldPersistTaps = 'always' getItemLayout={(data, index) => ( {length: 575, offset: 575 ...
Read more >React Native FlatList Scroll to Offset - YouTube
Learn how to scroll to an offset for a FlatList in React Native. Code: https://github.com/benawad/ drag -and-drop-flatlist/tree/ ...
Read more >Chrome Drag-to-Sort - “Can it be done in React Native?”
Learn React Native Gestures and Animations at https://start-react-native.dev/Source code: ...
Read more >Usage | FlashList
When set to true the list's rendered size needs to be deterministic (i.e., height and width greater than 0) as FlashList will skip...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yep, whenever
layoutInvalidationKey
changes all items and offsets will be remeasured.Thanks for the example, I see the issue now. You can invalidate current measurements by setting a new
key
, so in this case you can force a recalculation by updating yourkeyExtractor
withvisible
– something like:https://snack.expo.io/@computerjazz/swipetodelete-pkg-header-resize-bug