sAleksovski / react-native-android-widget

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

listing data displays with api call #94

Closed abrar0123 closed 2 weeks ago

abrar0123 commented 2 weeks ago

i want to displays listing with api data in react native but not be able , how to displays api data listing

sAleksovski commented 2 weeks ago

Define "not able".

What have you tried?

Please provide a minimal app reproducing the issue.

abrar0123 commented 2 weeks ago

1-in react native widget now displays list static data in widgets 2- i want to display the dynamic list data by api calls , api call is correct and also receive data but issue is that not apply logic of react like usestate , useeffects , here is screenshots i was use in here : image and get error here : image so i try to get di this with another method and i am able to call api data and get list data but when i am when i want to displays my list nothing will displays on when i add widget

@sAleksovski please look and give me solution

sAleksovski commented 2 weeks ago

Please read the docs.

https://saleksovski.github.io/react-native-android-widget/docs/tutorial/widget-design

One of the first things there is that you cannot use hooks inside the widget.

Fetch the data outside the widget in the widget-task-handler and pass it to the widget as a prop.

abrar0123 commented 2 weeks ago

okey i understane but still one problem i get that it takes so much time to load widget with static or dynamic list mapping due so how manage this . @sAleksovski

sAleksovski commented 2 weeks ago

I guess the speed depends on the number of items, how much it takes to get the data from server, what kind of device you have...

The list widget from the example app is loading fairly quickly.

I'll close this issue since the last question is not related with the original issue.