TypeError: Cannot read properties of undefined (reading 'fetch') [react-native-ssl-pinning]

614 views Asked by At

I am building a react native mobile application and I want to implement SSL pinning using react-native-ssl-pinning.

I've installed all the necessary things and I also imported fetch method:

import {fetch} from 'react-native-ssl-pinning';

This is how I am calling fetch method:

fetch("https://xxx.xxx.xxx.xx/api/account/my_account/", {
  method: "GET",
  headers: {
    Authorization: "Bearer " + token,
    Accept: "application/json; charset=utf-8",
    "Access-Control-Allow-Origin": "*",
    e_platform: "mobile",
  },
  sslPinning: {
    certs: ["mycert"],
  },
})
  .then((response) => response.json())
  .then((responseJson) => {
    console.log(responseJson);
  })
  .catch((error) => {
    console.log(error);
  });

After I run the application I get this error:

error image

Did someone have the same problem, or do you have some solution for this?

Thanks a lot.

0

There are 0 answers