Skip to content

setState warning when calling a new route with type reset from componentDidMount #498

@reyalpsirc

Description

@reyalpsirc

Version

  • react-native-router-flux v3.2.8
  • react-native v0.22.2

Expected behaviour

Go from a SplashScreen page to the Home page without setState warnings

Actual behaviour

It reset's the stack but also generates the warning 3 times.
If I go to the Home page without using reset (so a normal push is done), it works well.

### Steps to reproduce - Setup the main js file with the following router data:
    <Router>
        <Scene key="root">
            <Scene key="splashscreen" component={Splashscreen} initial={true} hideNavBar={true}/>
            <Scene key="home" component={Home}/>
        </Scene>
    </Router>
  • Create the splashscreen component with the following code:
    export default class Splashscreen extends Component {
        componentDidMount(){
            Actions.home({type: "reset"});
        }
        render() {
            return (
                <View></View>
            );
        }
    }
  • Create a home component with dummy render.

Extra info

  • If the Splashscreen code uses a setTimeout function for calling Actions.home({type: "reset"});, then it works fine.
  • This happens to me while developing a react-native app with Parse server (running on localhost) once checking for an existing logged user on startup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions