Skip to content

Exporting TRenderEngineContext to allow plugging in rendering engine cache #11

@ehenighan

Description

@ehenighan

https://github.com/native-html/core/blob/b2dd2b0cae23dd5aa5e96c3c4bd8b3ea95010e29/packages/render-html/src/TRenderEngineProvider.tsx#L8

Hi,

Saw this project was in the middle of being ported from react-native-render-html in a great big open PR so didn't want to interfere with that process by proposing changes while you're in the middle of the big move, so please take this mainly as a question for now!

Is there a good reason this context isn't exported so you can customise the rendering engine provider behaviour? I've got it locally patched to allow that and it seems to be fine but I'm wondering if I've missed something because so many other things are exported that this almost stands out as a deliberate exclusion.

My use case is, loads of small HTML snippets on one page so want to reuse engines for speed, but the snippets can't all share the same single engine from one parent as they're not all styled the same - and some can be styled dynamically according to user actions. But they're always styled almost the same and there are only a few variations, so by exporting this context I've been able to add a small cache of reusable engines keyed on the styles to be applied, and a hook to pull the right engine from the cache for a given snippet - much faster rendering with many heterogenously-styled snippets on one page.

If there's no reason I've missed why this export is specifically undesirable, would you accept a PR for it at some convenient point - and if so, any preferred target branch/conventions you have in mind for this new ported project?

Thanks,

Ed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions