react-native-render-html

iOS/Android pure javascript react-native component that renders your HTML into 100% native views

BSD-2-CLAUSE License

Downloads
967.5K
Stars
3.4K
Committers
55

Bot releases are visible (Hide)

react-native-render-html - Release 6.0.0-beta.8

Published by jsamr over 3 years ago

6.0.0-beta.8 (2021-07-07)

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.

Bug Fixes

  • allow spaces between params in color CSS functions such as rgb(...) (5e755bb)
react-native-render-html - Release 6.0.0-beta.7

Published by jsamr over 3 years ago

6.0.0-beta.7 (2021-07-01)

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.

Bug Fixes

  • loading image component doesn't display alt and borders anymore (1351ee5)

Features

  • new renderersProps.(ol|ul).markerTextStyle prop (6ca54e9)
  • re-export definitions from css-processor (966f01a), closes #503
  • use aspectRatio style to infer one dimension of images sizes (e018b30)
react-native-render-html - Release 6.0.0-beta.6

Published by jsamr over 3 years ago

6.0.0-beta.6 (2021-06-25)

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.

Bug Fixes

  • in RenderHTMLSource component, use shallow-equality in memo function (0fd1f81)
react-native-render-html - Release 6.0.0-beta.5

Published by jsamr over 3 years ago

6.0.0-beta.5 (2021-06-24)

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.

Features

  • export collapseTopMarginForChild utility (199be12)
  • export TNodeRenderer (dbabe1d)
  • new hasClass method in TNodes (4cf6ede)

Performance Improvements

react-native-render-html - Release 6.0.0-beta.4

Published by jsamr over 3 years ago

6.0.0-beta.4 (2021-06-23)

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.

Features

  • support renderersProps.(ol|ul).markerBoxStyle prop (c929643)

Performance Improvements

  • use context to make unitary list style renderers (26bdd72)
react-native-render-html - Release 6.0.0-beta.3

Published by jsamr over 3 years ago

6.0.0-beta.3 (2021-06-19)

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).

Features

  • new dev profiler to get feedback on short updates (98fd749)

BREAKING CHANGES

  • The 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.
react-native-render-html - Release 6.0.0-beta.2

Published by jsamr over 3 years ago

6.0.0-beta.2 (2021-06-13)

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.

Bug Fixes

  • style prop ignored in GenericPressable on Android (cea6fe8)
react-native-render-html - Release 6.0.0-beta.1

Published by jsamr over 3 years ago

6.0.0-beta.1 (2021-06-11)

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.)

Bug Fixes

  • debug mode not activated despite prop set to true (ca3fbca)
  • viewProps.style and textProps.style should have greater specificity over computed styles (38bf934)
  • allow an empty object as param of buildTREFromConfig (a71854f)
  • default anchor onPress should await on Linking.canOpenURL (d9e8eb5)
  • inconsistent loading state in SourceLoaderUri (a530c5c)
  • uri source loading failure caused by missing defaults renderers (4bc3f38)
  • use default list style type when getFallbackListStyleTypeFromNestLevel returns undefined (c0eee3d)
react-native-render-html - Release 6.0.0-beta.0

Published by jsamr over 3 years ago

6.0.0-beta.0 (2021-06-08)

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.

Bug Fixes

  • discard unsupported CSS inline methods (calc, var) (a2e7578)
  • images honor styles and physical size in "alt" (error) mode (059e5d6)
  • in <img> tags, style dimensions should prevail over attributes (de3b473)
  • list style prefixes now inherit from font*(weight,style,family) (191c45c)
  • don't peer-depend on prop-types, instead depend directly (27e843e)

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

