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-engine
An object defining engine internals for tags, such as default styles (UAStyles), content model (how this tag is treated during hoisting)... etc.
#
Type ParametersT
#
The name of the tag to which the model will apply.
M
#
The ​HTMLContentModel
associated with this tag.
#
FieldscontentModel
#
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.
#
ExamplegetUADerivedStyleFromAttributes
#
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.
#
ExamplesetMarkersForTNode
#
Derive markers for one TNode.
tagName
#
tagName
:
T
;
The tag name associated with this model.
#
Methodsextend
#
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.
#
Parametersmerger
A 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.
#
Parameterstemplate
The 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.
#
ParametersnativeElementModel
The native model declaration.