I currently have a modal that is based on three conditions being met that change a useState boolean through a useEffect hook, like so:
const [displayTraits, setDisplayTraits] = useState(false)
useEffect(() => {
const result = Object.keys(daily).filter(key => keysToCheck.includes(key)).every(key => daily[key].counter > 0);
setDisplayTraits(result);
}, [daily]);
and then I show the modal like so:
<Modal isVisible={ displayTraits} //maybe call isFrontDoorOpen?
onBackdropPress={() => {
setDisplayTraits(false);
}}
onBackButtonPress={() => {
setDisplayTraits(false);
}}
>
Essentially, I think the best idea would be for the useEffect function to be ran only once per day, so that the popup only occurs once per day.
Also, this modal currently shows up on every single page of my app and I just would like it to show on the page that I implemented it. Also, It shows up everytime the app refreshes, is there a way to show it only once per day? Thank you.