diff --git a/app/screens/onboarding/index.tsx b/app/screens/onboarding/index.tsx
index 1ffee91a1..1f5c917db 100644
--- a/app/screens/onboarding/index.tsx
+++ b/app/screens/onboarding/index.tsx
@@ -27,19 +27,30 @@ const Onboarding = ({
const translateX = useSharedValue(0);
const styles = getStyleSheet(theme);
const [currentIndex, setCurrentIndex] = useState(0);
+ const [isLastSlide, setIsLastSlide] = useState(false);
+ const lastSlideIndex = slidesData.length - 1;
const slidesRef = useRef(null);
const nextSlide = () => {
- console.log('\n*** slidesRef 1\n');
- if (slidesRef.current && currentIndex < slidesData.length - 1) {
- console.log('\n*** slidesRef 2\n');
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
- // @ts-ignore
- slidesRef.current.scrollToIndex({index: currentIndex + 1});
+ const nextSlideIndex = currentIndex + 1;
+ if (slidesRef.current && currentIndex < lastSlideIndex) {
+ console.log('*** current slide', currentIndex);
+ console.log('*** next slide', nextSlideIndex);
+ moveToSlide(nextSlideIndex);
} else {
- console.log('*** end of slide');
+ console.log('*** end of slide', lastSlideIndex);
}
};
+
+ const moveToSlide = (slideIndexToMove: number) => {
+ if (slideIndexToMove === lastSlideIndex) {
+ setIsLastSlide(true);
+ }
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore
+ slidesRef?.current?.scrollToIndex({index: slideIndexToMove});
+ };
+
const signInHandler = () => {
console.log('sign in handler');
};
@@ -100,8 +111,10 @@ const Onboarding = ({
data={slidesData}
theme={theme}
scrollX={scrollX}
+ isLastSlide={isLastSlide}
nextSlideHandler={nextSlide}
signInHandler={signInHandler}
+ moveToSlide={moveToSlide}
/>
);
diff --git a/app/screens/onboarding/paginator.tsx b/app/screens/onboarding/paginator.tsx
index 3bca52537..91b6f2c8f 100644
--- a/app/screens/onboarding/paginator.tsx
+++ b/app/screens/onboarding/paginator.tsx
@@ -2,7 +2,7 @@
// See LICENSE.txt for license information.
import React from 'react';
-import {View, Animated, useWindowDimensions} from 'react-native';
+import {View, Animated, useWindowDimensions, TouchableOpacity} from 'react-native';
import Button from 'react-native-button';
import CompassIcon from '@app/components/compass_icon';
@@ -14,8 +14,10 @@ type Props = {
data: any;
theme: Theme;
scrollX: any;
+ isLastSlide: boolean;
nextSlideHandler: any;
signInHandler: any;
+ moveToSlide: any;
};
const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({
@@ -49,10 +51,39 @@ const Paginator = ({
scrollX,
nextSlideHandler,
signInHandler,
+ moveToSlide,
+ isLastSlide,
}: Props) => {
const styles = getStyleSheet(theme);
const {width} = useWindowDimensions();
+ let mainButtonText = (
+ <>
+
+
+ >
+ );
+
+ let mainButtonAction = nextSlideHandler;
+
+ if (isLastSlide) {
+ mainButtonText = (
+
+ );
+ mainButtonAction = signInHandler;
+ }
+
return (
@@ -66,35 +97,32 @@ const Paginator = ({
});
return (
- moveToSlide(i)}
key={item.id}
- />
+ >
+
+
);
})}