ldn0x7dc / react-native-gallery

A pure JavaScript image gallery component for react-native apps with common gestures like pan, pinch and doubleTap, supporting both iOS and Android.
331 stars 116 forks source link

Error cannot read property "onResponderGrant" of undefined #5

Open admc opened 8 years ago

admc commented 8 years ago

First image in gallery displays correctly, clicking on it yields the following, tried older versions, and different images, wrapping it in a View, etc and nothing seems to make a difference. Any ideas?

screen shot 2016-07-11 at 9 15 38 pm
"react": "^15.2.1",
"react-native": "^0.29.0",
"react-native-gallery": "0.0.15",

render() { return (
<Gallery style={{flex: 1, backgroundColor: 'black'}} images={[ 'http://p10.qhimg.com/t019e9cf51692f735be.jpg', 'http://ww2.sinaimg.cn/mw690/714a59a7tw1dxqkkg0cwlj.jpg', 'http://www.bz55.com/uploads/allimg/150122/139-150122145421.jpg' ]} /> ) } }

ldn0x7dc commented 8 years ago

@admc Sorry to say that I cannot reproduce the error above with same react-native version. But this could be a similar problem with the one mentioned in the pull request. Pls try editting your Gallery.js in your node_modules folder (follow the pull request, just some lines changed) and see if it works.

admc commented 8 years ago

It did render more of a matrix of images, however I still receive the same error unfortunately. I wish I knew better how to help debug this issue :(

ldn0x7dc commented 8 years ago

@admc I'm looking into it. Problem is I can not reproduce this error, so it's troublesome. If you are not testing using the Demo project, maybe you could post more code here. It may help~

nickrobinson352 commented 7 years ago

I am having the same issue

mjebrini commented 7 years ago

The issue appears only on Android if the Gallery has more than 50 images, setting initialPage to > 11 will always lead to show the image #11 and scrolling will crash the all with the following error:

undefined is not an object (evaluating '_this2.getCurrentImageTransformer().onResponderGrant')
onStart
    Gallery.js:112
activeImageResponder
    Gallery.js:146
onResponderGrant
    Gallery.js:61
onResponderGrant
    createResponder.js:189
executeDirectDispatch
    EventPluginUtils.js:176
setResponderAndExtractTransfer
    ResponderEventPlugin.js:344
extractEvents
    ResponderEventPlugin.js:444
extractEvents
    EventPluginHub.js:196
handleTopLevel
    ReactEventEmitterMixin.js:28
<unknown>
    ReactNativeEventEmitter.js:125
perform
    Transaction.js:138
batchedUpdates
    ReactDefaultBatchingStrategy.js:63
batchedUpdates
    ReactUpdates.js:98
_receiveRootNodeIDEvent
    ReactNativeEventEmitter.js:124
receiveTouches
    ReactNativeEventEmitter.js:186
__callFunction
    MessageQueue.js:228
<unknown>
    MessageQueue.js:105
guard
    MessageQueue.js:44
callFunctionReturnFlushedQueue
    MessageQueue.js:104
mjebrini commented 7 years ago

Got to find a solution for this:

This is related to a bug in the ListView in ViewPager where ListView initialListSize={initialListSize} should be set to the number of images in your Gallery.

check here for full solution