Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 84 additions & 78 deletions src/screens/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,107 +8,113 @@ import { STORE_KEYS } from "@src/storage/store/consts";
import { H_Colors, mainColors } from "@styles/colors";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { Image, TouchableOpacity, View } from "react-native";
import { Image, Platform, TouchableOpacity, View } from "react-native";
import Onboarding from "react-native-onboarding-swiper";
import { s, ScaledSheet } from "react-native-size-matters";
import { useSafeAreaInsets } from "react-native-safe-area-context";

export default function OnboardingScreen({ navigation }: TOnboardingPageProps) {
const { t } = useTranslation([NS.common]);
const [accepted, setAccepted] = useState(false);
const insets = useSafeAreaInsets();
const bottomInset = Platform.OS === "android" ? insets.bottom : 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That didn't resolve it. I added 60 to the bottomInset and that moved it up enough. That also lets us skip wrapping it in the view below.

const bottomInset = Platform.OS === "android" ? 60 + insets.bottom : 60;

const handleDone = async () => {
await store.set(STORE_KEYS.explainer, "1");
navigation.replace("dashboard");
};
return (
<Onboarding
onDone={() => void handleDone()}
showDone={accepted}
showSkip={accepted}
showNext={accepted}
pages={[
{
backgroundColor: "black",
image: <Logo size={s(130)} />,
title: "Alpha Testing",
subtitle: (
<View
style={{
padding: s(10),
flexDirection: "column",
alignItems: "center",
}}
>
<Txt
txt="eNuts is currently in alpha testing. Please use at your own risk."
styles={[{ paddingHorizontal: s(10), textAlign: "center" }]}
/>
<TouchableOpacity
<View style={[styles.container, { paddingBottom: bottomInset }]}>
<Onboarding

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove the view wrap and add

      bottomBarHeight={bottomInset}

above the onDone call

onDone={() => void handleDone()}
showDone={accepted}
showSkip={accepted}
showNext={accepted}
pages={[
{
backgroundColor: "black",
image: <Logo size={s(130)} />,
title: "Alpha Testing",
subtitle: (
<View
style={{
flexDirection: "row",
padding: s(10),
flexDirection: "column",
alignItems: "center",
marginTop: s(24),
}}
onPress={() => setAccepted((acpt) => !acpt)}
activeOpacity={0.7}
testID="onboarding-accept-checkbox"
>
<View
<Txt
txt="eNuts is currently in alpha testing. Please use at your own risk."
styles={[{ paddingHorizontal: s(10), textAlign: "center" }]}
/>
<TouchableOpacity
style={{
width: s(10),
borderWidth: 1,
borderColor: "white",
height: s(10),
backgroundColor: accepted ? "white" : "transparent",
flexDirection: "row",
alignItems: "center",
marginTop: s(24),
}}
/>
<Txt txt="I understand" styles={[{ marginLeft: s(10) }]} />
</TouchableOpacity>
</View>
),
},
{
backgroundColor: H_Colors.Default,
image: <Logo size={s(130)} />,
title: "eNuts & Ecash",
subtitle: t("explainer1"),
},
{
backgroundColor: "#8038CA",
onPress={() => setAccepted((acpt) => !acpt)}
activeOpacity={0.7}
testID="onboarding-accept-checkbox"
>
<View
style={{
width: s(10),
borderWidth: 1,
borderColor: "white",
height: s(10),
backgroundColor: accepted ? "white" : "transparent",
}}
/>
<Txt txt="I understand" styles={[{ marginLeft: s(10) }]} />
</TouchableOpacity>
</View>
),
},
{
backgroundColor: H_Colors.Default,
image: <Logo size={s(130)} />,
title: "eNuts & Ecash",
subtitle: t("explainer1"),
},
{
backgroundColor: "#8038CA",

image: <Image style={styles.cashuImg} source={require("@assets/cashu.png")} />,
title: "Cashu & Mints",
subtitle: t("explainer2"),
},
{
backgroundColor: H_Colors.Nuts,
image: <Image style={styles.cashuImg} source={require("@assets/cashu.png")} />,
title: "Cashu & Mints",
subtitle: t("explainer2"),
},
{
backgroundColor: H_Colors.Nuts,

image: (
<Image style={styles.sendReceiveImg} source={require("@assets/send_receive.png")} />
),
title: t("send&receive"),
subtitle: t("explainer3"),
},
]}
transitionAnimationDuration={250}
titleStyles={styles.title}
subTitleStyles={styles.subTitle}
nextLabel={t("next")}
skipLabel={t("skip")}
onSkip={() => void handleDone()}
DoneButtonComponent={() => (
<TouchableOpacity
onPress={() => void handleDone()}
style={{ marginRight: s(20) }}
testID="onboarding-done"
>
<Txt txt={t("next")} styles={[{ color: mainColors.WHITE }]} />
</TouchableOpacity>
)}
/>
image: (
<Image style={styles.sendReceiveImg} source={require("@assets/send_receive.png")} />
),
title: t("send&receive"),
subtitle: t("explainer3"),
},
]}
transitionAnimationDuration={250}
titleStyles={styles.title}
subTitleStyles={styles.subTitle}
nextLabel={t("next")}
skipLabel={t("skip")}
onSkip={() => void handleDone()}
DoneButtonComponent={() => (
<TouchableOpacity
onPress={() => void handleDone()}
style={{ marginRight: s(20) }}
testID="onboarding-done"
>
<Txt txt={t("next")} styles={[{ color: mainColors.WHITE }]} />
</TouchableOpacity>
)}
/>
</View>
);
}

const styles = ScaledSheet.create({
container: { flex: 1 },
title: { fontSize: "28@vs", fontWeight: "500" },
subTitle: { fontSize: "16@vs" },
cashuImg: {
Expand Down