Rewarded Ads logic and debugging
This writing is about how I make some logic to show the correct hint in Sudoku after watching Google AdMob rewarded ads. The project is based on expo bare project with package, react-native-google-mobile-ads. This project was based on below environment. Expo bare project ( npx expo prebuild ) with template TypeScript. expo: 54.0.23 react-native: 0.81.5 react-native-google-mobile-ads: 16.0.0 What I was trying to achieve is that in the hint modal, if I touch the WATCH AD button, it shows rewarded ads from Google AdMob. After watching it, hint modal should be closed automatically and 1 hidden sudoku number should appear in random as a reward. The first challenge that I encounter was that the reward action was not carried out at the first ads watch. From the second ads watch reward action was carried out well, but not the first one. After several trial and error I found that it was because when reward action function was called it referred old status of the function so first reward w...