JedWatson / react-tappable

Tappable component for React
http://jedwatson.github.io/react-tappable/
MIT License
863 stars 90 forks source link

Support for React 0.14 #45

Closed frederickfogerty closed 9 years ago

frederickfogerty commented 9 years ago

I tried out React 0.14 today but was met with Uncaught TypeError: React.initializeTouchEvents is not a function

Related: https://github.com/zilverline/react-tap-event-plugin/issues/24

slorber commented 9 years ago

React.initializeTouchEvents is removed in 0.14 I think, you should not call it anymore as it has no effect anyway

frederickfogerty commented 9 years ago

you should not call it anymore as it has no effect anyway

Do you have a source for this? @slorber

slorber commented 9 years ago

@frederickfogerty https://github.com/facebook/react/pull/3442

frederickfogerty commented 9 years ago

Thanks, so I can go through and replace Tappables with normal elements again?

slorber commented 9 years ago

No I just say that you can remove your call to React.initializeTouchEvents, as well as React-tappable

You can send a PR so that React-tappable do not call it anymore, it's just this line to remove: https://github.com/JedWatson/react-tappable/blob/master/src/Tappable.js#L4

JedWatson commented 9 years ago

I've just pushed an update with that line removed, thanks @slorber.

frederickfogerty commented 9 years ago

@JedWatson 0.14 has not been released yet, I'm not sure I endorse this change. If there was a way to conditionally call initializeTouchEvents depending on the react version, I think that'd be better.

JedWatson commented 9 years ago

@frederickfogerty based on my research:

initializeTouchEvents was required in React 0.11, which was the current version when react-tappable was developed initially. It doesn't seem to have been required since 0.12, and touch events work just fine in 0.13 without it. The function has been removed in 0.14.

We could wrap initializeTouchEvents in a try { ... } catch(e) { ... } statement (arguably better than a React version check) but given react-tappable doesn't support 0.11 anyway, I figured it's safe just to remove.

This is all based on my interpretation of the related issues in facebook/react so if I'm wrong, I'm happy to reinstate it with the try/catch for 0.14 compatibility.

frederickfogerty commented 9 years ago

Oh, apologies, I didn't realise it didn't do anything on 0.13 (or even 0.12). In that case, looks fine to me, thanks for the update!