Features

  • GenericPressable prop to customize the component wrapping interactive views (707374a), closes #472
  • pressableHightlightColor prop to customize pressable appearance (e5dfa1e)
  • access sharedProps from custom renderers (0d2199e)
  • accessibility for images with role and label (1accaf7)
  • add react-native field in package.json for metro (10dfc82)
  • allow module augmentation for renderers prop via RenderersProps (97dabc1)
  • configure enableExperimentalRtl in renderersProps.ol|ul (96daa5e)
  • configure getFallbackListStyleTypeFromNestLevel in renderersProps.ol|ul (1377ef7)
  • configure margins removal for nested lists in renderersProps.ol|ul (316e706)
  • experimental dangerouslyDisableHoisting prop (e6c7328)
  • export defaultListStyleSpecs for customization. (2f9ed01)
  • export defaultSystemFonts and defaultFallbackFonts (0c4207c)
  • export buildTREFromConfig for testing (c13e1a7)
  • new propsFromParent in custom renderers and children renderers (3bc1b52), closes #228
  • new renderersProps.(ol|ul).enableDynamicMarkerBoxWidth prop (f87b9f6)
  • new selectDomRoot prop to select a custom root (31bbff7)
  • new setMarkersForTNode prop (63caa4d)
  • new useIMGElementStateWithCache hook for images (54dc1bc)
  • new prop customListStyleSpecs to support additional list-style-type (84ec025)
  • new source type RenderHTMLSourceDom to render a DOM object (eeec894)
  • performant multi-instance HTML rendering with RenderHTMLSource (4e4cd09)
  • reexport CustomElementModel type from TRE (c5a01f0)
  • reexport HTMLModelRecord from TRE (a9c9cf3)
  • reexport isDomNode and isDomText from TRE (cedcf7a)
  • reexport SetMarkersForTNode from TRE (eaa3928)
  • reexport TNodeDescriptor from TRE (157983c)
  • reexport TNodePrintOptions type from TRE (6f3265c)
  • support "object-fit" CSS property for images (24f72b0)
  • support "start" attribute in ol and ul elements (b9d3154), closes #336
  • support "upper-latin" and "lower-lattin" list-style-type CSS props (a0da60d)
  • support enableRemove*MarginIfNested for list renderers (e0fe7c6)
  • support nodeIndex and parent fields in TNode (fe2504c)
  • support accessibility for a elements (6974ce6), closes #285
  • support decimal-leading-zero list style type prefix (526e226)
  • support default system fonts for Windows, Macos and web (4474dff)
  • support disclosure-* list style type prefixes (218982d)
  • support experimental RTL mode for ol and ul elements (ca139c1)
  • support lower-greek list style type prefixes (3aac2c8)
  • support lower-latin and upper-latin list prefix styles (4d4805c)
  • ts: new generic argument for renderers propsFromParent prop (6427732)
  • add defaultViewProps prop (ce49232)
  • add target argument to onLinkPress handler (139b0c3)
  • add getListStyleTypeFromNestLevel prop to HTMLListElement (5ae3e6a)
  • add new splitBoxModelStyle utility (b1adcbc)
  • enableExperimentalMarginCollapsing prop (ae6c553)
  • export useSharedProps (f1d7b16)
  • expose internal renderers building blocks for extensibility (213fcd7), closes #424
  • fallbackFonts and systemFonts props for font selection (6888a96)
  • implement defaultTextProps prop (c297ed1)
  • implement useInternalRenderer hook to reuse internal rendering logic (8c292da)
  • implement computeEmbeddedMaxWidth prop as per [email protected] (6c9d70f)
  • implement RenderHTMLDebug wrapper component to warn users (22625b4)
  • new cachedNaturalDimensions prop to useIMGelementState hook (ed976bb)
  • new onDocumentMetadataLoaded prop (9f55907)
  • new TRenderEngineProvider and RenderHTMLFragment components (7d50e72)
  • new extendInternalRenderer utility (d7bb1da)
  • new prop onTTreeChange (5ecdcab)
  • new renderChild prop to TChildrenRenderer (db78c54)
  • new renderers API (2547cba)
  • onHTMLLoaded prop (981b49b)
  • port alterData, alterChildren and alterNode (18dc001)
  • reeport useful types from css-processor (9b5e301)
  • reeport useful variables and types from transient-render-engine (0c0a9c6)
  • reuse 'img' renderer internal logic w/t useIMGElementState hook (399eb54), closes #424
  • support htmlParserOptions prop (624c57e)
  • support source prop, identical to react-native-webview (3a16487)
  • support a minimal table renderer (7f64d48)
  • support for loading HTML from URI (6c07b8d)
  • support relative URLs and document metadata (f2cbcfc)
  • support source.headers in useIMGElementState hook (a49e958)
  • triggerTREInvalidationPropNames prop (89ee25c)
  • useRendererProps hook (87982c4)
  • warn user of API misusage even when debug is set to false (cb5b42b)

Performance Improvements

  • avoid calls to getImageDimensions API when provided in attrs (4f3d51d)
  • bypass anonymous TPhrasing nodes with one child or less (dad450d)
  • drop alter* props in favor of domVisitors (ffb1f58)
  • increase transient parsing speed by 30% after upgrade to v6.2.1 (df91a21)
  • limit rerenderings via memoization (6512e18)
  • memoize TDocumentRenderer to prevent rendering from ascendents (2ec060b)
  • replace ignoreDOMNode with ignoreDomNode (9ec6403)
  • replace ignoredTags with ignoredDomTags (b60d6eb)

BREAKING CHANGES

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.
  • dropped 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.
  • drop 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 width
    constrain should be enforced. It is planned to work with the @native-html/iframe-plugin extension.
react-native-render-html - v5.1.1

Published by jsamr over 3 years ago

Bugfixes

  • wrong nodeIndex for children of ul and ol tags
  • alterChildren function return type
react-native-render-html - Release 6.0.0-alpha.26

Published by jsamr over 3 years ago

6.0.0-alpha.26 (2021-06-04)

Code Refactoring

  • remove internalRenderers from exports (cea10f9)
  • rename RenderersPropsBase to RenderersProps (38de8f4)
  • rename TransientRenderEngineConfig to TRenderEngineConfig (89dc252)
  • rename reexports from domhandler to their original names (5488313)
  • simplify types / suggest module augmentation for extensibility (c6f5cc7)

Features

  • new renderersProps.(ol|ul).enableDynamicMarkerBoxWidth prop (0cde839)
  • reexport CustomElementModel type from TRE (9cc961b)
  • reexport HTMLModelRecord from TRE (c74efad)
  • reexport isDomNode and isDomText from TRE (0292ac0)
  • reexport SetMarkersForTNode from TRE (38a787f)
  • reexport TNodeDescriptor from TRE (1adfc1b)
  • reexport TNodePrintOptions type from TRE (0a436a7)

BREAKING CHANGES

  • list padding will not adapt to markers width anymore.
    You need to explicitly enable this behavior via the new
    enableDynamicMarkerBoxWidth lists renderers prop.
  • (TypeScript users): TransientRenderEngineConfig was
    renamed to TRenderEngineConfig for naming consistency.
  • (TypeScript users): RenderersPropsBase has been
    renamed to RenderersProps for naming consistency.
  • DOMNode has been renamed to Node, DOMText to Text...
    etc.
  • internalRenderers has been removed from exports. If
    you need to reuse an internal renderer, check useInternalRenderer
    hook instead.
  • A few TypeScript types names have been changed and
    some type parameters have been removed for simplicity. Use module
    augmentation if you need to specify RenderersProps or
    PropsFromParent.
react-native-render-html - Release 6.0.0-alpha.25

Published by jsamr over 3 years ago

6.0.0-alpha.25 (2021-05-21)

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.

Bug Fixes

  • debug being ignored (010315d)
  • erroneous TDefaultRenderer "type" prop (0d3a676)

Code Refactoring

  • typescript: rename RenderHTMLSource to HTMLSource (1cf8536)
  • move contentWidth prop to RenderHTMLSource (5a1ab50)
  • move markers to TNode (0b9a39d)
  • rename DefaultTagRenderer to InternalRenderer (a31ea0d)
  • rename extendDefaultRenderer to extendInternalRenderer (c05198a)
  • separate HTML element models and renderers (71ddd74)

Features

  • experimental dangerouslyDisableHoisting prop (2507be1)
  • export buildTREFromConfig for testing (e7351ce)
  • in debug mode, add the update # (8999b7d)
  • new selectDomRoot prop to select a custom root (dbcf6e4)
  • new source type "RenderHTMLSourceDom" to render a DOM object (f2c0b64)
  • performant multi-instance HTML rendering with RenderHTMLSource (7616236)
  • support "object-fit" CSS property for images (7b89444)

Performance Improvements

  • bypass anonymous TPhrasing nodes with one child or less (d361872)
  • drop alter* props in favor of domVisitors (bf7352e)
  • increase transient parsing speed by 30% after upgrade to v6.2.1 (89ab1aa)
  • migrate to transient-render-engine v5.1.1, +30% speed gains (21e9420)
  • replace ignoreDOMNode with ignoreDomNode (e484cda)
  • replace ignoredTags with ignoredDomTags (6416a21)
  • upgrade transient-render-engine to 7.1.0 (4ebba8e)

BREAKING CHANGES

  • typescript: for TypeScript users, RenderHTMLSource type has been renamed to HTMLSource for disambiguity with the new RenderHTMLSource component.
  • custom renderers provided in renderers prop don't support attaching an HTMLElementModel as the model property. Instead,
    use the new customHTMLElementModels prop. To create element models, either use .extend method from models in the
    defaultHTMLElementModels 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 new
    marker. Instead, assign properties directly to the markers instance passed by reference as the first argument of this function.
  • DefaultTagRenderer 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, TDefaultRenderers 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 and
    TRenderEngineProvider 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 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.
  • ignoreDOMNode is now ignoreDomNode for naming consistency.
  • tnodeToString is not available anymore. Use TNode.snapshot() method instead.
  • Serialization related exports have been dropped. The TRE doesn't serialize DOMNodes anymore for performance sake. DOMNodes attached to a TNode are now instances of htmlparser2 "Node".
  • exported TNode, TText ... are now type-only. If you were using instanceof TText for example, replace with a type-garded check: tnode.type === "text".
