<view>
A container element similar to HTML's <div>
. Like <div>
, <view>
is a versatile container element that can hold other elements and serves as the foundation for building layouts. All attributes, events, and methods available on <view>
can be used by other elements.
Attributes and their values are used to describe the behavior and appearance of elements.
name
Used to specify the name of the element, generally for native to operate the corresponding node from the native side through findViewByName
.
id
Used to specify the unique identity of the element, which can be used by the front-end API to find and operate the corresponding node, such as invoke
.
style
Used to apply inline styles to elements.
class
Used to specify one or more class names for an element, which can be used in CSS to apply styles.
className
ReactLynxIn ReactLynx, use className
to set CSS class names, equivalent to class
.
data-*
Used to specify additional information for the element, which can be obtained in Event.
flatten
Android onlyOnly available on Android platform, used to force specific nodes to create corresponding Android Views.
exposure-id
Specify whether the target node needs to listen to exposure/anti-exposure events.
exposure-scene
Specify the exposure scene of the target node, and use it together with exposure-id
to uniquely identify the node that needs to monitor exposure.
exposure-ui-margin-*
Specify the boundary scaling value of the target node itself in the exposure detection, which affects the viewport intersection judgment of the target node. Each node can have its own boundary scaling value.
Before using this capability, you also need to set enable-exposure-ui-margin
for the current node.
exposure-screen-margin-*
Specify the screen boundary scaling value referenced by the target node in the exposure detection task, which affects the viewport intersection judgment of the target node. Each node can have its own screen boundary scaling value.
exposure-area
Specify the viewport intersection ratio of the target node that can trigger the exposure event. When it is greater than this ratio, the exposure event is triggered. When it is less than this ratio, the reverse exposure event is triggered. By default, the exposure event is triggered when the target node is exposed.
enable-exposure-ui-margin
Specify whether the target node supports the exposure-ui-margin-*
properties.
Setting it to true
will change the behavior of exposure-screen-margin-*
and may cause the lazy loading of the scrollable container to fail.
accessibility-element
Set whether the node supports accessibility.
accessibility-label
Set the content of the node voice broadcast.
If the <text/>
node does not set this attribute, the <text/>
node defaults to the <text/>
content.
When a node turns on the accessibility-element
attribute, it is recommended to set the accessibility-label
at the same time, so that the meaning of the current node can be more clearly expressed.
accessibility-trait
Set the type characteristics of the node. The system will have specific supplements to the playback content for different types of nodes.
accessibility-elements
Customize the focus order of child nodes. This property is set on the parent node, and the focus order of its child nodes will be focused according to the order of the child node id
specified by the accessibility-elements
property.
If the parent node is set with the accessibility-elements
property, only the child node with the id
specified by the accessibility-elements
property can be accessed, and other child nodes cannot be focused.
accessibility-elements-a11y
The same as accessibility-elements
, but the corresponding id
is a11y-id
.
accessibility-elements-hidden
Marks the current node and all its child nodes as non-accessible nodes.
accessibility-exclusive-focus
This property can be set for any node. In accessibility mode, sequential navigation will only focus on the child nodes under these nodes.
Usage scenario: Solve the problem of focus penetration in the pop-up mask: You can set this property to true for the mask node, so that the focus circulates inside the mask node and does not penetrate to other nodes under the mask.
a11y-id
Different from id
, it is used to identify barrier-free nodes separately.
ios-platform-accessibility-id
Used to specify the accessibility identifier of a UIView
in iOS. It is only used when the platform-level accessibility framework is accessed.
user-interaction-enabled
Specifies whether the target node and its child nodes can respond to Lynx touch events. This property does not affect platform-level gestures (such as scrolling of scroll-view
).
native-interaction-enabled
Specify whether the target node consumes platform-layer touch events, affects platform-layer gestures (such as scrolling of scroll-view
), does not affect Lynx touch events, and can achieve similar platform-layer gesture penetration/interception effects.
On the Android side, only supports setting effectiveness on the view
element.
Known differences between the two sides: Android supports platform-layer gesture penetration/interception of parent-child/sibling structures; iOS only supports platform-layer gesture penetration/interception of sibling structures.
block-native-event
Specify whether to block platform layer gestures outside Lynx when the target node is on the event response chain, which can achieve an effect similar to blocking the platform layer side sliding back.
block-native-event-areas
Specify whether to block platform layer gestures outside Lynx when the target node is on the event response chain and the touch is in the specified area of the target node, which can achieve a similar effect of blocking the platform layer side sliding back.
The inner array is an array containing 4
numbers, namely x
, y
, width
, height
, indicating the position of the touch area in the target node.
consume-slide-event
Specify the target node to slide a specific angle on the event response chain, whether the platform layer gesture responds, does not affect the touch event of Lynx, and can realize a front-end scrolling container similar to consuming the specified direction of sliding.
The inner array is an array containing 2 numbers, namely start
and end
, indicating the starting angle and the ending angle.
event-through
Specifies whether the touch event of the platform layer is distributed to Lynx when the touch is on the target node, which can achieve a similar effect of only displaying without interaction. This property supports inheritance.
This property can only ensure that Lynx does not consume the touch event of the platform layer, but the parent view of LynxView may consume the touch event, resulting in failure of penetration.
enable-touch-pseudo-propagation
Specify whether the target node supports the :active
pseudo-class to continue bubbling up on the event response chain.
hit-slop
Specify the touch event response hotspot of the target node, without affecting the platform layer gesture.
Other factors with higher priority may cause the hot zone modification to fail, such as the node's view hierarchy (z-index
, translateZ
, fixed
) is relatively high, the parent node's overflow
is hidden
, etc.
ignore-focus
Specify whether to not grab focus when touching the target node. By default, the node grabs focus when clicking on it, which can achieve a similar effect of not closing the keyboard when clicking other areas.
In addition, it also supports inheritance, that is, the default value of the child node is the ignore-focus
value of the parent node, and the child node can override this value.
ios-enable-simultaneous-touch
iOS onlySpecify whether to force trigger the touchend
event when the target node is on the event response chain, which can solve the problem that the iOS end does not trigger the touchend
event but triggers the touchcancel
event (the touchmove
event is also not continuous) in some scenarios.
__lynx_timing_flag
Add this flag to the current element to monitor the performance of the lynx pipeline it participates in.
When flagged, the lynx engine generates a PipelineEntry
event once the element completes its final painting phase.
This event can be observed and analyzed by registering a PerformanceObserver()
.For more detailed usage, see the Marking Lynx Pipeline.
The front end can set event handler property on the element to monitor the runtime behavior of the element.
touchstart
It belongs to touch event, which is triggered when the finger starts to touch the touch surface.
touchmove
It belongs to touch event, which is triggered when the finger moves on the touch surface.
touchend
It belongs to touch event, which is triggered when the finger leaves the touch surface.
touchcancel
It belongs to touch event, which is triggered when the touch event is interrupted by the system or Lynx external gesture.
tap
It belongs to touch event, which is triggered when the finger clicks on the touch surface.
This event and the longpress
event are mutually exclusive in event monitoring, that is, if the front-end monitors both events at the same time, the two events will not be triggered at the same time, and longpress
takes precedence.
longpress
It belongs to the touch event, which is triggered when the finger is long pressed on the touch surface, and the interval between long press triggers is 500 ms
.
layoutchange
It belongs to custom event, which is triggered when the target node layout is completed, and returns the position information of the target node relative to the LynxView viewport coordinate system.
uiappear
It belongs to custom event, which is triggered when the target node appears on the screen.
uidisappear
It belongs to custom event, which is triggered when the target node disappears from the screen.
animationstart
It belongs to animation event, which is triggered when the Animation animation starts.
animationend
It belongs to animation event, which is triggered when the Animation animation ends.
animationcancel
It belongs to animation event, which is triggered when the Animation animation is canceled.
animationiteration
It belongs to animation event, which is triggered every time the Animation animation is executed in a loop.
transitionstart
It belongs to animation event, which is triggered when the Transition animation starts.
transitionend
It belongs to animation event, which is triggered when the Transition animation ends.
transitioncancel
It belongs to animation event, which is triggered when the Transition animation is canceled.
The front end can execute the element method through the SelectorQuery API.
boundingClientRect
The front end can call this method to obtain the width, height and position information of the target node.
takeScreenshot
The front end can call this method to obtain the base64 image of the target node.
This operation will take up time in the main thread, so you need to pay attention to the calling frequency.
When used on Android, you need to set flatten
to false
on the corresponding node.
requestAccessibilityFocus
The front end can call this method to focus the accessibility focus on a barrier-free element.
LCD tables only load in the browser