Skip to content

Commit

Permalink
Add bottom sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
dgca committed Dec 12, 2024
1 parent 8aff9d4 commit f7116b5
Show file tree
Hide file tree
Showing 6 changed files with 278 additions and 56 deletions.
60 changes: 31 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 49 additions & 5 deletions packages/mobile-app/app/(tabs)/balances.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect } from "react";
import {
Box,
HStack,
Expand All @@ -7,6 +8,8 @@ import {
Text,
VStack,
Card,
useBottomSheet,
Button,
} from "@ironfish/tackle-box";
import { SafeAreaGradient } from "@/components/SafeAreaGradient/SafeAreaGradient";
import { View } from "react-native";
Expand Down Expand Up @@ -58,11 +61,7 @@ export default function Balances() {
</Tabs.Content>
<Tabs.Content value="transactions">
<VStack flexGrow={1} p={4} pb={16}>
<Text>Transactions</Text>
<Text>Transactions</Text>
<Text>Transactions</Text>
<Text>Transactions</Text>
<Text>Transactions</Text>
<BottomSheetDemo />
</VStack>
</Tabs.Content>
</Tabs.Root>
Expand Down Expand Up @@ -128,3 +127,48 @@ function AssetRow() {
</Card>
);
}

function BottomSheetDemo() {
const bottomSheet = useBottomSheet();

return (
<VStack gap={2}>
<Button
title="Show Bottom Sheet"
onClick={() => {
bottomSheet.show({
title: "Account Syncing",
body: <AccountSyncingDetails onClose={bottomSheet.hide} />,
});
}}
/>
</VStack>
);
}

function AccountSyncingDetails({ onClose }: { onClose: () => void }) {
return (
<Box>
<Text color="textSecondary" textAlign="center">
The blockchain is currently syncing with your accounts. Your balance may
be inaccurate and sending transactions will be disabled until the sync
is done.
</Text>
<VStack mt={8} mb={20} gap={4}>
<VStack>
<Text color="textSecondary">Node Status:</Text>
<Text size="lg">Syncing Blocks</Text>
</VStack>
<VStack>
<Text color="textSecondary">Progress:</Text>
<Text size="lg">42.3%</Text>
</VStack>
<VStack>
<Text color="textSecondary">Blocks Scanned:</Text>
<Text size="lg">33645/74346</Text>
</VStack>
</VStack>
<Button title="Close" onClick={onClose} />
</Box>
);
}
38 changes: 18 additions & 20 deletions packages/mobile-app/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,7 @@ import {
ThemeProvider,
} from "@react-navigation/native";
import { Stack } from "expo-router";
import {
ActivityIndicator,
SafeAreaView,
StyleSheet,
Text,
} from "react-native";
import { ActivityIndicator, SafeAreaView, StyleSheet } from "react-native";
import {
MutationCache,
QueryClient,
Expand All @@ -20,6 +15,7 @@ import { useColorScheme } from "react-native";
import { FacadeProvider, useFacade } from "../data/facades";
import { useEffect, useState } from "react";
import { useFonts } from "expo-font";
import { BottomSheetProvider, Text } from "@ironfish/tackle-box";

const queryClient = new QueryClient({
defaultOptions: {
Expand Down Expand Up @@ -75,20 +71,22 @@ export default function Layout() {
<QueryClientProvider client={queryClient}>
<FacadeProvider>
<DatabaseLoader>
<Stack>
<Stack.Screen
name="(tabs)"
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="onboarding"
options={{
headerShown: false,
}}
/>
</Stack>
<BottomSheetProvider>
<Stack>
<Stack.Screen
name="(tabs)"
options={{
headerShown: false,
}}
/>
<Stack.Screen
name="onboarding"
options={{
headerShown: false,
}}
/>
</Stack>
</BottomSheetProvider>
</DatabaseLoader>
</FacadeProvider>
</QueryClientProvider>
Expand Down
Loading

0 comments on commit f7116b5

Please sign in to comment.