swaplet / react-native-swipe-cards-deck

A swipping cards deck (similar to Tinder)
MIT License
46 stars 19 forks source link

Getting the error this.props.keyExtractor is not a function #2

Closed bozali closed 3 years ago

bozali commented 3 years ago

Hello,

I am new to React Native. If I install and use the react-native-swipe-cards-deck I get the error.

`TypeError: this.props.keyExtractor is not a function. (In 'this.props.keyExtractor(this.state.card)', 'this.props.keyExtractor' is undefined)

This error is located at: in NavigationContainer (created by App) in RCTView (created by View) in View (created by ForwardRef(SafeAreaView)) in ForwardRef(SafeAreaView) (created by App) in App (created by ExpoRoot) in ExpoRoot in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer

Stack trace: node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0 node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch node_modules\regenerator-runtime\runtime.js:293:29 in invoke node_modules\regenerator-runtime\runtime.js:63:36 in tryCatch node_modules\regenerator-runtime\runtime.js:154:27 in invoke node_modules\regenerator-runtime\runtime.js:164:18 in PromiseImpl.resolve.then$argument_0 node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0 node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in guard$argument_0 node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in guard node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue [native code]:null in flushedQueue [native code]:null in invokeCallbackAndReturnFlushedQueue`

I also used the samples from the github repo.

eyalyoli commented 3 years ago

You should define a property called keyExtractor which is a function that sets the key for your cards. It is mandatory, I'll update the docs.

Thank you

eyalyoli commented 3 years ago

Updated docs