Closed AdamGerthel closed 2 years ago
I'm not sure if this works for your use case, but you could wrap your from
element in a View
with some padding
, which should have the desired effect:
from={(
<View style={{ padding: 10 }}>
<InnerElement />
</View>
)}
I'm sure there are some cases where adding the padding might mess up the rest of your layout, so let me know if that is the case for you. I try not to add props unless there is not a way to solve the problem outside the library, to keep this library simple and small.
As you mention yourself, adding padding is not always an option. I also think it's a bit of a dirty workaround.
I'm using popovers in a lot of places like this (with long-press to open it):
In the above example, I could add padding as a workaround, but not for the buttons at the bottom (which also uses Popover). In my case, I want the exact same offset wherever the popover opens, which is not possible using the suggested solution.
I definitely understand your concern about keeping the library small, but I hope you want it to be small and flexible rather than just small ;)
Ah yep that does look like a situation where padding wouldn't work. I'll think about the best way to implement this feature.
Another reason: Visibility. When the popover opens very close to the triggering point, the finger or thumb is often covering parts of the popover. If you slide the finger away to get more space, the popover becomes inactive and closes (if it's done using "press to hold").
Added an offset
prop. This will be fixed when 4.2.0 is released.
Version 5.0.0 released, which includes the offset
prop (I had to release a new major version due to other breaking changes)
Is your feature request related to a problem? Please describe. Yes, a design problem, but not a technical problem
Describe the solution you'd like I'd like to be able to specify a value (in pixels), similar to the
verticalOffset
, but which is applied no matter where the placement is. The value should be added as empty space between the start of the arrow and the originating position. I.e. If the value (n
) is positive, the popover opensn
pixels further away.Basically, a way to get the popover to start a little bit further away so that it isn't always so close to the
from
element.