facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
118.75k stars 24.29k forks source link

Problems with debugger + react-native-router-flux #10532

Closed kaizenlabs closed 7 years ago

kaizenlabs commented 7 years ago

Description

You can't even use the debugger when trying to authenticate a user (async) and see the console output.

I expected to be able to navigate through the app with the debugger turned on, authentication to Firebase still works but any call to Actions.YOUR_SCENE() doesn't work with react-native-router-flux.

Reproduction

`

        <Scene key="auth">
            <Scene key="login" component={LoginForm} title="Welcome!" titleStyle={navTitle}/>
            </Scene>

        <Scene key="main">
            <Scene key="weekView" 
            component={WeekView}
            title="Select A Week Beginning"
            titleStyle={navTitle}
            initial
            />
            <Scene key="employeeList" 
            component={EmployeeList} 
            title="Employees" 
            rightTitle="Add"
            onRight={() => Actions.employeeCreate()}
            titleStyle={navTitle}
            />
            <Scene key="employeeCreate" 
            component={EmployeeCreate} 
            title="Create Employee"
            titleStyle={navTitle}
            />
            <Scene key="employeeEdit" 
            component={EmployeeEdit} 
            title="Edit Employee"
            titleStyle={navTitle}
            />
        </Scene>

    </Router>`
export const loginUser = ({ email, password}) => {
    return (dispatch) => {
        dispatch({ type: LOGIN_USER });
    firebase.auth().signInWithEmailAndPassword(email,password)
      .then((user) => loginUserSuccess(dispatch, user))
      .catch((error) => {
          console.log(error);
          firebase.auth().createUserWithEmailAndPassword(email,password)
            .then((user) => loginUserSuccess(dispatch, user))
            .catch(() => loginUserFail(dispatch));
        });
    };
};

const loginUserSuccess = (dispatch, user) => {
    dispatch({ type: LOGIN_USER_SUCCESS, payload: user });
    Actions.main();
};

1) Turn on debugger. 2) Try to navigate through two different scenes. 3) Watch it not work.

Additional Information

lacker commented 7 years ago

Hey, I tried to figure out what problem you are referring to but I think we need more information. Does the problem appear to have anything to do with Firebase at all? Does your app work fine without the debugger? The part that doesn't work, is it the debugger that doesn't work or the navigation that doesn't work?

kaizenlabs commented 7 years ago

The app works perfectly without the debugger turned on, but when the debugger is turned on setTimeout() doesn't work, nor does scene changes. The authentication from firebase is still going through fine are programmed to clear upon successful authentication and then switch the scene. But the form values are clearing and the scene isn't switching, which means the authentication to firebase is still happening without any .catch firing in the console either.

I will post a video to YouTube later tonight and post the link here on the issue so you can see what I mean.

lacker commented 7 years ago

It sounds like the whole Firebase thing is not related to this problem, then. If you have just a plain app with navigation + the debugger does that also break? Or do you only see this problem when you have a confluence of lots of these things together?

kaizenlabs commented 7 years ago

Here's the video...this is 100% debugger related as its affecting native Javascript functions like setTimeout() as well.

https://youtu.be/z-BGj-3Fh-c

lacker commented 7 years ago

What is the simplest app you can reproduce this in?

kaizenlabs commented 7 years ago

Will see what I can do....

inyono commented 7 years ago

I have a similar problem. When I enable remote debugging, our app crashes after a couple of seconds. Removing a setTimeout in one of our component's componentDidMount did fix the problem. I tried to create a simple repository that reproduces the problem but wasn't successful yet.

hramos commented 7 years ago

Closing this issue because it has been inactive for a while. If you think it should still be opened let us know why.

rahulr4 commented 6 years ago

I am getting the same issue. Firebase authentication works fine without debugger on and Actions.main() works too. But in debug mode it does not

SourceCipher commented 6 years ago

For me opposite.. If I turn on the debugger it will work, otherwise there is no reaction whatsoever