bardog/Alpha-scroll-flat-list

click on alphabet won't work

Opened this issue · 2 comments

Hello,
Click on alphabet won't work.
react-native 60

@SajadAbasi I had to modify the following to make it work:

in AlphabeticScrollBar.js I had to change the variable top to align with the top of where my alpha list is on my screen (in my case 80% from the top + 70px)

getTouchedLetter (y) {
        const top = Math.abs(y) - (this.containerHeight * 0.8 - 70);

        if (top >= 1 && top <= this.containerHeight) {
            this.setState({
                activeLetterViewTop: top
            });

            return this.state.alphabet[Math.round((top / this.containerHeight) * this.state.alphabet.length)]
        }
    }

Then, to make my flatlist move the correct distance I modified in index.js:

this.list.scrollToOffset({ animated: false, offset: index * this.props.itemHeight * 1.2 });

Hope that helps.

Did you use getItemLayout ?