react-native-section-alphabet-list icon indicating copy to clipboard operation
react-native-section-alphabet-list copied to clipboard

Android tapping Z brings me to F section of the list

Open Rodbourne opened this issue 1 year ago • 10 comments

I have these props on the <AlphabetList>,: 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.

Rodbourne avatar Jul 05 '23 18:07 Rodbourne

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 avatar Sep 05 '23 04:09 simonho1025

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.

simonho1025 avatar Sep 05 '23 04:09 simonho1025

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?

Rodbourne avatar Oct 10 '23 18:10 Rodbourne

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

simonho1025 avatar Oct 11 '23 02:10 simonho1025

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?

Rodbourne avatar Oct 11 '23 19:10 Rodbourne

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>

simonho1025 avatar Oct 12 '23 02:10 simonho1025

Same issue

Umar-Farooq-Shafi avatar Aug 01 '24 14:08 Umar-Farooq-Shafi

Same issue

Pls try to set listHeaderHeight & getItemHeight

simonho1025 avatar Aug 01 '24 14:08 simonho1025

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'

Umar-Farooq-Shafi avatar Aug 01 '24 16:08 Umar-Farooq-Shafi