Closed
Description
Motivation
We have brownfield apps with existing storage solutions that we want our React Native components to take advantage of. For example, one of our apps use PINCache to control lifetime of the stored data and the size of the disk cache.
Description
Before I start implementing on this, I'd like to run you by my solution and get some feedback on whether I'm on the correct path.
In RNCAsyncStorage
, we add a delegate @property
, e.g.:
@property (nonatomic, weak, nullable) id<RNCAsyncStorageDelegate> delegate;
For every RCT_EXPORT_METHOD
, we call the delegate if it's set, otherwise we do the normal operations.
Consumers can then set the delegate like so:
RNCAsyncStorage *asyncStorage = [bridge moduleForClass:[RNCAsyncStorage class]];
asyncStorage.delegate = self;
Let me know what you think.
Thanks.