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

setting a state #48

Closed Micro-Prog closed 10 months ago

Micro-Prog commented 10 months ago

hello, i want to use this library for my app,

i want to set a state whenever a button or a span is clicked on the widget and use that state on other components

what is the solution for this? i have tried so much but didn't come up with an idea.

the state is handled by redux

sAleksovski commented 10 months ago

You cannot use the same state from redux as in the app.

Look at the widget as a separate app.

What you can do is persist some value in the widget and read in the app, and vice versa.

Look at the counter widget demo to see how you can persist some state and read it in the app.

You can use AsyncStorage, files, database... anything you like.

Micro-Prog commented 10 months ago

Thank you, I believe it will help,