From 04b3033212030f44e44ee33bc4e2c0378b07b3c4 Mon Sep 17 00:00:00 2001 From: Michael Coughlin Date: Tue, 23 Jan 2024 17:12:16 -0600 Subject: [PATCH] Make back button exist --- app/(tabs)/index.jsx | 2 +- app/_layout.tsx | 2 +- components/PhotometryPlot.jsx | 4 ++++ components/PostFollowupRequest.jsx | 8 ++------ components/utils/notifications.native.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/(tabs)/index.jsx b/app/(tabs)/index.jsx index af00ac8..63c8497 100644 --- a/app/(tabs)/index.jsx +++ b/app/(tabs)/index.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { StyleSheet, FlatList, Image, ActivityIndicator } from "react-native"; -import { Link } from "expo-router"; +import { Stack, Link } from "expo-router"; import dayjs from "dayjs"; import calendar from "dayjs/plugin/calendar"; diff --git a/app/_layout.tsx b/app/_layout.tsx index c48bef7..92bd5b3 100644 --- a/app/_layout.tsx +++ b/app/_layout.tsx @@ -21,7 +21,7 @@ export { export const unstable_settings = { // Ensure that reloading on `/modal` keeps a back button present. - initialRouteName: "(tabs)", + initialRouteName: "/(tabs)", }; // Prevent the splash screen from auto-hiding before asset loading is complete. diff --git a/components/PhotometryPlot.jsx b/components/PhotometryPlot.jsx index 9d32531..0748c56 100644 --- a/components/PhotometryPlot.jsx +++ b/components/PhotometryPlot.jsx @@ -198,6 +198,10 @@ function PhotometryPlot({ dm, photometry, height, width }) { return Loading photometry...; } + if (data.length === 0) { + return No photometry available...; + } + const xDomain = photStats.days_ago.range; const yDomain = photStats.mag.range; diff --git a/components/PostFollowupRequest.jsx b/components/PostFollowupRequest.jsx index dc024b2..c5764d5 100644 --- a/components/PostFollowupRequest.jsx +++ b/components/PostFollowupRequest.jsx @@ -17,7 +17,6 @@ function PostFollowupRequest({ sourceId = null }) { const [selectedAllocationId, setSelectedAllocationId] = useState(null); const [filteredAllocationList, setFilteredAllocationList] = useState([]); - const [settingFilteredList, setSettingFilteredList] = useState(false); const [requestType, setRequestType] = useState("triggered"); useEffect(() => { @@ -84,7 +83,6 @@ function PostFollowupRequest({ sourceId = null }) { // instrument form params with a non null formSchema useEffect(() => { async function filterAllocations() { - setSettingFilteredList(true); if (requestType === "triggered") { const filtered = (allocationList || []).filter( (allocation) => @@ -107,18 +105,16 @@ function PostFollowupRequest({ sourceId = null }) { ); setFilteredAllocationList(filtered); } - setSettingFilteredList(false); } if ( allocationList !== null && allocationList.length > 0 && instrumentForms !== null && - Object.keys(instrumentForms).length > 0 && - settingFilteredList === false + Object.keys(instrumentForms).length > 0 ) { filterAllocations(); } - }, [allocationList, instrumentForms, settingFilteredList, requestType]); + }, [allocationList, instrumentForms, requestType]); useEffect(() => { if ( diff --git a/components/utils/notifications.native.js b/components/utils/notifications.native.js index 10e811e..8eadb32 100644 --- a/components/utils/notifications.native.js +++ b/components/utils/notifications.native.js @@ -44,7 +44,7 @@ async function registerForPushNotificationsAsync() { alert("Must use physical device for Push Notifications"); } - return token.data; + return token?.data; } export { Notifications, registerForPushNotificationsAsync };