Closed mehimanshupatil closed 3 years ago
Thanks @mehimanshupatil 👍 I like that you kept the ScrollView rendering method intact for existing users. Is this ready for merge or is more testing needed?
Thanks @peacechen Let wait for this weekend. Since we are implementing flatList I will try to fix #93. Also, can you test this on an iOS device?
@peacechen you can merge it. But I have not tested on iOS
Would love this to get merged. I'm also making a country selector :)
@kg-currenxie
Thanks for the reminder, and apologies for the delay. Please test this before I publish. You can use this in your package.json to pull directly from the repo:
dependencies: {
"react-native-modal-selector": "https://github.com/peacechen/react-native-modal-selector.git",
}
Wow, thanks for doing this so fast! @peacechen
Found a small bug
renderFlatlistOption = ({ item, index, separators }) => {
if (item.section) {
return this.renderSection(item);
}
const numItems = this.props.data.length;
this.renderOption(item, index === (numItems - 1), index === 0); <------- missing return
}
My flatlist showed an empty list :) i debugged and after adding return
, it works, and the modal opens instantly, and the initial options (images) load much faster!
Oh, and also, a small TS type error:
Update:
Maybe
export default class ModalSelector<TOption = IOption> extends React.Component<IModalSelectorProps<TOption> & Omit<FlatListProps<any>, any>, 'renderItem'> {}
?
ok, @kg-currenxie thank for testing. You can submit a PR for the same or else I will submit a PR in coming weekend.
Thanks @kg-currenxie for noting those bugs. I pushed a commit to fix the return in renderFlatlistOption()
.
@mehimanshupatil Can you confirm that the TS definition fix that kg proposed fixes the other problem?
Fix published in 2.0.4
WRT #94 Issue, have implemented flatList and also have added an example![20201128_141250](https://user-images.githubusercontent.com/25838799/100497886-46e83800-3184-11eb-9a59-475001c5b6ab.gif)
Note