Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onViewableItemsChanged not getting called #1883

Closed
BertoGz opened this issue May 13, 2022 · 2 comments
Closed

onViewableItemsChanged not getting called #1883

BertoGz opened this issue May 13, 2022 · 2 comments
Labels

Comments

@BertoGz
Copy link

BertoGz commented May 13, 2022

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

react-native-calendars@1.1283.0
react-native@0.66.1

  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

@Inbal-Tish
Copy link
Collaborator

@BertoGz Please follow PR #1889

@stale
Copy link

stale bot commented Sep 4, 2022

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 stale bot added the stale label Sep 4, 2022
@stale stale bot closed this as completed Oct 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants