title: in order to be iterable non-array objects must have a symbol.iterator () method react native
body: <p><strong>Problem:</strong></p>
  
  <p>In my React native application, I have created redux-thunk action to access the user's current location. But when Running it give me this error called in order to be iterable non-array objects must have a symbol.iterator () method. This is how I have wrote my actions.</p>
  
  <pre><code>import Geolocation from 'react-native-geolocation-service';
  export const GET_CURENT_POSITION = 'location/GET_CURENT_POSITION';
  export const GET_CURENT_POSITION_SUCCESS =
    'location/GET_CURENT_POSITION_SUCCESS';
  export const GET_CURENT_POSITION_FAILED = 'location/GET_CURENT_POSITION_FAILED';
  
  const getCurrentPosition = (payload) =&gt; ({
    type: GET_CURENT_POSITION,
    payload,
  });
  
  const getCurrentPositionSuccess = (response) =&gt; ({
    type: GET_CURENT_POSITION_SUCCESS,
    response,
  });
  
  const getCurrentPositionFailed = (response) =&gt; ({
    type: GET_CURENT_POSITION_FAILED,
    response,
  });
  
  const getposition = () =&gt; {
    return (dispatch) =&gt; {
      dispatch(getCurrentPosition({msg: 'startgetting'}));
      return Geolocation.getCurrentPosition(
        (position) =&gt; {
          dispatch(getCurrentPositionSuccess(position));
        },
        (error) =&gt; {
          dispatch(getCurrentPositionFailed(error));
        },
        {enableHighAccuracy: true, timeout: 15000, maximumAge: 10000},
      );
    };
  };
  
  export default {
    getposition: getposition,
  };
  </code></pre>
  
  <p>This is how I have wrote reducers.</p>
  
  <pre><code>import {locationTypes as types} from '_store/actions';
  
  const location = (
    state = {
      hasError: false,
      errorCode: '',
      error: '',
      location: '',
    },
    payload,
  ) =&gt; {
    switch (payload.type) {
      case types.GET_CURENT_POSITION:
        return {
          ...state,
          hasError: false,
          error: '',
          location: '',
        };
      case types.GET_CURENT_POSITION_SUCCESS:
        return {
          ...state,
          hasError: false,
          location: payload,
        };
      case types.GET_CURENT_POSITION_FAILED:
        return {
          ...state,
          hasError: false,
          error: payload,
        };
      default:
        return state;
    }
  };
  
  export default location;
  </code></pre>
  
  <p>This is how I have dispatched the function in connect.</p>
  
  <pre><code>const mapDispatchToProps = (dispatch) =&gt; {
    return {
      createpatient: (patient) =&gt; dispatch(patientActions.createpatient(patient)),
      getposition: () =&gt; dispatch(locationActions.getposition()),
    };
  
  
  };
  </code></pre>
  
  <p>I tried a lot to figure out what is wrong but I was unable to do so. Can someone help me with this problem? Thank you very much.</p>