Skip to content

autoScroll causes unexpected snapping to selected value after scroll in long dropdown lists #345

@pga5e

Description

@pga5e

When using react-native-element-dropdown with a pre-selected value and a long list (e.g. language selector), the dropdown unexpectedly scrolls back to the selected item the moment scrolling stops — even if the user is browsing a different part of the list.

This happens because the autoScroll prop is true by default. When scrolling ends (or the dropdown is focused/blurred), the dropdown aggressively jumps to the currently selected value — disrupting user experience.

This behavior is not intuitive and is not clearly documented.

Steps to Reproduce

  • Use a dropdown with a long list of items (50+)
  • Set an initial selected value (e.g., "English")
  • Scroll far down the dropdown list (e.g., to "Japanese")
  • Pause for a second — or lift your finger
  • Observe: the dropdown snaps back up to "English" immediately
import React, { useState } from "react";
import { View } from "react-native";
import { Dropdown } from "react-native-element-dropdown";

const translationLanguages = [
  { code: "en", label: "English" },
  { code: "fr", label: "French" },
  { code: "es", label: "Spanish" },
  { code: "ja", label: "Japanese" },
  { code: "ko", label: "Korean" },
  { code: "zh", label: "Chinese" },
  // ...many more
];

export default function App() {
  const [language, setLanguage] = useState(() =>
    translationLanguages.find((l) => l.code === "en")
  );

  return (
    <View style={{ padding: 20 }}>
      <Dropdown
        data={translationLanguages}
        labelField="label"
        valueField="code"
        value={language}
        placeholder="Select Language"
        onChange={(item) => {
          const match = translationLanguages.find(l => l.code === item.code);
          setLanguage(match);
        }}
        autoScroll={true} // This causes the snapping behavior
        search
        maxHeight={250}
      />
    </View>
  );
}


Setting autoScroll={false} solves the issue completely:


This behavior should either:

Be clearly documented in the README

Default to false, especially in lists with more than X items

Allow for smarter scroll behavior (e.g., only scroll on first open, not during interactions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions