Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to scroll to an element of a list in react native?

$
0
0

I was wondering if it was possible to scroll to an element of a list depending on another element of the list (ex : you avec a list [a,b,c,d], you put a touchableopacity with a b c d as text touchable and then you have multiple view, 1 for each elements of your list, and those view are created with a data.map. You then want that when you click on b, it will lead to the view of the element b)I have tried using react-native-scroll-to-element from How to scroll to a specific element that can be modified? (React Native) but it doesn't seems to work.

Here is the code :

<View>  {letter.map((letter) => {    return (<SpecialView><Text          onPress={() => {            viewRef.current?.focus();            scrollLetter = letter.name;          }}>          {letter.name}</Text></SpecialView>    );  })}</View><View>  {letter.map((letter) => {    return (<View><div><Text>{letter.name}</Text><Text style={{ fontSize: 0 }}>            {(scrollend = letter.name)}            {/*la lettre actuelle */}</Text></div></View>    );  })}</View>

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>