Error when switching screens with REPLACE PAGE

Hello @Mevi , can you give me a light?

I have a button on all of my app pages, which is meant to, on click, use the REPLACE PAGE component to go to my app homepage.

I’m getting the following error:

And below is the logic I implemented:

Can you help me find out what is causing the error? My app is already on the Play Store and I need to fix it to send a new update version.

Gratitude!

Did you try taking everything out except Replace Page? See if the Stop Audio flow is interfering somehow?

1 Like

I just implemented the STOP AUDIO component on opening the homepage.

I’ll leave now on the other pages, when I click on the icon, just the REPLACE PAGE component to see what happens.

Thanks for the tip.

Okay, I did the implementation, but I keep getting the same error.

Hmm so you have checked that the replace page flow function is configured correctly wherever you’re clicking it (that the page it’s trying to replace exists etc)? Testing in a plain app replace page seems to work ok. Have you checked if this only on one device/platform, e.g. does this also happen in web? Please also check that your preview app is updated to the latest version.

1 Like

@Mevi, thanks so much for the help. Really worth it!

I did the procedures you recommended @Mevi

The page I’m trying to replace exists, it’s correct. The application has 8 pages and another 9 page where I just put the WebView component, following the recommendation I found here on the Forum, in order to avoid compilation problems.

On all pages (except the main one), the component has the same functionality (go to the home page), so on all the logic and commands are the same. Even so, I double-checked every page because I noticed that on occasions, when we simply copy a component from one page and paste it on another, sometimes the address (ID) gets lost and so we need to reconfigure it. I did this on every page.

I tested it on other devices that I have available here with me (all Android only): the same happens on all of them.

I have no way to test it on IOS and I haven’t tested it on the Web yet.

I chose to leave the application as UNPUBLISHED on the Google store until I was able to solve and update.

I believe it must be some crazy logic I implemented that could be causing the error.

I took a test here just now, before I received your answer and I will give you my goals with this app. If I’m wrong, can you please give me a “pull your ear” lol

My idea with this app is to help people pray the Rosary. I have 7 MP3 files that I recorded with my wife, each with a prayer for a day of the week.

Upon entering the application I check the day of the week and set a page variable with the URL of the MP3 file of that day, and use the stream function PRELOAD AUDIO FOR PLAYBACK to load the file, assigning it an ID (the same as I use it at the start of the app to STOP the audio).

When the user enters the screen to play the audio from that day, I just use the STAR/RESUME AUDIO PLAYBACK stream function. I do this because I have another button on the same page to Pause the sound.

All other screens in the application are just screens with text and image, without fancy logic.

The main page (where I’m calling), in the PAGE MOUNTED and PAGE FOCUS events, uses the STOP AUDIO PLAYBACK stream function, and I have a button that refers back to that page using the REPLACE PAGE stream function, which is exactly the one that was giving error.

I removed the option to be able to go back to the home page and left a shortcut to each page in a top menu that I just made.

It’s not exactly what I wanted, but it’s working. I just don’t have the functionality to go back to the main screen of the application anymore because if I put it on, it gives the error, and I believe it may be related to the STOP AUDIO PLAYBACK stream function that I told you about. I did a little test and removed it from the main screen… the error disappeared.

Hmmm… Have you tried putting a delay before the stop audio playback function? E.g. add a 500ms or 1s delay and see if that stops it from crashing. Then if it does, you can try to shorten the delay to 100ms or 10ms so it’s basically unnoticeable, if that would help you :slight_smile:

1 Like

I am very grateful for your help. Immense gratitude!

I did what you recommended. It worked out. I don’t know how to explain the logic behind such a procedure, but the truth is that it worked. So far it hasn’t crashed and it hasn’t given the error again.

At this point, the application is already updated on the Google store (Play Store), with these modifications that you suggested.

I started with a delay of 1s, it worked.

I lowered the delay to 500ms, it still works.

I implemented it with a delay of 100ms and it still worked. I didn’t test with lower values ​​and left it that way.

But… I still can’t understand the logic behind such a procedure. But it doesn’t matter… It’s working, it’s not showing an error and that’s what matters.

thank you so much for helping @Mevi

My limited understanding is that React Native is sometimes picky with page being ready/visible when certain logic is run on it, which is why the delays work, I think. I’m sure there’s plenty of discussion about it in React Native circles :thinking:

1 Like