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

Options disappear #81

Open
ludgerey opened this issue Aug 21, 2024 · 2 comments
Open

Options disappear #81

ludgerey opened this issue Aug 21, 2024 · 2 comments

Comments

@ludgerey
Copy link

Options disappear when clicked once.

Steps to reproduce:

  • Open modal
  • Select option
  • Open modal again
  • Select other option

-> First selected option disappears. Continues until there is only one option left.

It also has a weird spacing on the bottom.

Tested on android and ios.

import { SafeAreaView, StyleSheet } from 'react-native';
import ModalDropdown from "react-native-modal-dropdown";

export default function App() {
  return (
    <SafeAreaView style={styles.container}>
      <ModalDropdown options={["option 1", "option 2"]} />
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
});

Expo Snack: https://snack.expo.dev/@ley-syniotec/react-native-modal-dropdown-disappearing-options

screen

@Dereisberg
Copy link

I solve this problem by deleting this props line: initialScrollIndex={saveScrollPosition ? selectedIndex : -1} in function __renderDropdown(). It seems that it's a bug in component FlatList, I saw similar issues in react-native's repository: https://github.com/facebook/react-native/issues/44544.

image

@mrkishorekumar
Copy link

I experienced the exact same issue about an hour ago. What worked for me was adding saveScrollPosition={false}. Before discovering this workaround, I also noticed that dragging one of the remaining options helped restore the list. Hopefully, one of these solutions works for you as well! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants