I had a situation where setTimeout in index.js was causing app to crash, because it couldn't get methods by refs. Once I removed setTimeout I got it working all nicely. So I think it would be awesome to have an option to define if timeouts should be in use.
My change adds a property shouldUseTimeouts and default value is true, so package continues to work the same way as until now, unless you pass in shouldUseTimeouts as false then it fallbacks to my solution for timeouts - not using them.
Below is my situation that I had and managed to resolve via change I submit:
isLoading is a value that I get via redux action and it is true, but becomes false once loading is done. In this situation while loading is happening this.renderLoading() returns <Loader /> element which is my custom spinning loader, once loading is done - value of isLoading changes, rerender happens and then this.renderScreenContent() is in action - this function returns content view that also includes <SortableListView />.
In this scenario - setTimeout in react-native-sortable-listviewindex.js file was causing issues. I was getting this error:
I had a situation where setTimeout in index.js was causing app to crash, because it couldn't get methods by refs. Once I removed setTimeout I got it working all nicely. So I think it would be awesome to have an option to define if timeouts should be in use.
My change adds a property shouldUseTimeouts and default value is true, so package continues to work the same way as until now, unless you pass in shouldUseTimeouts as false then it fallbacks to my solution for timeouts - not using them.
Below is my situation that I had and managed to resolve via change I submit:
isLoading is a value that I get via redux action and it is true, but becomes false once loading is done. In this situation while loading is happening
this.renderLoading()
returns<Loader />
element which is my custom spinning loader, once loading is done - value of isLoading changes, rerender happens and thenthis.renderScreenContent()
is in action - this function returns content view that also includes<SortableListView />
.In this scenario -
setTimeout
inreact-native-sortable-listview
index.js file was causing issues. I was getting this error: