Skip to content

pafry7/react-native-widget-sync

Repository files navigation

The development of the npm module has been temporarily postponed.

react-native-widget-sync

The module allows refreshing and sharing of data between the main application and the widget.

Usage in expo managed project

See https://github.com/pafry7/widget-expo-example

Setup

  1. Clone repo
git clone git@github.com:pafry7/react-native-widget-sync.git
  1. Install dependencies
cd react-native-widget-sync 
yarn
cd example
yarn
  1. Configure expo plugin in /example Add in app.json
 "ios": {
     ...
      "entitlements": {
        "appGroupIdentifier": <app group>
      },
 },
 "plugins": {
   [
        "react-native-widget-sync",
        {
          "widgetName": <Your widget name>
          "ios": {
            "devTeamId": <Your apple team identifier>
            "appGroupIdentifier": <app group>"
          }
        }
      ],
 }

Running the example

Run

npx expo prebuild

and then

npx expo run:[ios|android]

How does it work

When you run expo prebuild for the first time, it generates a folder containing the source files for widgets and then copies them to both the ios and android directories. Remember to run prebuild each time you make changes to the widget's source files.

Video

Screen.Recording.2023-09-11.at.18.10.05.mov

Sources