react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

onViewableItemsChanged not getting called

Open BertoGz opened this issue 3 years ago • 2 comments

Description

Am currently using the AgendaList component to render some reservation items sectioned by day and I would like to know the current items visible on the screen.

Expected Behavior

onViewableItemsChanged is supposed to be called as soon as the items on the viewable space has changed.

Observed Behavior

onViewableItemsChanged is not getting called no matter where I scroll. The props passed: viewabilityConfig={{ viewAreaCoveragePercentThreshold: 80, itemVisiblePercentThreshold: 80, }} onViewableItemsChanged={({ viewableItems, changed }) => { Alert.alert('test!'); console.log('items change', viewableItems); console.log('Changed in this iteration', changed); }}

Environment

[email protected] [email protected]

  1. Device/emulator/simulator & OS version: Simulator: IOS 15; Android API 29

simplified code: <CalendarProvider onDateChanged={this.onDateChanged} onMonthChange={this.onMonthChange} > <ExpandableCalendar // props /> )} <AgendaList sections={ITEMS} renderItem={this.renderItem} viewabilityConfig={{ viewAreaCoveragePercentThreshold: 80, itemVisiblePercentThreshold: 80, }} onViewableItemsChanged={({ viewableItems, changed }) => { Alert.alert('test!'); console.log('items change', viewableItems); console.log('Changed in this iteration', changed); }} /> </CalendarProvider>

from the docs I can see this agendaList component extends sectionList. are some props just not actively supported? Im also getting no behavior from getItemCount prop.

Update: I was able to note why this issue was occurring. the AgendaList makes use of sectionList's "onViewableItemsChanged" which pretty much was overriding the users callback. Perhaps add support to call the user defined "onViewableItemsChanged" as well as agendaLists

BertoGz avatar May 13 '22 19:05 BertoGz

@BertoGz Please follow PR #1889

Inbal-Tish avatar May 25 '22 11:05 Inbal-Tish

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 04 '22 17:09 stale[bot]