In this context API is just a web server that returns JSON instead of rendering an HTML view. If you build Flask application to do that you can then read that data to your react front end using fetch or some other async tool. In this model, you would put your heavy algorithms on the server and just call them from UI action to be ran and then returned results in the mobile rendered by react-native.
Where are you planning to put those heavy algorithms? If on server side sure use Python if you want them on the actual client devise just write a native app, it will much easier. How would you use firebase for this especially with Python? Hook Firebase up with Google Cloud functions & some database then use firebase to serve results to mobile. Sounds unnecessary complex.
Here is an example tutorial how to use Flask to build the backend API if that is what you want to do. https://testdriven.io/part-one-intro
Note this is for React not React-Native so there are some differences how to fetch data.