HTMLElementModel
class HTMLElementModel<  T extends string,  M extends HTMLContentModel> {  contentModel: M;  getMixedUAStyles: undefined | (tnode: TNodeDescriptor, element: Element) => undefined    | null    | void    | MixedStyleDeclaration;  getReactNativeProps: undefined | (    tnode: TText      | TBlock      | TPhrasing      | TEmpty      | TDocument,    preGeneratedProps: null | ReactNativePropsSwitch,    element: Element  ) => undefined    | null    | void    | ReactNativePropsDefinitions;  getUADerivedStyleFromAttributes: undefined | (attributes: Record<string, string>, markers: Markers) => null | MixedStyleDeclaration;  isOpaque: boolean;  isVoid: boolean;  mixedUAStyles?: MixedStyleDeclaration;  reactNativeProps?: ReactNativePropsDefinitions;  setMarkersForTNode?: SetMarkersForTNode;  tagName: T;  extend: <    CM extends HTMLContentModel  >(merger: (shape: HTMLElementModelShape<T, CM>) => Partial<HTMLElementModelShape<T, CM>>) => HTMLElementModel<T, CM>;  extend: <    CM extends HTMLContentModel  >(shape: Partial<HTMLElementModelShape<T, CM>>) => HTMLElementModel<T, CM>;  isTranslatableBlock: () => boolean;  isTranslatableTextual: () => boolean;  static fromCustomModel: <    CustomTags extends string,    ContentModel extends HTMLContentModel  >(template: CustomElementModel<CustomTags, ContentModel>) => HTMLElementModel<CustomTags, ContentModel>;  static fromNativeModel: <    TN extends TagName,    E extends ElementCategory  >(nativeElementModel: NativeElementModel<TN, E>) => HTMLElementModel<TN, mixed | block | textual | none>;}@native-html/transient-render-engineAn object defining engine internals for tags, such as default styles (UAStyles), content model (how this tag is treated during hoisting)... etc.
Type Parameters#
T#
The name of the tag to which the model will apply.
M#
The ​HTMLContentModel associated with this tag.
Fields#
contentModel#
contentModel: M;The ​HTMLContentModel attached to this model.
getMixedUAStyles#
getMixedUAStyles: undefined | (tnode: TNodeDescriptor, element: Element) => undefined  | null  | void  | MixedStyleDeclaration;A function to create conditional "user-agent" styles.
Remarks
For example, <a> tags will have underline decoration and be
colored blue only when href is defined.
getReactNativeProps#
getReactNativeProps: undefined | (  tnode: TText    | TBlock    | TPhrasing    | TEmpty    | TDocument,  preGeneratedProps: null | ReactNativePropsSwitch,  element: Element) => undefined  | null  | void  | ReactNativePropsDefinitions;A function to create React Native props from a ​TNode grouped by
native components.
Those props will be deep-merged over the pre-generated props. You can preserve some of the pre-generated props since you receive them as second argument.
Merge strategy (latest overrides former):
- props from
reactNativeProps, - auto-generated props from attributes
- props returned by this function
Returns: React Native props grouped by native components (see
​ReactNativePropsDefinitions). Those props will be passed to the
underlying native component at render time.
Example#
getUADerivedStyleFromAttributes#
getUADerivedStyleFromAttributes: undefined | (attributes: Record<string, string>, markers: Markers) => null | MixedStyleDeclaration;A function to create conditional "user-agent" styles.
Deprecated
This feature will be removed in the next major release.
Use ​getMixedUAStyles instead.
isOpaque#
isOpaque: boolean;An opaque element translated ​TNode will have no translated ​TNode
children.
isVoid#
isVoid: boolean;true when the associated tag is a void element.
Remarks
- Void elements cannot have children.
- TText-translated void elements will be preserved even though they don't have children.
mixedUAStyles#
Equivalent of "user-agent" styles. The default styles for the element.
Remarks
These styles will be merged over by tagsStyles.
reactNativeProps#
React Native props grouped by native components. Those props will be passed to the underlying native component at render time.
Remarks
Some props might be overriden by props derived from the
​TNode attributes. For example, if you pass accessibilityLabel
and there is an aria-label attribute attached to one node, the
aria-label will be used. If you want to be able to override the
aria-label, use ​getReactNativeProps instead.
Example#
setMarkersForTNode#
Derive markers for one TNode.
tagName#
tagName: T;The tag name associated with this model.
Methods#
extend#
extend: <  CM extends HTMLContentModel>(merger: (shape: HTMLElementModelShape<T, CM>) => Partial<HTMLElementModelShape<T, CM>>) => HTMLElementModel<T, CM>;extend: <  CM extends HTMLContentModel>(shape: Partial<HTMLElementModelShape<T, CM>>) => HTMLElementModel<T, CM>;Create a new ​HTMLElementModel by shallow-merging properties into this model.
Parameters#
mergerA function to generate the new properties to shallow-merge into this model.
isTranslatableBlock#
isTranslatableBlock: () => boolean;isTranslatableTextual#
isTranslatableTextual: () => boolean;fromCustomModel#
static fromCustomModel: <  CustomTags extends string,  ContentModel extends HTMLContentModel>(template: CustomElementModel<CustomTags, ContentModel>) => HTMLElementModel<CustomTags, ContentModel>;Create an ​HTMLElementModel from a custom template.
Parameters#
templateThe custom template.
fromNativeModel#
static fromNativeModel: <  TN extends TagName,  E extends ElementCategory>(nativeElementModel: NativeElementModel<TN, E>) => HTMLElementModel<TN, mixed | block | textual | none>;Create an ​HTMLElementModel from a native description.
Parameters#
nativeElementModelThe native model declaration.