-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ReactLayersMixin
.
#379
Comments
FB layers has so many internal deps that we don't even use them at IG. Instead I suggest we open source the react layers stuff plus the light IG shim. You don't get the nice behaviors but the value for the community lies mostly in the architecture IMO. @yungsters if we redid layers today would we do it any differently (ie I think we could do it with composition)? This could be a nice greenfield opportunity. |
To be honest, I don't know if I would have done anything that differently. The Layer abstraction has held up really well — we have been able to extend it and make improvements over time without much code decay. |
@yungsters yeah Layer is awesome -- what I'm wondering is why we use a mixin rather than composition to hook it up to React. |
I guess I'm not sure what you mean by using composition to hook Layers up to React. Are you asking why we use |
Yeah |
Layers are not inherently anchored to any position in the DOM. For example:
It does not make sense for |
That makes sense, but the return value for renderLayers() is a little confusing (I've never used multiple layers in a component before), and it's not clear at first glance that it follows React's normal data flow. |
When I designed Also, I felt like it was not too painful to have to return a map with one key. Keep in mind that at the time, this was the standard way of passing in children with keys into a React component. |
So I think that if we had frags I wouldn't mind putting the components in the render() method. While it would be kind of weird that it is not anchored to the DOM, if we had frags we would have precedent for components that don't render to anything in that place in the DOM and it would just be 1 paradigm to learn. |
I would not be strongly opposed to that, but I don't think it makes the code easier to read. It makes the following questions harder to answer:
|
I think it's odd to return things in the But even just something as simple as our current |
To be clear we do use ReactLayer and ReactLayeredComponentMixin at IG, just not any of the FB layer behaviors or Layer impl itself (yet), but they are API compatible for FB layers and behaviors by design. I am in favor of bringing all that to open-source, just want to make sure that we think about making any API cleanup before doing it. |
Just spoke with @petehunt. Instead, we will publish a blog post with a rudimentary layer implementation and |
Not sure if this is the best place, but I'd love to see a blog post about this or some sample code! |
@yungsters Any progress on this? |
Closest thing available is http://khan.github.io/react-components/#layered-component |
Thanks @petehunt Can add that I found the discussion of react-bootstrap models and tooltips interesting: react-bootstrap/react-bootstrap#27 |
React Bootstrap has an implementation of this as well: https://github.com/react-bootstrap/react-bootstrap/blob/master/src/OverlayMixin.js |
Hey! The company I work for is in currently in the process of a complete front-end overhaul using React.js and even some Flux Dispatchers and we're trying to move away from jQuery based overlay plugins and popups. We're currently using react-bootstrap's Specifically, we're having a lot of trouble figuring out when it's okay to start positioning/manipulating overlay nodes, esp. because you can't use the ref system for dom nodes not returned by Thanks! |
Hey, so i have created Any feedback would be greatly appreciated! Especially around API learnings from FB or IG implementations. @brainkim i have added some basic examples but over the next couple of days i plan on adding a example showing positioning/manipulating, maybe tooltips or a draggable popup. |
@pieterv Great! Will take a look at it and get back to you! |
@yungsters any update on the blog post? :) |
@mziemer21 the modern solution is something like react-portal. |
Yea. We actually codemodded the mixin away just a month ago, and removed the distinction between |
I've spent some sensible time to research on this. As a result I end up with the library which permanently solved this problem for me. Check out, please, would be good to know the impressions and everything https://github.com/AlexeyFrolov/react-layer-stack |
I really like our
ReactLayersMixin
plugin and we should open source it. It allows us to implement not just therender
function, but also therenderLayers
function. Therender
is the same as its always been (describe your structure at any point in time. TherenderLayers
API allows you to describe your modal layers at any point in time. So that means you can open and close layers as a function ofprops
/state
just like yourrender()
function can "react" toprops
/state
.Assigning to @yungsters who mastered the React/Layers stuff on FB's stack, but @petehunt also has great experience using and building out layers integration with React. So whoever has time/need.
The text was updated successfully, but these errors were encountered: