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

Android tapping Z brings me to F section of the list #65

Open
Rodbourne opened this issue Jul 5, 2023 · 9 comments
Open

Android tapping Z brings me to F section of the list #65

Rodbourne opened this issue Jul 5, 2023 · 9 comments

Comments

@Rodbourne
Copy link

I have these props on the ,:
contentInsetAdjustmentBehavior="automatic"
initialNumToRender={100}
maxToRenderPerBatch={500}
updateCellsBatchingPeriod={10}
windowSize={400}
removeClippedSubviews
without these props, as referenced in another issue, the list jerks around a lot and breaks.
when I tap Z on the index, it'll bring me to the F section of the list. The other letters also only bring me to a section of the list from A->F instead of A->Z. I have ~8000 items in the list. works fine on iOS.

@simonho1025
Copy link

simonho1025 commented Sep 5, 2023

I have same issue both on iOS and Android. When I tap any letter on the index, it always jumps to incorrect position.

<AlphabetList
    data={nameData}
    indexContainerStyle={styles.indexContainer}
    indexLetterStyle={styles.indexLetter}
    renderCustomItem={(item) => (
        <ContactListItm contactInfo={item} />
    )}
    renderCustomSectionHeader={(section) => (
        <ContactListHeader title={section.title} />
    )}
/>

@simonho1025
Copy link

simonho1025 commented Sep 5, 2023

I have these props on the ,: contentInsetAdjustmentBehavior="automatic" initialNumToRender={100} maxToRenderPerBatch={500} updateCellsBatchingPeriod={10} windowSize={400} removeClippedSubviews without these props, as referenced in another issue, the list jerks around a lot and breaks. when I tap Z on the index, it'll bring me to the F section of the list. The other letters also only bring me to a section of the list from A->F instead of A->Z. I have ~8000 items in the list. works fine on iOS.

try to set listHeaderHeight & getItemHeight, it's worked for me.

@Rodbourne
Copy link
Author

I have these props on the ,: contentInsetAdjustmentBehavior="automatic" initialNumToRender={100} maxToRenderPerBatch={500} updateCellsBatchingPeriod={10} windowSize={400} removeClippedSubviews without these props, as referenced in another issue, the list jerks around a lot and breaks. when I tap Z on the index, it'll bring me to the F section of the list. The other letters also only bring me to a section of the list from A->F instead of A->Z. I have ~8000 items in the list. works fine on iOS.

try to set listHeaderHeight & getItemHeight, it's worked for me.

what value do I set it to?

@simonho1025
Copy link

simonho1025 commented Oct 11, 2023

I have these props on the ,: contentInsetAdjustmentBehavior="automatic" initialNumToRender={100} maxToRenderPerBatch={500} updateCellsBatchingPeriod={10} windowSize={400} removeClippedSubviews without these props, as referenced in another issue, the list jerks around a lot and breaks. when I tap Z on the index, it'll bring me to the F section of the list. The other letters also only bring me to a section of the list from A->F instead of A->Z. I have ~8000 items in the list. works fine on iOS.

try to set listHeaderHeight & getItemHeight, it's worked for me.

what value do I set it to?

listHeaderHeight and getItemHeight are number. Just checked out the document. found the section header(grey area) and item(country name) height.

image

If you don't know the height, you can use custom render both header and item. The example:

const ALPHABET_SIZE = {
    HEADER_HEIGHT: 34,
    ITEM_HEIGHT: 65
};

<AlphabetList
    data={displayContact}
    indexContainerStyle={styles.indexContainer}
    indexLetterStyle={styles.indexLetter}
    sectionHeaderHeight={ALPHABET_SIZE.HEADER_HEIGHT}
    getItemHeight={() => ALPHABET_SIZE.ITEM_HEIGHT}
    renderCustomSectionHeader={(section) => (
        <ContactListHeader title={section.title} />
    )}
    renderCustomItem={(item) => (
        <ContactListItm
            contactInfo={item}
            onPress={() => onPress(item)}
            selection={selection}
            maxSelect={maxSelect}
            selectedMember={selectedMember}
        />
    )}
/>

HEADER_HEIGHT also set on ContactListHeader wrapper, ITEM_HEIGHT set on ContactListItm wrapper

@Rodbourne
Copy link
Author

I have these props on the ,: contentInsetAdjustmentBehavior="automatic" initialNumToRender={100} maxToRenderPerBatch={500} updateCellsBatchingPeriod={10} windowSize={400} removeClippedSubviews without these props, as referenced in another issue, the list jerks around a lot and breaks. when I tap Z on the index, it'll bring me to the F section of the list. The other letters also only bring me to a section of the list from A->F instead of A->Z. I have ~8000 items in the list. works fine on iOS.

try to set listHeaderHeight & getItemHeight, it's worked for me.

what value do I set it to?

listHeaderHeight and getItemHeight are number. Just check out the document. Find out section header(grey area) and item(country name) height.

image

If you don't know the height, you can use custom render both header and item. The example:

const ALPHABET_SIZE = {
    HEADER_HEIGHT: 34,
    ITEM_HEIGHT: 65
};

<AlphabetList
    data={displayContact}
    indexContainerStyle={styles.indexContainer}
    indexLetterStyle={styles.indexLetter}
    sectionHeaderHeight={ALPHABET_SIZE.HEADER_HEIGHT}
    getItemHeight={() => ALPHABET_SIZE.ITEM_HEIGHT}
    renderCustomSectionHeader={(section) => (
        <ContactListHeader title={section.title} />
    )}
    renderCustomItem={(item) => (
        <ContactListItm
            contactInfo={item}
            onPress={() => onPress(item)}
            selection={selection}
            maxSelect={maxSelect}
            selectedMember={selectedMember}
        />
    )}
/>

HEADER_HEIGHT also set on ContactListHeader wrapper, ITEM_HEIGHT set on ContactListItm wrapper

can you show the ContactListItm wrapper where you set the ITEM_HEIGHT?

@simonho1025
Copy link

simonho1025 commented Oct 12, 2023

I have these props on the ,: contentInsetAdjustmentBehavior="automatic" initialNumToRender={100} maxToRenderPerBatch={500} updateCellsBatchingPeriod={10} windowSize={400} removeClippedSubviews without these props, as referenced in another issue, the list jerks around a lot and breaks. when I tap Z on the index, it'll bring me to the F section of the list. The other letters also only bring me to a section of the list from A->F instead of A->Z. I have ~8000 items in the list. works fine on iOS.

try to set listHeaderHeight & getItemHeight, it's worked for me.

what value do I set it to?

listHeaderHeight and getItemHeight are number. Just check out the document. Find out section header(grey area) and item(country name) height.
image
If you don't know the height, you can use custom render both header and item. The example:

const ALPHABET_SIZE = {
    HEADER_HEIGHT: 34,
    ITEM_HEIGHT: 65
};

<AlphabetList
    data={displayContact}
    indexContainerStyle={styles.indexContainer}
    indexLetterStyle={styles.indexLetter}
    sectionHeaderHeight={ALPHABET_SIZE.HEADER_HEIGHT}
    getItemHeight={() => ALPHABET_SIZE.ITEM_HEIGHT}
    renderCustomSectionHeader={(section) => (
        <ContactListHeader title={section.title} />
    )}
    renderCustomItem={(item) => (
        <ContactListItm
            contactInfo={item}
            onPress={() => onPress(item)}
            selection={selection}
            maxSelect={maxSelect}
            selectedMember={selectedMember}
        />
    )}
/>

HEADER_HEIGHT also set on ContactListHeader wrapper, ITEM_HEIGHT set on ContactListItm wrapper

can you show the ContactListItm wrapper where you set the ITEM_HEIGHT?

ContactListItm component codes:

<View style={{height:  ITEM_HEIGHT}}>
 <-- your code -->
</View>

@Umar-Farooq-Shafi
Copy link

Same issue

@simonho1025
Copy link

Same issue

Pls try to set listHeaderHeight & getItemHeight

@Umar-Farooq-Shafi
Copy link

Same issue

Pls try to set listHeaderHeight & getItemHeight

Yes, I did set it, but the pagination is breaking. When I click on an alphabet, it takes me to the wrong section. For example, clicking on 'M' takes me to 'N'

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