title: response.text is not a function while building react-native app
body: <p>I'm trying to build a react-native app with expo and while trying to sign up I get the following error message stemming from my api.js file:</p>
  
  <p>response.text is not a function. (In 'response.text()', 'response.text' is undefined).</p>
  
  <p>Here is my code:</p>
  
  <pre><code>const BASE_URL = "my local IP:5000";
  
  
  export const api = async (url, method, body = null, headers = {}) =&gt; {
  
  try {
    const endPoint = BASE_URL.concat(url);
    const reqBody = body ? JSON.stringify(body) : null;
  
    const fetchParams = {method, headers};
  
    if((method === "POST" || method === "PUT") &amp;&amp; !reqBody) {
        throw new Error("Request body required");
    }
  
    if(reqBody) {
        fetchParams.headers["Content-type"] = "application/json";
        fetchParams.body = reqBody;
    }
  
    const fetchPromise = fetch(endPoint, fetchParams);
    const timeOutPromise = new Promise((resolve, reject) =&gt; {
        setTimeout(() =&gt; {
            reject("Request Timeout");
        }, 3000);
    });
  
    const response = await Promise.race([fetchPromise, timeOutPromise]);
  
    return response;
  } catch (e) {
    return e;
  }
  }
  
  export const fetchApi = async (url, method, body, statusCode, token = null, loader = false) 
  =&gt; {
  try {
      const headers = {}
      const result = {
          token: null,
          success: false,
          responseBody: null
      };
      if(token) {
          headers["x-auth"] = token;
      }
  
      const response = await api(url, method, body, headers);
  
      console.log(response);
  
      if(response.status === statusCode) {
          result.success = true;
  
          if(response.headers.get("x-auth")) {
              result.token = response.headers.get("x-auth");
          }
  </code></pre>
  
  <p>Here is response.text()</p>
  
  <pre><code>        let responseBody;
          const responseText = await response.text();
          //const responseText = await response.json();
  
          try {
              responseBody = JSON.parse(responseText);
          } catch (e) {
              responseBody = responseText;
          }
  
          result.responseBody = responseBody;
          return result;
  
      }
  </code></pre>
  
  <p>Here is response.text()</p>
  
  <pre><code>    let errorBody;
      const errorText = await response.text();
      //const errorText = await response.json();
  
      try {
          errorBody = JSON.parse(errorText);
      } catch (e) {
          errorBody = errorText;
      }
  
      result.responseBody = errorBody;
  
      console.log(result);
  
      throw result;
  } catch (error) {
      return error;
  }
  }
  </code></pre>
  
  <p>Any help would be immensely appreciated. </p>