File tree Expand file tree Collapse file tree 3 files changed +18
-6
lines changed
Expand file tree Collapse file tree 3 files changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -5,18 +5,20 @@ import Animated, {
55 interpolate ,
66 useAnimatedStyle ,
77} from 'react-native-reanimated' ;
8- import { View } from '../styles/components' ;
8+ import { Pressable } from '../styles/components' ;
99
1010const DOT_SIZE = 7 ;
1111
1212const Dot = ( {
1313 animValue,
1414 index,
1515 length,
16+ onPress,
1617} : {
1718 index : number ;
1819 length : number ;
1920 animValue : SharedValue < number > ;
21+ onPress : ( ) => void ;
2022} ) : ReactElement => {
2123 const width = DOT_SIZE ;
2224
@@ -39,9 +41,9 @@ const Dot = ({
3941 } , [ animValue , index , length ] ) ;
4042
4143 return (
42- < View style = { styles . dotRoot } color = "gray2" >
44+ < Pressable style = { styles . dotRoot } color = "gray2" onPress = { onPress } >
4345 < Animated . View style = { [ styles . dot , animStyle ] } />
44- </ View >
46+ </ Pressable >
4547 ) ;
4648} ;
4749
Original file line number Diff line number Diff line change @@ -171,11 +171,15 @@ const Slideshow = ({
171171 return { opacity } ;
172172 } , [ slides . length , progressValue ] ) ;
173173
174+ const scrollToSlide = ( index : number ) : void => {
175+ ref . current ?. scrollTo ( { index, animated : true } ) ;
176+ } ;
177+
174178 const onHeaderButton = ( ) : void => {
175179 if ( isLastSlide ) {
176180 navigation . navigate ( 'Passphrase' ) ;
177181 } else {
178- ref . current ?. scrollTo ( { index : slides . length - 1 , animated : true } ) ;
182+ scrollToSlide ( slides . length - 1 ) ;
179183 }
180184 } ;
181185
@@ -241,13 +245,16 @@ const Slideshow = ({
241245 </ Animated . View >
242246 </ View >
243247
244- < Animated . View style = { [ styles . dots , startOpacity ] } pointerEvents = "none" >
248+ < Animated . View
249+ style = { [ styles . dots , startOpacity ] }
250+ pointerEvents = { isLastSlide ? 'none' : 'auto' } >
245251 { slides . map ( ( _ , i ) => (
246252 < Dot
247253 key = { i }
248254 index = { i }
249255 animValue = { progressValue }
250256 length = { slides . length }
257+ onPress = { ( ) : void => scrollToSlide ( i ) }
251258 />
252259 ) ) }
253260 </ Animated . View >
Original file line number Diff line number Diff line change @@ -676,13 +676,16 @@ const ReceiveQR = ({
676676 gesture . activeOffsetX ( [ - 10 , 10 ] ) ;
677677 } }
678678 />
679- < View style = { styles . dots } pointerEvents = "none" >
679+ < View style = { styles . dots } >
680680 { slides . map ( ( _slide , index ) => (
681681 < Dot
682682 key = { index }
683683 index = { index }
684684 animValue = { progress }
685685 length = { slides . length }
686+ onPress = { ( ) : void => {
687+ carouselRef . current ?. scrollTo ( { index, animated : true } ) ;
688+ } }
686689 />
687690 ) ) }
688691 </ View >
You can’t perform that action at this time.
0 commit comments