HTMLElementModelShape
interface
HTMLElementModelShape
<
 Â
T
extends
string
,
 Â
M
extends
HTMLContentModel
>
{
 Â
contentModel
:
M
;
 Â
getMixedUAStyles
?
:
(
tnode
:
TNodeDescriptor
,
element
:
Element
)
=>
undefined
   Â
|
null
   Â
|
void
   Â
|
MixedStyleDeclaration
;
 Â
getReactNativeProps
?
:
(
   Â
tnode
:
TText
     Â
|
TBlock
     Â
|
TPhrasing
     Â
|
TEmpty
     Â
|
TDocument
,
   Â
preGeneratedProps
:
null
|
ReactNativePropsSwitch
,
   Â
element
:
Element
 Â
)
=>
undefined
   Â
|
null
   Â
|
void
   Â
|
ReactNativePropsDefinitions
;
 Â
getUADerivedStyleFromAttributes
?
:
(
attributes
:
Record
<
string
,
string
>
,
markers
:
Markers
)
=>
null
|
MixedStyleDeclaration
;
 Â
isOpaque
:
boolean
;
 Â
isVoid
:
boolean
;
 Â
mixedUAStyles
?
:
MixedStyleDeclaration
;
 Â
reactNativeProps
?
:
ReactNativePropsDefinitions
;
 Â
setMarkersForTNode
?
:
SetMarkersForTNode
;
 Â
tagName
:
T
;
}
@native-html/transient-render-engine
An object to specify custom tags.
#
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
?
:
(
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
?
:
(
 Â
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
?
:
(
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.