Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an iOS Today Widget extension working on React Native

I'm trying to get an iOS Today widget working using React Native components by following the stuff happening on this issue.

I got it to work on the iOS simulator, but it doesn't work on an actual phone.

If anyone can look at this with me, it would be awesome. It is the minimal amount of stuff to getting a Today widget up and running showing a "Hello World" React component.

https://github.com/rclai/React-Native-Today-Widget

like image 624
rclai Avatar asked May 04 '16 16:05

rclai


1 Answers

The memory limit for Today Widget on device is 16 MB. Great explanation is in this talk by Conrad Kramer: https://cocoaheads.tv/memory-use-in-extensions-by-conrad-kramer/

Verified experimentally using XCode debugger - while loading big image, Today Widget crashes as soon as it reaches 16 MB memory usage.

Memory usage of basic React native example with just one Text element is about 11 MB. Up to 13 MB during content rendering.

For running Today Widget on device you have to use Release build configuration. Development mode adds too much overhead. Only possibility to run the widget on device in development mode is using Instruments tool to temporarily disable the limit.

Check this library: https://github.com/matejkriz/react-native-today-widget#memory-limitation

It works on device, you just have to think about the memory limits.

like image 110
Matěj Kříž Avatar answered Oct 20 '22 16:10

Matěj Kříž