sushinpv / react-secure-storage

This is a wrapper written above local storage to write the data securely to local storage
https://npmjs.com/package/react-secure-storage
MIT License
126 stars 12 forks source link

TypeError: Cannot read property 'colorDepth' of undefined, js engine: hermes #15

Closed agieocean closed 1 year ago

agieocean commented 1 year ago

Version: "react-secure-storage": "^1.1.0" "react-native": "0.71.3"

Expected behavior: set and get two values

Actual behavior:

 ERROR  TypeError: Cannot read property 'colorDepth' of undefined, js engine: hermes

Code:

useEffect(() => {
        secureLocalStorage.setItem("acccess_token", response.data.access);
        secureLocalStorage.setItem("refresh-token", response.data.refresh);
        let value = secureLocalStorage.getItem("access-token");
        alert(value);
      }, []);
agieocean commented 1 year ago

Actually this error is coming from the line import secureLocalStorage from "react-secure-storage"

sushinpv commented 1 year ago

Hi @agieocean, I think you are using this library on react-native, This library is designed for web not for native mobile.

You can use SecureStore Library for react native, Please find more information here https://docs.expo.dev/versions/latest/sdk/securestore/