-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Add support for custom Box rendering #472
base: master
Are you sure you want to change the base?
Conversation
I would love to avoid adding user-facing functionality that exposes Ink internals, like Yoga nodes, for example. Could you post some code that demonstrates the issues you mentioned in the second paragraph? |
@vadimdemedes Sorry I missed your reply - an unnoticed bad filter started filtering my GH notifications incorrectly. Here's a code sample of the problem I'm trying to address:
When used, the I understand not wanting to expose internals since it can massively expand the API and can lead to more breaking changes, but I feel this adds a lot of potential with pretty low impact - Yoga should be a consistent API, and the only additional Ink internal exposed is |
Not sure I still get it. Is |
Using that approach has a couple of issues:
|
I'm having a similar issue like Matchlighter while trying to build line components. Sometimes the size doesn't propagate until the next layout change or render and explicitly setting the size can prevent it from automatically getting smaller, causing layout issues. I thought about adding a built-in component to |
Hi, |
Adds a
unsafeDirectRender
prop to<Box />
.unsafeDirectRender
accepts a function with the signature(x: number, y: number, node: DOMNode, output: Output) => void
(the same as the internalrenderBorder()
function). When rendering, Ink will then call the function before rendering Borders or Children.This is a useful escape hatch for a number of possible components, especially for creating custom "base" components such as
(Vertical|Horizontal)Rule
. Such components were "possible" using auseEffect
hook andmeasureElement
, but suffered from 2 critical issues: 1) resizing the terminal would cause de-syncs, and 2) such an approach requires 2 renders and a short "flash of unstyled content".