Socket
Socket
Sign inDemoInstall

react-native-widget-bridge

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-widget-bridge

A bridge between JS thread and native widget, initially created for sharing data and communication with ios 14 widget


Version published
Maintainers
1
Created

Readme

Source

react-native-widget-bridge

A bridge between JS thread and native widget, initially created for sharing data and communication with ios 14 widget

Currently, it's support ios 14 Android will be supported soon

Installation

npm install react-native-widget-bridge

Usage

import WidgetBridge from "react-native-widget-bridge";

const result = await WidgetBridge.multiply(3, 7);

# Always ensure that suite was ready to read/write before interact with it
const success: Bool = WidgetBridge.ensureUserDefaultsSuit("group.my.exampe.com");

# If suite was read, write to UserDefaults suite
const success: Bool = WidgetBridge.setDict("MyDictA", {a: 1, b:2, foo: "bar"});
const success: Bool = WidgetBridge.setString("MyStringB", "This is a test string");

const dict: object = WidgetBridge.getDict("MyDictA");
const str: String = WidgetBridge.setString("MyStringB");

# Reload widget timeline after your's UserDefaults data was changed
const myWidgetKind = "my_widget"
WidgetBridge.reloadWidget(myWidgetKind)

You can get the myWidgetKind by looking into your widget entry file:

@main
struct my_widget: Widget {
   let kind: String = "my_widget"
   ...
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Last updated on 18 Nov 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc