简体   繁体   中英

Button only works on double tapping while on remote debugging in react native

The problem is when ever, i use remote debugging i needs to double tap a button in order to execute an redux action. I dont know why its happening, am using firebase inorder to signin with email and password.

My Redux Action:

 export const loginRequest = (email, password) => {
return (dispatch) => {
    dispatch({ type: LOGIN_SPINNER, payload: true })
    firebase.auth().signInWithEmailAndPassword(email, password)
        .then((data) => {
            dispatch({ type: LOGIN_SUCCESS, payload: data })
            NavigationService.navigate('Drawer')
            dispatch({ type: LOGIN_SPINNER, payload: false })
        })
        .catch((error) => {
            dispatch({ type: LOGIN_UNSUCCESS, payload: error.message })
            dispatch({ type: LOGIN_SPINNER, payload: false })
            console.log(error)
        })
  }
}

So from above, one my first tap dispatch({ type: LOGIN_SPINNER, payload: true }) it works ( as i can see actions in remote debugging ) and it stops there itself, and again on second tap the firebase function gets executed and its works.

Where is the problem ? In redux or firebase ? Please guide me through to figure this out !

I also have this problem when developing with React Native.

This is not a problem of redux or firebase, but a minor bug of the react-native debugger. It only happens if you make an api call in debug mode, the result will not be updated unless you tab anywhere on the screen once more after the api call is done.

I don't have a solution to 'fix' that but the delay will not be existed anymore in the released version (or if you disable debug mode) so I think you may just ignore it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM