discussions-and-proposals icon indicating copy to clipboard operation
discussions-and-proposals copied to clipboard

Add support for iOS 14/Android Homescreen Widgets

Open mrousavy opened this issue 4 years ago • 5 comments

Introduction

Yesterday (June 22nd) Apple held it's yearly WWDC. They announced Widgets for the Homescreen, which can display small amount of information about your app. The photos app for example, shows recently added photos. Wheather app shows current wheather. Android had this concept of Widgets for a long time now, so I'd assume it would make sense for a unified way of creating widgets using React Native.

Details

Apple has a good documentation on Widgets here, and the Android docs can be found here. They are both similarily structured, which makes a cross-platform approach pretty logical.

It would make sense to create a React Native Component which is very lightweight (memory limit?) to run for the widget, since all of the business logic is in the JS codebase anyways. When creating a Widget natively, you have to re-implement most of your business logic such as datafetching, etc. (or don't use React Native).

Discussion points

  • Should React Native support things other than the immediate app itself? The "Today's View" Widgets are not supported by React Native either, there's a separate library for this. (Which only supports iOS)
  • Is it too much effort?
  • Does it clutter up the codebase?
  • Is there enough demand?
  • Are we going to run out of memory if using JS + React in a small widget?

mrousavy avatar Jun 23 '20 08:06 mrousavy

Not sure how nobody else is discussing this atm, but here is my take:

My simple take on this is that for me RN is a platform and should be able to take care of all suitable features and functions (and therefore also widgets on iOS) of the underlying system.

Besides, the demand for this will be probably just huge. At some point, RN will have to bend to that will anyway, I guess. Better earlier, than later, so we can onboard new developers looking to build an app utilizing widgets + not lose developers who think they need widgets, but RN is just not an alternative.

mxmzb avatar Jul 18 '20 21:07 mxmzb

Even though those are valid reasons, we probably won't see this feature in react native core. There will be a library (maybe by react-native-community) to do this because of the "lean core" concept.

mrousavy avatar Jul 18 '20 21:07 mrousavy

Even though those are valid reasons, we probably won't see this feature in react native core. There will be a library (maybe by react-native-community) to do this because of the "lean core" concept.

Yeah, that totally makes sense. I didn't mean it has to be done in the core, either. @react-native-community scope is perfect IMHO

mxmzb avatar Jul 18 '20 22:07 mxmzb

Hello @mxmzb and @mrousavy react-native-community is not going to be responsible to maintaining core libraries anymore you can see details here: https://github.com/react-native-community/discussions-and-proposals/pull/274

Any additional feature outside of react-native core, expect to take it on yourself to build out to support. There is an example for AppClip, there are tutorials on Android Home Screen widgets

safaiyeh avatar Sep 15 '20 15:09 safaiyeh

Weak tutorial. Hard steps. No way to go to app when widget clicked.

copperfox777 avatar Dec 12 '20 20:12 copperfox777