I have a function fundBalance action function get called and inside of this function there and api call and after the api call resolved and i call the handleFundBalanceSuccess this error happens "Actions must be plain objects. Use custom middleware for async actions. React native"
export function fundBalance(navigation) {
return async (dispatch) => {
dispatch({
type: Fund_Balance_START
})
let response = await api.Fund_Balance(),
responseJson = await response.json();
if(response.status == 200){
dispatch(handleFundBalanceSuccess(responseJson, navigation, dispatch)) // this line return Actions must be plain objects. Use custom middleware for async actions
}
}
}
and the handleFundBalanceSuccess
handleFundBalanceSuccess = (response, navigation, dispatch) => {
dispatch({
type: Fund_Balance_SUCESS,
})
navigation.navigate('MessageScreen', {
title: 'Success',
description: response.status,
doneClick: this.fundBalanceOrCashOutSuccessAction.bind(this, navigation),
})
}