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

CellRendererComponent with onViewableItemsChanged #44303

Closed
dekim1028 opened this issue Apr 29, 2024 · 3 comments
Closed

CellRendererComponent with onViewableItemsChanged #44303

dekim1028 opened this issue Apr 29, 2024 · 3 comments
Labels
Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: Answered When the issue is resolved with a simple answer Type: Unsupported Version Issues reported to a version of React Native that is no longer supported

Comments

@dekim1028
Copy link

Description

When i use CellRendererComponent, onViewableItemsChanged is not calling. How can we use them together?

Steps to reproduce

const CellRendererComponent = useCallback(
      ({ children, item, ...props }) => {
          return (
              <View
                  {...props}
                  onLayout={(event) => {
                      ...
                  }}>
                  {children}
              </View>
          );
      },
      [],
);

<FlatList
 CellRendererComponent={CellRendererComponent}
 onViewableItemsChanged={/** code */}
 ViewabilityConfig={/** code */}
...
/>

React Native Version

0.71.16

Affected Platforms

Runtime - Android, Runtime - iOS, Build - MacOS

Output of npx react-native info

...

Stacktrace or Logs

...

Reproducer

NO

Screenshots and Videos

No response

Copy link

⚠️ Unsupported Version of React Native
ℹ️ It looks like your issue or the example you provided uses an unsupported version of React Native.

Due to the number of issues we receive, we're currently only accepting new issues against one of the supported versions. Please upgrade to latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If you cannot upgrade, please open your issue on StackOverflow to get further community support.

@github-actions github-actions bot added Type: Unsupported Version Issues reported to a version of React Native that is no longer supported Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. and removed Needs: Triage 🔍 labels Apr 29, 2024
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@NickGerleman
Copy link
Contributor

NickGerleman commented Apr 29, 2024

Custom CellRenderer must forward events like onLayout, onFocusCapture. So the set onLayout prop must be called in any custom handlers.

See list of handlers:

export type CellRendererProps<ItemT> = $ReadOnly<{

@cortinico cortinico added Resolution: Answered When the issue is resolved with a simple answer and removed Needs: Author Feedback labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. Resolution: Answered When the issue is resolved with a simple answer Type: Unsupported Version Issues reported to a version of React Native that is no longer supported
Projects
None yet
Development

No branches or pull requests

3 participants