React Native automatic Logout

I have to implement automatic logout after inactivity for my customer in a react native app.
I’ve tried to react to AppState change event, but then I land in an infinite authenticate/clearsession cycle. Then I’ve tried to use setInterval with similar result.

Do you maybe have a standard approach?
Which approach should I take?