iOS/Android pure javascript react-native component that renders your HTML into 100% native views
BSD-2-CLAUSE License
Bot releases are hidden (Show)
Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
RenderHTMLSource
component, use shallow-equality in memo function (0fd1f81)Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
collapseTopMarginForChild
utility (199be12)TNodeRenderer
(dbabe1d)hasClass
method in TNodes
(4cf6ede)TNodeRenderer
(164f205)Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
renderersProps.(ol|ul).markerBoxStyle
prop (c929643)Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
Beware there is a breaking change in this version, although very easy to fix (see below).
triggerTREInvalidationPropNames
has been discontinued. The idea for this prop originated in the premise that many beginners would disregard the issue of passing literal props triggering many re-renders. But I realized it mostly frustrated expectations of newcomers that this library honors React components contract. So I have finally decided to discard the prop, and instead add a lightweight profiler (in dev mode only, of course), which warns the consumer of re-renders happening in a short period of time. You are now responsible for the invalidation of the TRenderEngine, so make sure you memoize the props if the controlling components is expected to re-render often.Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
This beta.1
brings a lot of tests and a branch test coverage above 99%. Many bugs have been identified and fixed thanks to this endeavor. (Please note that the value reported by CodeCov is erroneous, the bug is being tracked here.)
debug
mode not activated despite prop set to true
(ca3fbca)viewProps.style
and textProps.style
should have greater specificity over computed styles (38bf934)buildTREFromConfig
(a71854f)onPress
should await on Linking.canOpenURL
(d9e8eb5)SourceLoaderUri
(a530c5c)getFallbackListStyleTypeFromNestLevel
returns undefined (c0eee3d)Published by jsamr over 3 years ago
The Foundry release is finally stable, and is now-on the recommended version. Check out the announcement blog post in our brand new website. We also have a migration guide for those who're coming from v5 and below. If you encounter any issue with this release, please comment in the official thread.
<img>
tags, style dimensions should prevail over attributes (de3b473)And all these unlisted in commits: #94, #118, #144, #150, #151, #156, #165, #227, #228, #243, #263, #286, #312, #336, #344, #360, #369, #371 #414, #418, #419, #420, #424, #429, #432, #470, #481, #482, #484
GenericPressable
prop to customize the component wrapping interactive views (707374a), closes #472
pressableHightlightColor
prop to customize pressable appearance (e5dfa1e)sharedProps
from custom renderers (0d2199e)react-native
field in package.json for metro (10dfc82)RenderersProps
(97dabc1)enableExperimentalRtl
in renderersProps.ol|ul
(96daa5e)getFallbackListStyleTypeFromNestLevel
in renderersProps.ol|ul
(1377ef7)renderersProps.ol|ul
(316e706)dangerouslyDisableHoisting
prop (e6c7328)defaultListStyleSpecs
for customization. (2f9ed01)defaultSystemFonts
and defaultFallbackFonts
(0c4207c)buildTREFromConfig
for testing (c13e1a7)propsFromParent
in custom renderers and children renderers (3bc1b52), closes #228
renderersProps.(ol|ul).enableDynamicMarkerBoxWidth
prop (f87b9f6)selectDomRoot
prop to select a custom root (31bbff7)setMarkersForTNode
prop (63caa4d)useIMGElementStateWithCache
hook for images (54dc1bc)customListStyleSpecs
to support additional list-style-type
(84ec025)RenderHTMLSourceDom
to render a DOM object (eeec894)RenderHTMLSource
(4e4cd09)CustomElementModel
type from TRE (c5a01f0)HTMLModelRecord
from TRE (a9c9cf3)isDomNode
and isDomText from TRE (cedcf7a)SetMarkersForTNode
from TRE (eaa3928)TNodeDescriptor
from TRE (157983c)TNodePrintOptions
type from TRE (6f3265c)"object-fit"
CSS property for images (24f72b0)"start"
attribute in ol and ul elements (b9d3154), closes #336
"upper-latin"
and "lower-lattin"
list-style-type CSS props (a0da60d)enableRemove*MarginIfNested
for list renderers (e0fe7c6)nodeIndex
and parent
fields in TNode
(fe2504c)a
elements (6974ce6), closes #285
decimal-leading-zero
list style type prefix (526e226)disclosure-*
list style type prefixes (218982d)lower-greek
list style type prefixes (3aac2c8)lower-latin
and upper-latin list prefix styles (4d4805c)propsFromParent
prop (6427732)defaultViewProps
prop (ce49232)target
argument to onLinkPress
handler (139b0c3)getListStyleTypeFromNestLevel
prop to HTMLListElement
(5ae3e6a)splitBoxModelStyle
utility (b1adcbc)enableExperimentalMarginCollapsing
prop (ae6c553)useSharedProps
(f1d7b16)fallbackFonts
and systemFonts
props for font selection (6888a96)defaultTextProps
prop (c297ed1)useInternalRenderer
hook to reuse internal rendering logic (8c292da)computeEmbeddedMaxWidth
prop as per [email protected] (6c9d70f)RenderHTMLDebug
wrapper component to warn users (22625b4)cachedNaturalDimensions
prop to useIMGelementState
hook (ed976bb)onDocumentMetadataLoaded
prop (9f55907)TRenderEngineProvider
and RenderHTMLFragment
components (7d50e72)extendInternalRenderer
utility (d7bb1da)onTTreeChange
(5ecdcab)renderChild
prop to TChildrenRenderer
(db78c54)onHTMLLoaded
prop (981b49b)alterData
, alterChildren
and alterNode
(18dc001)useIMGElementState
hook (399eb54), closes #424
htmlParserOptions
prop (624c57e)source
prop, identical to react-native-webview (3a16487)source.headers
in useIMGElementState
hook (a49e958)triggerTREInvalidationPropNames
prop (89ee25c)useRendererProps
hook (87982c4)debug
is set to false (cb5b42b)alter*
props in favor of domVisitors
(ffb1f58)TDocumentRenderer
to prevent rendering from ascendents (2ec060b)ignoreDOMNode
with ignoreDomNode
(9ec6403)ignoredTags
with ignoredDomTags
(b60d6eb)Feeling overwhelmed by all those breaking changes? We have a migration guide for those who're coming from v5 and below.
ignoredTags
has been replaced with ignoredDomTags
for naming consistency.alterNode
, alterData
and alterChildren
have been dropped in favor of domVisitors
. The latter is an object with 3 optional callbacks, onElement
, onDocument
and onText
which you can use to intercept and tamper nodes during parsing. Take advantage of domutils library to delete, insert and manipulate those nodes.ignoreNodesFunction
is now ignoreDomNode
for naming consistency.enableExperimentalPercentWidth
has been discontinued. Use renderersProps.img.enableExperimentalPercentWidth
instead.onLinkPress
prop has been discontinued. Use renderersProps.a.onPress
instead.imagesInitialDimensions
has been moved to renderersProps.img.initialDimensions
listsPrefixesRenderers
prop has been discontinued. Use customListStyleSpecs
instead.ptSize
prop. Point is supposed to be an absolute (pixel independent) size and unfit for display devices. It will be translated by the CSS processor to an absolute unit.containerStyle
and customContainer
props have been dropped. Use baseStyle
prop instead to style the root component.textSelectable
and allowFontScaling
. Use defaultTextProps.selectable
and defaultTextProps.allowFontScaling
instead.uri
and html
props have been dropped. Replace uri
with source={{ uri: 'http://...' }}
and html
with source={{ html: '<div> ...' }}
. The former now allows body
, headers
and method
fields.decodeEntities
prop has been dropped. Pass this option to htmlParserOptions
prop instead.computeImagesMaxWidth
has been replaced with computeEmbeddedMaxWidth
. The two props are very similar, but the latest takes an extra argument, "tagName", which is the tag for which a widthPublished by jsamr over 3 years ago
nodeIndex
for children of ul
and ol
tagsalterChildren
function return typePublished by jsamr over 3 years ago
RenderersPropsBase
to RenderersProps
(38de8f4)TransientRenderEngineConfig
to TRenderEngineConfig
(89dc252)renderersProps.(ol|ul).enableDynamicMarkerBoxWidth
prop (0cde839)enableDynamicMarkerBoxWidth
lists renderers prop.TransientRenderEngineConfig
wasTRenderEngineConfig
for naming consistency.RenderersPropsBase
has beenRenderersProps
for naming consistency.internalRenderers
has been removed from exports. IfuseInternalRenderer
RenderersProps
orPropsFromParent
.Published by jsamr over 3 years ago
This should be the last alpha. The most notable breaking change is for custom renderers: you should not attach a model to your renderer anymore. Instead, use customHTMLElementModels
prop. A guide will be available soon on the new documentation website.
contentWidth
prop to RenderHTMLSource
(5a1ab50)TNode
(0b9a39d)DefaultTagRenderer
to InternalRenderer
(a31ea0d)extendDefaultRenderer
to extendInternalRenderer
(c05198a)dangerouslyDisableHoisting
prop (2507be1)selectDomRoot
prop to select a custom root (dbcf6e4)RenderHTMLSource
(7616236)alter*
props in favor of domVisitors
(bf7352e)ignoreDOMNode
with ignoreDomNode
(e484cda)ignoredTags
with ignoredDomTags
(6416a21)renderers
prop don't support attaching an HTMLElementModel as the model
property. Instead,customHTMLElementModels
prop. To create element models, either use .extend
method from models in thedefaultHTMLElementModels
export, or use HTMLElementModel.fromCustomModel
method.markers
prop is not available anymore to custom renderers. The marker logic has been moved to the Transient Render Engine. Instead, use tnode.markers
.setMarkersForTNode
signature has changed and is now a config option for the TRenderEngineProvider
. You must not return a newDefaultTagRenderer
has been renamed to InternalRenderer
for naming consistency. "Internal renderers" are custom internal renderers for specific tags such as <img>
, which require custom logic to feature expected behavior. On the contrary, TDefaultRenderer
s are fallback renderers for a TNode
.extendDefaultRenderer
has been renamed to extendInternalRenderer
for the sake of naming consistency.contentWidth
has been removed from the sharedProps
prop of custom renderers. Consume useContentWidth
hook instead.RenderHTMLFragment
has been dropped. Instead, use RenderHTMLSource
which must have both RenderHTMLConfigProvider
andTRenderEngineProvider
as ascendants. This decoupling allows global sharing and loading of configuration for best performance when rendering multiple HTML snippets down in the tree. Best gains will be observed when rendering dozens to hundred of snippets.ignoredTags
has been replaced with ignoredDomTags
for naming consistency.alterDOMNode
, alterDOMData
and alterDOMChildren
have been dropped in favor of domVisitors
. The latter is an objectonElement
, onDocument
and onText
which you can use to intercept and tamper nodes during parsing. Take advantage of domutils library to delete, insert and manipulate those nodes.ignoreDOMNode
is now ignoreDomNode
for naming consistency.tnodeToString
is not available anymore. Use TNode.snapshot()
method instead.instanceof TText
for example, replace with a type-garded check: tnode.type === "text"
.Published by jsamr over 3 years ago
Published by jsamr over 3 years ago
renderersProps
(f338963)enableExperimentalPercentWidth
to renderersProps.img
(0612a94)onLinkPress
to renderersProps.a.onPress
(5c31ff9)enableExperimentalRtl
in renderersProps.ol|ul
(2b6b0be)getFallbackListStyleTypeFromNestLevel
in renderersProps.ol|ul
(540a22c)defaultListStyleSpecs
for customization. (6c2420b)customListStyleSpecs
to support additional list-style-type
(190af19)enableRemove*MarginIfNested
for list renderers (54e4182)getStyleFromNestLevel
prop for list renderers has been dropped. If you need conditional style for list renderers based on nest level, implement a custom list renderer with useInternalRenderer
and check the passed markers nest level.getListStyleTypeFromNestLevel
prop for list renderers has been renamed to getFallbackListStyleTypeFromNestLevel
.useTTree
and useTRenderEngine
have been removed from barrel exports since they are considered internals. If you were using those, please let me know.enableExperimentalPercentWidth
has been discontinued. Use renderersProps.img.enableExperimentalPercentWidth
instead.onLinkPress
prop has been discontinued. Use renderersProps.a.onPress
instead.sharedProps
and useSharedProps
don't provide renderersProps
anymore. Explicitly consume those via useRendererProps
.initialImagesDimensions
has been moved to renderersProps.img.initialDimensions
Published by jsamr over 3 years ago
Published by jsamr over 3 years ago
Published by jsamr over 3 years ago
Published by jsamr over 3 years ago
propsFromParent
prop (dd7ff6c)TDocumentRenderer
to prevent rendering from ascendents (b5dffea)Published by jsamr over 3 years ago
TNode.nodeIndex
gives the index before collapsing (ba63d59)BaseRenderersProps
(341b4c3)Published by jsamr over 3 years ago
sharedProps
from custom renderers (3dc8f0c)defaultProps
to TNodeRenderer
for convinience (8b6dad9)react-native
field in package.json for metro (d2e89ef)defaultSystemFonts
and defaultFallbackFonts
(eb3070b)markers
prop for custom renderers (7f49593)propsFromParent
in custom renderers and children renderers (1d445e7), closes #228
setMarkersForTNode
prop (c7b922e)nodeIndex
and parent
fields in TNode
(942fcbc)hasAnchorAncestor
prop has been removed from custom renderers and children renderers. If you need to know if a node has ancollapsedMarginTop
prop has been removed from children renderers. If you were directly using it, use propsFromParent.collapsedMarginTop
instead. If you were just setting this prop to null
to avoid typescript errors, just remove this prop.