react-native-render-html - Release 6.0.0-alpha.24

Published by jsamr over 3 years ago

6.0.0-alpha.24 (2021-04-17)

Bug Fixes

  • list marker doesn't pick fontSize (64bf900)
react-native-render-html - Release 6.0.0-alpha.23

Published by jsamr over 3 years ago

6.0.0-alpha.23 (2021-04-17)

Code Refactoring

  • extract internal types to a separate file (27421ad)
  • extract renderer-specific props to renderersProps (f338963)
  • move enableExperimentalPercentWidth to renderersProps.img (0612a94)
  • move onLinkPress to renderersProps.a.onPress (5c31ff9)

Features

  • configure enableExperimentalRtl in renderersProps.ol|ul (2b6b0be)
  • configure getFallbackListStyleTypeFromNestLevel in renderersProps.ol|ul (540a22c)
  • configure margins removal for nested lists in renderersProps.ol|ul (15b161c)
  • export defaultListStyleSpecs for customization. (6c2420b)
  • new prop customListStyleSpecs to support additional list-style-type (190af19)
  • support "start" attribute in ol and ul elements (0f87b22), closes #336
  • support "upper-latin" and "lower-lattin" list-style-type CSS props (1a2c595)
  • support enableRemove*MarginIfNested for list renderers (54e4182)
  • support experimental RTL mode for ol and ul elements (0954d8b)

BREAKING CHANGES

  • 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
react-native-render-html - Release 6.0.0-alpha.22

Published by jsamr over 3 years ago

6.0.0-alpha.22 (2021-03-30)

Features

  • GenericPressable prop to customize the component wrapping interactive views (a29468d), closes #472
  • pressableHightlightColor prop to customize pressable appearance (d3c5b4d)
react-native-render-html - Release 6.0.0-alpha.21

Published by jsamr over 3 years ago

6.0.0-alpha.21 (2021-03-24)

Bug Fixes

Features

  • support decimal-leading-zero list style type prefix (5ab6d6f)
  • support disclosure-* list style type prefixes (c9aa2fb)
  • support lower-greek list style type prefixes (9e6f66b)
  • support lower-latin and upper-latin list prefix styles (d42f688)
react-native-render-html - Release 6.0.0-alpha.20

Published by jsamr over 3 years ago

6.0.0-alpha.20 (2021-02-20)

Features

  • better extensibility of custom renderers with generic type arg (b827937)
react-native-render-html - Release 6.0.0-alpha.19

Published by jsamr over 3 years ago

6.0.0-alpha.19 (2021-02-20)

Features

  • ts: new generic argument for renderers propsFromParent prop (dd7ff6c)

Performance Improvements

  • memoize TDocumentRenderer to prevent rendering from ascendents (b5dffea)
react-native-render-html - Release 6.0.0-alpha.18

Published by jsamr over 3 years ago

6.0.0-alpha.18 (2021-02-18)

Bug Fixes

  • TNode.nodeIndex gives the index before collapsing (ba63d59)

Features

  • allow module augmentation for renderers prop via BaseRenderersProps (341b4c3)

Performance Improvements

  • limit rerenderings via memoization (9a17d99)
react-native-render-html - Release 6.0.0-alpha.17

Published by jsamr over 3 years ago

6.0.0-alpha.17 (2021-02-15)

Bug Fixes

  • prop onDocumentMetadataLoaded not invoked (90cc1f6)
  • prop onTTreeChange not invoked (7d08dd6)

Features

  • access sharedProps from custom renderers (3dc8f0c)
  • add defaultProps to TNodeRenderer for convinience (8b6dad9)
  • add react-native field in package.json for metro (d2e89ef)
  • export defaultSystemFonts and defaultFallbackFonts (eb3070b)
  • implement strictly margin collapsing computation (28fc95b)
  • new markers prop for custom renderers (7f49593)
  • new propsFromParent in custom renderers and children renderers (1d445e7), closes #228
  • new setMarkersForTNode prop (c7b922e)
  • support nodeIndex and parent fields in TNode (942fcbc)
  • support default system fonts for Windows, Macos and web (ebece1d)

BREAKING CHANGES

  • hasAnchorAncestor prop has been removed from custom renderers and children renderers. If you need to know if a node has an
    anchor ancestor, use the new Marker API, which is released along.
  • collapsedMarginTop 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.
Package Rankings
Top 0.88% on Npmjs.org
Badges
Extracted from project README
npm npm npm npm
Related Projects