I am having a lot of fun with this test, in fact I am almost done but I am missing just one small piece:
I get a notification callback on my code, however I am struggling to reload the view on my Android component @ReactProp(name = "data")
. The view just gets redrawed when user interacts with the screen
The most funny thing is that this is not happening if I pass an static array instead of this.state.photos
I am calling this.setState({photos: photoArray}) after API responds as per design guidelines in React Docs, and receiving this update in my android react component, but the component is not reloading until user interacts
const photoArray = data.map((photo) => {
const num = Math.random();
// 30% chance of rendering the HD version
if (num < 0.3) {
return photo.hdurl;
} else {
return photo.url;
}
});
//TODO: why is component calling setchange but not reloading??
this.setState({photos: photoArray});
For the moment I am just displaying a toast when call back is received in android component: