Popper-core: Support react-native?

Created on 21 Jul 2017  ·  7Comments  ·  Source: popperjs/popper-core

Hi,

This is just a simple question.

Is there any react-native wrapper, or would it be possible to create? (ie can the .API be used without any DOM dependencies, just for computing positions?)

# QUESTION ❔

Most helpful comment

Quoting from #617:

Also, secret wish, make PopperJS compatible with react-native 🤭Ideally if we keep a good separation between DOM utilities and the rest, we should be able to write react-native specific utilities to replace the DOM ones. And reuse all the rest of the library

What's the current state of react-native compatibility?
Related: #357 (@slorber)

Are there any thoughts on how Popper could be implemented in React Native? (cc: @brunolemos)

All 7 comments

I doubt it could work because the lib uses DOM APIs to get the element's positions, AFAIK React Native doesn't provide the same APIs for its elements.

Would the logic be compatible if we provided raw positions of elements that are already extracted from native elements? For example the mobile screen dimensions and the browser window dimensions are quite the same.

What if we provided dimensions of the target, and of the popper and the container boundaries, instead of providing the DOM elements themselves? (there's a "onLayout" callback firing on react-native elements to trigger re-renders)

right now you can pass a DOM-compatible object as reference element and have Popper.js work just fine with it.

More work should be done to allow to replace all the DOM nodes used, and there would be additional work needed to make the various "getParentNode()" methods and so on work...

I see

Was just wondering now, but may try this on react native in the future

Quoting from #617:

Also, secret wish, make PopperJS compatible with react-native 🤭Ideally if we keep a good separation between DOM utilities and the rest, we should be able to write react-native specific utilities to replace the DOM ones. And reuse all the rest of the library

What's the current state of react-native compatibility?
Related: #357 (@slorber)

Are there any thoughts on how Popper could be implemented in React Native? (cc: @brunolemos)

Would love to see support for this.
@nandorojo do you have some current solution for supporting popovers in reactnative+web?

We've made some progress here: https://github.com/SteffeyDev/react-native-popover-view/issues/82

Any help testing/fixing that would be useful.

Was this page helpful?
0 / 5 - 0 ratings