diff options
| author | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
|---|---|---|
| committer | Saumit <justsaumit@protonmail.com> | 2025-09-27 02:14:26 +0530 |
| commit | 82e03978b89938219958032efb1448cc76baa181 (patch) | |
| tree | 626f3e54d52ecd49be0ed3bee30abacc0453d081 /src/react-native-app/app/(tabs)/index.tsx | |
Initial snapshot - OpenTelemetry demo 2.1.3 -f
Diffstat (limited to 'src/react-native-app/app/(tabs)/index.tsx')
| -rw-r--r-- | src/react-native-app/app/(tabs)/index.tsx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/react-native-app/app/(tabs)/index.tsx b/src/react-native-app/app/(tabs)/index.tsx new file mode 100644 index 0000000..c01e1ea --- /dev/null +++ b/src/react-native-app/app/(tabs)/index.tsx @@ -0,0 +1,39 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 +import { ThemedView } from "@/components/ThemedView"; +import ProductList from "@/components/ProductList"; +import { useQuery } from "@tanstack/react-query"; +import { ScrollView, StyleSheet } from "react-native"; +import { ThemedText } from "@/components/ThemedText"; +import ApiGateway from "@/gateways/Api.gateway"; + +export default function Index() { + const { data: productList = [] } = useQuery({ + // TODO simplify react native demo for now by hard-coding the selected currency + queryKey: ["products", "USD"], + queryFn: () => ApiGateway.listProducts("USD"), + }); + + return ( + <ThemedView style={styles.container}> + <ScrollView> + {productList.length ? ( + <ProductList productList={productList} /> + ) : ( + <ThemedText> + No products found, make sure the backend services for the + OpenTelemetry demo are running + </ThemedText> + )} + </ScrollView> + </ThemedView> + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: "center", + alignItems: "center", + }, +}); |
