<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.
nameUsed to specify the name of the element, generally for native to operate the corresponding node from the native side through findViewByName.
idUsed 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.
styleUsed to apply inline styles to elements.
classUsed 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-idSpecify whether the target node needs to listen to exposure/anti-exposure events.
exposure-sceneSpecify 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-areaSpecify 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-marginSpecify 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.
enable-exposure-ui-clipSpecify whether the exposure detection task takes into account the viewport clipping of the parent node. When set to true, nodes outside the parent node viewport cannot trigger exposure, and when set to false, nodes outside the parent node viewport can trigger exposure.
accessibility-elementSet whether the node supports accessibility.
accessibility-labelSet 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-traitSet the type characteristics of the node. The system will have specific supplements to the playback content for different types of nodes.
accessibility-elementsCustomize 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-a11yThe same as accessibility-elements, but the corresponding id is a11y-id.
accessibility-elements-hiddenMarks the current node and all its child nodes as non-accessible nodes.
accessibility-exclusive-focusThis 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-idDifferent from id, it is used to identify barrier-free nodes separately.
ios-platform-accessibility-id iOS onlyUsed to specify the accessibility identifier of a UIView in iOS. It is only used when the platform-level accessibility framework is accessed.
user-interaction-enabledSpecifies 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-enabledSpecify 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 and HarmonyOS support platform-layer gesture penetration/interception of parent-child/sibling structures; iOS only supports platform-layer gesture penetration/interception of sibling structures.
block-native-eventSpecify 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-areasSpecifies a touch area that blocks platform-layer gestures outside of Lynx. When the target node is in the event response chain and a touch is placed in the specified area of the target node, platform-layer gestures will be blocked, achieving an effect similar to preventing platform-layer side-swipe back.
This two-dimensional array contains arrays containing 4 elements. The 4 elements are x, y, width, and height, in units of px or %, representing the position, width, and height of the touch area within the target node.
For example, [['0px', '0px', '50%', '50%'], ['50%', '50%', '50%', '50%']] indicates that platform-layer gestures outside of Lynx will be blocked when touches are placed in the upper left and lower right areas of the node.
consume-slide-eventSpecifies the angle range within which all platform-level swipe gestures are blocked. When the target node is in the event response chain and the swipe angle is within this range, all platform-level swipe gestures are blocked. However, Lynx touch events continue to function, allowing front-end scrolling containers that consume swipes in the specified direction. However, native scrolling based on platform-level gestures is blocked.
This two-dimensional array contains several 2-element arrays, where the 2 elements are start and end, representing the start and end angles, respectively. The swipe angle is determined by the finger's press position and the finger's movement position.
For example, [[-180, -135], [-45, 45], [135, 180]] indicates that all platform-level swipe gestures are blocked when the swipe direction is horizontal, but they are enabled when the swipe direction is vertical.
event-throughSpecifies whether Lynx consumes touch events from the platform layer when a touch is on the target node, allowing for effects similar to display-only, non-interactive displays.
This property supports inheritance; that is, if event-through is not set for a child node, it inherits the event-through value from its parent node. Its active region is affected by event-through-active-regions. If not set, it defaults to the entire region of the target node.
Setting this property to true only ensures that Lynx does not consume touch events from the platform layer. However, Lynx's parent node may consume touch events, causing touch-through to fail.
event-through-active-regionsSpecifies the effective area for event-through.
This two-dimensional array contains several arrays containing 4 elements, where the 4 elements are x, y, width, and height, in units of px or %, representing the position, width, and height of the touch area within the target node.
For example, [['0px', '0px', '50%', '50%']] indicates that if the touch is in the upper left area of the node, Lynx will not consume touch events from the platform layer.
enable-touch-pseudo-propagationSpecify whether the target node supports the :active pseudo-class to continue bubbling up on the event response chain.
hit-slopSpecify the touch event response hotspot of the target node, without affecting the platform layer gesture.
For example, {top: '10px', left: '10px', right: '10px', bottom: '10px'} or 10px means the touch hotspot of the node is expanded by 10px.
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-focusSpecify 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.
This property supports inheritance, that is, when ignore-focus is not set on a child node, it will inherit the ignore-focus value of the parent node.
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_flagAdd 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.
touchstartIt belongs to touch event, which is triggered when the finger starts to touch the touch surface.
touchmoveIt belongs to touch event, which is triggered when the finger moves on the touch surface.
touchendIt belongs to touch event, which is triggered when the finger leaves the touch surface.
touchcancelIt belongs to touch event, which is triggered when the touch event is interrupted by the system or Lynx external gesture.
tapIt 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.
longpressIt 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.
layoutchangeIt 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.
uiappearIt belongs to custom event, which is triggered when the target node appears on the screen.
uidisappearIt belongs to custom event, which is triggered when the target node disappears from the screen.
animationstartIt belongs to animation event, which is triggered when the Animation animation starts.
animationendIt belongs to animation event, which is triggered when the Animation animation ends.
animationcancelIt belongs to animation event, which is triggered when the Animation animation is canceled.
animationiterationIt belongs to animation event, which is triggered every time the Animation animation is executed in a loop.
transitionstartIt belongs to animation event, which is triggered when the Transition animation starts.
transitionendIt belongs to animation event, which is triggered when the Transition animation ends.
transitioncancelIt 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.
boundingClientRectThe front end can call this method to obtain the width, height and position information of the target node.
takeScreenshotThe 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.
requestAccessibilityFocusThe front end can call this method to focus the accessibility focus on a barrier-free element.
LCD tables only load in the browser