-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Portal #43
Comments
As discussed on slack, the portal wrapper/provider should live at the root level of the application, so as to be able to absolute position portals on top of the rest of the application. We can use |
@satya164 shouldn't this be closed? |
@clauderic @satya164 Please re-open if needed |
@ahmedlhanafy @satya164 So what happened to the very promising features described in the OP? I don't see any elevation or layered prop in the |
FYI: could https://callstack.github.io/react-native-paper/portal-host.html |
This information should be in the docs. Unfortunately, I had to dig for it. |
Description
Elements like FAB and Snackbar render on a different plane above the content in z-axis. Many other elements such as bottom sheets, modals etc. need to be rendered above content too. It'll be useful to have a single Portal component to handle these cases.
To determine which elements exist on which plane, we need to refer to their elevation - https://material.google.com/material-design/elevation-shadows.html#elevation-shadows-elevation-android
Use cases
FAB
,Snackbar
)Snackbar
slides in from button, theFAB
should move upDetailed design
Props
The
Portal
component will accept two props,elevation
andlayered
.The
elevation
prop determines the elevation of the layer in the z-axis. There will be predefined elevations for internal use according to material design guidelines:This is not the full list of elevations, rather the ones we need. Naming is up-to-debate. This will be internal for now, so we can change them later.
The
layered
prop is aboolean
which determines whether the item is grouped with other layered items in a single layer. Grouped items are rendered under the sameView
and positioned using flexbox, so items will appear one below another. When thelayered
prop isfalse
or not passed, the items will be positioned absolutely instead. Non-layered items will render below layered elements.Usage
Animations
The main motivation behind this is animations, i.e. when you show a new
Snackbar
, it should slide in from the bottom and move everything else up (FAB
). The easiest way seems to be to handle the animation insidePortal
. This is how it'll work:height
({ position: 'absolute', left: 0, right: 0, bottom: -9999 }
).translateY
ofheight
to all the elements. This should have no visual difference.translateY
to0
so everything moves up.translateY
toheight
so everything moves down.translateY
to0
This approach assumes that all the elements in a layer are going to use the same slide up/slide down animations for appearing/disappearing.
The text was updated successfully, but these errors were encountered: