sAleksovski / react-native-android-widget

Build Android Widgets with React Native
https://sAleksovski.github.io/react-native-android-widget/
MIT License
578 stars 22 forks source link

Update on orientation change #90

Closed polasymbiose closed 3 months ago

polasymbiose commented 4 months ago

Hi,

Widgets dont seem to update dimensions on orientation change. I have tried with width: 'match_parent' and flex: 1 on the parent FlexWidget.

For example, when i add a simple Container with a border on tablet landscape and turn to portrait, the borders are cut.

<FlexWidget style={{ height: 'match_parent', width: 'match_parent', borderWidth: 1, }} />

Bildschirmfoto 2024-05-31 um 08 33 36 Bildschirmfoto 2024-05-31 um 08 33 44

Any proposals how to handle this?

sAleksovski commented 3 months ago

As far as I know this is not possible to achieve by using this library. Android does not call any method in the AppWidgetProvider on screen rotation, so there is no way for us to listen to orientation changes. Other apps can achieve this because they use different layout for landscape and portrait mode, but still no method is called.

This is similar to #36

I'll close this since it is not possible (or I couldn't find a way), but feel free to reopen it if you find a way and I can try to implement it.