-
Notifications
You must be signed in to change notification settings - Fork 36
fix: Add SafeArea insets to onboarding screen #406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Egge21M
wants to merge
1
commit into
cashubtc:master
Choose a base branch
from
Egge21M:safearea-onboarding
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
| 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 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove the view wrap and add 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: { | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.