diff --git a/app/segments/drill/[id]/submission/input.js b/app/segments/drill/[id]/submission/input.js index 204908c4..afee1c9e 100644 --- a/app/segments/drill/[id]/submission/input.js +++ b/app/segments/drill/[id]/submission/input.js @@ -418,7 +418,7 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) { { - descriptionModalRef.current ?.present(); + descriptionModalRef.current?.present(); }} color={"#F24E1E"} /> @@ -468,7 +468,7 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) { icon={getIconByKey(item.id)} prompt={item.prompt} distanceMeasure={item.distanceMeasure} - inputValue={inputValues[displayedShot] ?.[item.id] || ""} + inputValue={inputValues[displayedShot]?.[item.id] || ""} onInputChange={(newText) => { handleInputChange(item.id, newText); }} @@ -573,7 +573,7 @@ export default function Input({ drillInfo, setToggleResult, setOutputData }) { { - navModalRef.current ?.present(); + navModalRef.current?.present(); }} > View all shots diff --git a/babel.config.js b/babel.config.js index d3fd24ad..0c705bff 100644 --- a/babel.config.js +++ b/babel.config.js @@ -3,7 +3,16 @@ module.exports = function (api) { return { presets: ["babel-preset-expo", "module:metro-react-native-babel-preset"], plugins: [ + // Fix issues with test login script (yarn test), and build cache + // Reference: https://github.com/expo/router/issues/41#issuecomment-1657674119 + [ + "transform-inline-environment-variables", + { + include: ["EXPO_ROUTER_APP_ROOT"], + }, + ], require.resolve("expo-router/babel"), + "@babel/plugin-transform-export-namespace-from", "react-native-paper/babel", "react-native-reanimated/plugin", [ diff --git a/context/Auth.js b/context/Auth.js index b6b8bac0..5af5d67a 100644 --- a/context/Auth.js +++ b/context/Auth.js @@ -46,17 +46,20 @@ export const AuthProvider = ({ children }) => { //if this code is not in here, it'll run for infinite times onAuthStateChanged(auth, (currentUserId) => { console.log("user changed"); - if (currentUserId) { - setCurrentUserId(currentUserId.uid ?? "Error (uid)"); + + // test user login (yarn test) + // If you sign out, reload app to sign back in as test user + if (process.env.EXPO_PUBLIC_TEST_UID) { + setCurrentUserId(process.env.EXPO_PUBLIC_TEST_UID); } - }); - // yarn test - // If you sign out, reload app to sign back in as test user - // Moved outside of useEffect to avoid race condition with logout - if (process.env.EXPO_PUBLIC_TEST_UID) { - setCurrentUserId(process.env.EXPO_PUBLIC_TEST_UID); - } + // regular user login + else { + if (currentUserId) { + setCurrentUserId(currentUserId.uid ?? "Error (uid)"); + } + } + }); }, []); return (