title: React Native Stacknavigator, run code before going back
body: <p>Say there are two screens: screenA, screenB; these are managed using StackNavigator.</p>
  
  <p>User clicks on a button in screenA that navigates the user to screenB. ScreenB has a form where they can edit their name, username, and more. I want to make it so that, after the user edits their personal information by editting the default values of TextInput in screenB, the user can just either click the backbutton in the navigation header or swipe left on the screen to return back to screenA. </p>
  
  <p>In that process of returning back to screenA, I want to have a loading circle and not allow the user to return back to A until the the user receives confirmation from the API endpoint that edits the user's personal information that it worked. </p>
  
  <ol>
  <li>User edits information on screenB.</li>
  <li>User tries to navigate back to screenA by either clicking the back button in the header or by swiping right.</li>
  <li>A loading circle appears, indicating that the app has sent a request to the API to edit their information accordingly. The user has not navigated to screenA at this point.</li>
  <li>Request is successful, and the user is taken to screenA.</li>
  </ol>
  
  <p>For me to do this, I need to be able to add some sort of function to the going back navigation that lets me do all this. Does anyone know how I can do this? </p>
  
  <p>NOTE: I've already looked into writing my custom button for the backbutton but that still doesn't solve the problem of swiping right to navigate. </p>