react-native-sortable-list icon indicating copy to clipboard operation
react-native-sortable-list copied to clipboard

Empty data object gives a container.measure warning

Open siebeprojects opened this issue 6 years ago • 2 comments

Hi,

If I use your example with the cats and I input an empty data object. {} instead of those cat entries then I get a warning this5._container.measure Possible unhandled promise rejection.

The SortableList implementation should work fine right with an empty data object ? Or am I doing something wrong ?

Siebe

Possible Unhandled Promise Rejection (id: 0): TypeError: null is not an object (evaluating '_this5._container.measure') http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:127896:28 tryCallOne@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:19499:16 http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:19600:27 http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:20920:26 _callTimer@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:20809:17 _callImmediatesPass@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:20845:19 callImmediates@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:21064:33 __callImmediates@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:7471:32 http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:7298:34 __guardSafe@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:7455:13 flushedQueue@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:7297:21 flushedQueue@[native code] invokeCallbackAndReturnFlushedQueue@http://localhost:8081/index.android.delta?platform=android&dev=true&minify=false:7290:33 invokeCallbackAndReturnFlushedQueue@[native code]

siebeprojects avatar Jun 14 '18 05:06 siebeprojects

Hi @siebeprojects Can you reproduce a minimal example on https://snack.expo.io/ ?

eriveltonelias avatar Aug 12 '18 13:08 eriveltonelias

this error is related to data passed to <SortableList>, you have to make sure that the data is valid (not undefined, null or empty array), this error mean that at certain instant the data you passed to renderRow props didn't contain valid data, missing or not complete data, it happened to me, the error was that data is ninitialized to an empty array [] and i was testing if data is a falsy value (empty array is not a falsy value),

but i think it is more proper to rise an error instead of a warning

souhaiebtar avatar Apr 23 '19 09:04 souhaiebtar