For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/engine/element-api/__AddInlineStyle.md.
Lynx
  • English
  • __AddInlineStyle

    Introduction

    Adds inline styles to the Element object.

    Syntax

    __AddInlineStyle(element: Element, id: number, value: string|null|undefined) : void;

    Parameters

    KeyDescription
    elementAny Element object.
    idA number that corresponds to a style key, for example, 0 corresponds to the style top.
    valueThe style value to be set, which can be a string, null, or undefined. When a string is provided, the Lynx SDK will set the corresponding key and value for the Element; if previously set, it will overwrite the previous value. When null or undefined is provided, the Lynx SDK will remove the key from the inline styles of the Element.

    Return Value

    No return value.

    Example

    The frontend framework can process the corresponding frontend tags into render directives as shown below.

    <view src="xxx" style={{ top: '10px' }} />
    // main-thread.js
    let element = __CreateElement('view', 0, {});
    __SetAttribute(element, 'src', 'xx');
    
    __AddInlineStyle(element, 0, '10px');
    Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.