onPress go to select marker
tetar998 opened this issue · comments
is it possible too add a function when user press the marker the slider go to the marker pressed ?
i found the solution
Add
<Animated.ScrollView horizontal ref={(c) => {this.scroll = c}} scrollEventThrottle={1} showsHorizontalScrollIndicator={true} snapToInterval={CARD_WIDTH} onScroll={Animated.event( [{ nativeEvent: { contentOffset: { x: this.animation, }, }, },], { useNativeDriver: true } )} style={styles.scrollView} contentContainerStyle={styles.endPadding} >
and this for the map view marker
<MapView.Marker key={index} coordinate={marker.coordinates} onPress={() => this.handleMarkerPress(index)} >
and the handlemarkerpress this.scroll.getNode().scrollTo({x: e * 375, y: 0, animated: true});
(375 for my card width)