visuallylab/react-native-use-persist-storage

Setting `sensitive: true` yields type error

LaneRamp opened this issue · 1 comments

Hey there,

I don't know the best way to help debug this, but I have found on my end that this does not work as expected:

const [userData, setUserData, userIsReady] = usePersistStorage(
    USER_PERSISTENCE_KEY,
    () => {
      user: null;
    }, //default value
    {
      version: USER_PERSISTENCE_VERSION,
      persist: true,
      sensitive: true,
    }
  );

if I remove sensitive: true, no error is raised, so it must be that setting it to use sensitive storage causes:

JSON value '1' of type NSNumber cannot be converted to NSDictionary

+[RCTConvert NSDictionary:]
    RCTConvert.m:58
__41-[RCTModuleMethod processMethodSignature]_block_invoke_16
-[RCTModuleMethod invokeWithBridge:module:arguments:]
facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&)
facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const
invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_lane_serial_drain
_dispatch_lane_invoke
_dispatch_workloop_worker_thread
_pthread_wqthread
start_wqthread

I have "react-native-sensitive-info": "^5.5.8" and the pod is installed. resetting the npm cache and rebuilding the app has no effect.

Is there any more information I can give to help figure out what I'm doing wrong, or whether this is a bug?

Hey @LaneRamp ,

The sensitive should pass false or RNSensitiveInfoOptions , since react-native-sensitive-info need your configs.

You can check here.

Wish it can help you.
If any questions, just never mind to report.
Thanks