Skip to content

Allow brownfield apps to handle requests #33

Closed
@tido64

Description

@tido64

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestplatform: iOSThis is iOS specificquestionGeneral question about usage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions