GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Flatlist scrolls up a bit when item on top updates · Issue #26760 · react/react-native

Flatlist scrolls up a bit when item on top updates #26760

New issue
Copy link
New issue
Copy link
Closed
Closed
Flatlist scrolls up a bit when item on top updates#26760
Copy link
Labels
BugComponent: FlatListRan CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

Description

@n00bm5st3r69
n00bm5st3r69
opened on Oct 8, 2019
Issue body actions

When I scroll down to the last item in the Flatlist and an item on top updates, Flatlist scrolls up a bit. By the way, my Flatlist renders images and videos. When the videos are not visible in the viewport it turns into an image.

Sample code below (not the exact code but similar)

       Home.js


         onViewableItemsChanged = ({ viewableItems }) => {
          for(i = 0; i < viewableItems.length; i++) {
            if(this.state.videos.findIndex(x => x.id === viewableItems[i].item.id) > -1) {
                  this.timer = setTimeout(()=>  {
                    this.setState({isVideoVisible: true})
                  }, 2000);
            }
            else {
                  this.setState({isVideoVisible: false});
                  clearTimeout(this.timer);
            }
          }
        }

        <FlatList
          data={this.state.data}
          ListEmptyComponent={() => {
            return (
              <Ghost />
            )
          }}
          renderItem={({ item }) => {
            if (item.type == "Image") {
              return (<CustomImageComponent data={item}/>)
            } else {
              return (<MediaPlayer data={item} isVideoVisible={this.state.isVideoVisible}/>)
            } 
          }
          }
          onViewableItemsChanged={this.onViewableItemsChanged}
          viewabilityConfig={this.viewabilityConfig}
          keyExtractor={(item, index) => index.toString()}
        />


        MediaPlayer.js

        <Container>
          this.props.isVideoVisible ? <Video /> : <Image />
        </Container>

Activity

  1. n00bm5st3r69
    added
    Bug
    on Oct 8, 2019
  2. react-native-bot
    added
    Component: FlatList
    on Oct 8, 2019
  3. react-native-bot commented on Oct 8, 2019

    @react-native-bot
    react-native-bot
    on Oct 8, 2019
    Collaborator
    More actions

    Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?

    👉 Click here if you want to take another look at the Bug Report issue template.

  4. react-native-bot
    added
    Ran CommandsOne of our bots successfully processed a command.
    Resolution: Needs More Information
    on Oct 8, 2019
  5. n00bm5st3r69
    closed this as completedon Oct 9, 2019
  6. react
    locked as resolved and limited conversation to collaborators on Oct 3, 2021
  7. react-native-bot
    added
    Resolution: LockedThis issue was locked by the bot.
    on Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: FlatListRan CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.