souporserious/react-measure

react-native support

Opened this issue · 3 comments

reference: https://twitter.com/souporserious/status/1026811462721794048

I had no prior experience with RN as well and people were asking, but turned out it wasn't so hard eventually. create-react-native-app has an emulator out of the box. For react-spring i distribute a web builds (which is the default) and RN under /dist/native https://github.com/drcmda/react-spring/blob/master/rollup.config.js maybe it helps. From what you've said on Twitter, would onLayout be enough to fulfill react-meaure's requirements?

This should be easier to do in V3 and I think the API can be the same. I'll play around with it this week and report back.

Hey @souporserious, by any chance has there been any progress made on this? I'm currently using react-measure in a module that is used by both a web and native environment and am finding myself having to polyfill on native due to a type error ("node.getBoundingClientRect is not a function" via getContentRect) being thrown since 2.2.6. I'm using react-native v0.58.5.

I haven't had a chance to look at this, but if you have any ideas here I would gladly accept a PR! I'm hoping we could have a similar API to either the current version or the V3 branch that points to a react-native specific export.