react-native-router-flux navigates to default when a system dialog pops up in iOS

Created on 20 Feb 2019  路  6Comments  路  Source: aksonov/react-native-router-flux

Version

Expected behaviour

The user will stay on the current route (scene) when a system dialog pops up.

Actual behaviour

When a user accesses some features for the first time, like the camera, iOS will pop up a system dialog asking for permission to use the resource. When that dialog pops up, react-native-router-flux navigates to the default route. This is, of course, not desired.

Most helpful comment

@MosesEsan @kamleshsindhal08 - I found a workaround. The problem is that the router component gets re-rendered, right? So in your router component class add this method:

class RouterComponent extends Component {
...
shouldComponentUpdate() { 
    return false;
} 
...
render() {
        return (
            <Router>
            ...
            </Router>
...

All 6 comments

Damn... This one is dangerous!

Facing the same issue.. even when the keyboard pops up, navigated to the root scene!

@handoff Did you find a solution for this?

Facing the same issue, any solution for both android and IOS

@MosesEsan @kamleshsindhal08 - I found a workaround. The problem is that the router component gets re-rendered, right? So in your router component class add this method:

class RouterComponent extends Component {
...
shouldComponentUpdate() { 
    return false;
} 
...
render() {
        return (
            <Router>
            ...
            </Router>
...

@MosesEsan @kamleshsindhal08 - I found a workaround. The problem is that the router component gets re-rendered, right? So in your router component class add this method:

class RouterComponent extends Component {
...
shouldComponentUpdate() { 
    return false;
} 
...
render() {
        return (
            <Router>
            ...
            </Router>
...

Many thanks. After two days of efforts, this solved the issue. Phew!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fgrs picture fgrs  路  3Comments

GCour picture GCour  路  3Comments

kirankalyan5 picture kirankalyan5  路  3Comments

rafaelcorreiapoli picture rafaelcorreiapoli  路  3Comments

xnog picture xnog  路  3Comments