79355776

Date: 2025-01-14 17:06:30
Score: 0.5
Natty:
Report link

For me, router.push({}) pushed a copy of the previous screen onto the stack. Mirroring the react-navigation docs linked by @love li studios, the answer was to use router.dismissTo()

Screen receiving data


import { useLocalSearchParams } from "expo-router";

...

  const params = useLocalSearchParams();

  useEffect(() => {
    if (params?.selection) {
      setSelectedCategory(params.selection);
    }
  }, [params]);

...

Modal sending data

import { router } from "expo-router";

...

router.dismissTo({
      pathname: "(app)/Energy",
      params: {
        selection: "My Selection",
      },
    });

...
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @love
  • Low reputation (0.5):
Posted by: Niko Dunk