From 9f4890e5e9647343ae4248fb5c3a8f3fa16e0551 Mon Sep 17 00:00:00 2001 From: G Date: Sat, 6 Sep 2025 11:27:28 +0000 Subject: [PATCH] feat: Balance component with authentication module relying on user authentication method to access the hidden amount. --- src/components/Balance.tsx | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/components/Balance.tsx diff --git a/src/components/Balance.tsx b/src/components/Balance.tsx new file mode 100644 index 0000000..8fc4088 --- /dev/null +++ b/src/components/Balance.tsx @@ -0,0 +1,55 @@ +import { asp as g } from "@asp/asp"; +import Entypo from "@expo/vector-icons/Entypo"; +import { ImageBackground } from "expo-image"; +import * as LocalAuthentication from "expo-local-authentication"; +import { type FC, useState } from "react"; +import type { ViewProps } from "react-native"; +import { Text, TouchableOpacity } from "react-native"; + +type BalanceProps = Omit & { amount: number }; + +export const Balance: FC = ({ style, amount = 0, ...rest }) => { + const [showBalance, setShowBalance] = useState(false); + + const handleLocalAuthentication = async () => { + console.log("handleLocalAuthentication :: start"); + if (showBalance) { + return setShowBalance(false); + } + const result = await LocalAuthentication.authenticateAsync(); + if (result.success) { + setShowBalance(true); + } + console.log("handleLocalAuthentication :: end", result); + }; + + return ( + + {showBalance ? ( + setShowBalance(false)}> + {amount} + + ) : ( + + )} + + ); +}; -- libgit2 0.27.1