RenderHTMLSharedProps
interface RenderHTMLSharedProps {Â Â GenericPressable?: ComponentType<GenericPressableProps>;Â Â WebView?: ComponentType<any>;Â Â bypassAnonymousTPhrasingNodes?: boolean;Â Â computeEmbeddedMaxWidth?: (contentWidth: number, tagName: string) => number;Â Â customListStyleSpecs?: Record<string, ListStyleSpec>;Â Â debug?: boolean;Â Â defaultTextProps?: TextProps;Â Â defaultViewProps?: ViewProps;Â Â defaultWebViewProps?: any;Â Â enableExperimentalBRCollapsing?: boolean;Â Â enableExperimentalGhostLinesPrevention?: boolean;Â Â enableExperimentalMarginCollapsing?: boolean;Â Â pressableHightlightColor?: string;Â Â provideEmbeddedHeaders?: EmbeddedHeadersProvider;}Props shared across renderers.
warning
Shared props changes will cause all the React tree to invalidate. You should always memoize these.
Fields#
GenericPressable#
A component used to wrap pressable elements (e.g. when provided onPress).
Note that textual elements will not be wrapped; TextProps.onPress will
be used instead.
Default: A TouchableNativeFeedback based component on Android, TouchableHighlight based component on other platforms.
WebView#
WebView?: ComponentType<any>;The WebView component used by plugins (iframe, table)... See @native-html/plugins.
Default: () => null
bypassAnonymousTPhrasingNodes#
bypassAnonymousTPhrasingNodes?: boolean;When true (default), anonymous ​TPhrasing nodes parents of a
lonely ​TText node are not translated as React Native Text
elements. Instead, their child is directly rendered, e.g. with no Text
wrapper.
Default: true
warning
Unless strictly necessary, this should be left to true because
some styles don't apply to nested React Native Text elements
(borderRadius, padding...).
Example#
With true:
is translated to
With false:
is translated to
computeEmbeddedMaxWidth#
computeEmbeddedMaxWidth?: (contentWidth: number, tagName: string) => number;A function which takes contentWidth and tagName as arguments and returns a new width. Can return Infinity to denote unconstrained widths.
Default: (c) => c
Remarks
- Take advantage of ​
useComputeMaxWidthForTaghook inside custom renderers to get the maximum width for this tag. - Changes to this prop will cause a react tree update. Always memoize it.
customListStyleSpecs#
Provide support for list style types which are not supported by this library.
Remarks
Check the numerous presets provided by @jsamr/counter-style as they require zero-effort!
Example#
debug#
debug?: boolean;Log to the console a snapshot of the rendered ​TDocument after each
transient render tree invalidation.
Default: false
defaultTextProps#
defaultTextProps?: TextProps;Default props for Text elements in the render tree.
Remarks
"style" will be merged into the tnode own styles.
defaultViewProps#
defaultViewProps?: ViewProps;Default props for View elements in the render tree.
Remarks
"style" will be merged into the tnode own styles.
defaultWebViewProps#
defaultWebViewProps?: any;Default props for WebView elements in the render tree used by plugins.
enableExperimentalBRCollapsing#
enableExperimentalBRCollapsing?: boolean;Follow closely the HTML standard and ignore <br> tags closing an
inline formatting context.
Default: false
Remarks
Recommended value is true on non-web platforms. Also note that
this is an experimental feature, thus subject to behavioral instability.
Example#
When this flag is set to true, one line is printed instead of two on
native platforms, which is the HTML-compliant behavior.
enableExperimentalGhostLinesPrevention#
enableExperimentalGhostLinesPrevention?: boolean;React Native doesn't handle lines like we would expect on a web browser. For example:
will span 20 dpi in height. Setting this prop to true will make
the renderer take those React Native oddities into account.
See also this ticket: https://git.io/JErwX
Default: false
Remarks
This is an experimental feature, thus subject to behavioral instability.
enableExperimentalMarginCollapsing#
enableExperimentalMarginCollapsing?: boolean;Enable or disable margin collapsing CSS behavior (experimental!). See MDN docs.
Default: false
Remarks
Limitations:
- Only adjacent siblings collapsing is implemented.
- If one of the margins height is in percent, no collapsing will occur.
- Will apply indiscriminately to all
displayproperties (including flex), which is not standard. - Might not work well with ​
TPhrasingnodes having only one child.
This is an experimental feature, thus subject to behavioral instability.
pressableHightlightColor#
pressableHightlightColor?: string;Color used for pressable items, either for the ripple effect (Android), or highlight (other platforms).
Default: rgba(38, 132, 240, 0.2)
provideEmbeddedHeaders#
Provide headers for specific embedded elements, such as images, iframes...