Lynx

Feature Flags

Guides important Lynx flags for Crispy and conditions for maintaining and omitting them by engine and build tool versions.

Divide Lynx flags into features needed for Crispy's styles and behavior and features selected per screen. Even if a feature is needed, you can omit the configuration if the plugin already enables it. Conversely, if an option disappears from the build tool, the engine's feature is not necessarily removed.

The minimum supported Lynx Engine for Crispy is 3.6. This document explains when to keep and when to remove each flag, rather than requiring you to upgrade the engine version.

The following is the basic configuration for apps using Crispy's CSS inheritance, inline variables, Dynamic/Static typography, and fixed elements. Selector and Invalidation use the default values of pluginReactLynx. For screens using multi-touch information, add enableMultiTouch: true, and also check the globalPropsMode description below for runtime updates of theme and motion settings.

lynx.config.ts
import { defineConfig } from "@lynx-js/rspeedy";
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
import { pluginLynxConfig } from "@lynx-js/config-rsbuild-plugin";

export default defineConfig({
  plugins: [
    pluginReactLynx({
      engineVersion: "3.6", // Minimum Engine the app should support. Does not change the actual runtime engine.
    }),
    pluginLynxConfig({
      enableCSSInheritance: true,
      enableCSSInlineVariables: true,
      fontScaleEffectiveOnlyOnSp: true,
      enableFixedNew: true,
    }),
  ],
});

The options and default values in the example are verified against the following released package combination. For other versions, also check the types and changelog of the installed packages.

@lynx-js/react-rsbuild-plugin@lynx-js/config-rsbuild-plugin@lynx-js/type-config used by the config plugin@lynx-js/rspeedy
0.18.30.2.24.1.30.16.4
0.20.20.2.34.2.00.17.2

@lynx-js/type-config is the type and key list of configurations allowed in the build. A version of 4.2.0 does not mean the app runs on Engine 4.2 or that Engine 4.2 has been released. Check Lynx versions to see if the runtime engine has been released.

Configuration Location and How to Read Versions

CategoryMeaning
Actual Lynx EngineThe engine used by the app's native host. It actually reads and executes the configuration.
engineVersion / targetSdkVersionThe target version of the bundle. Determines compatibility branching for some default values. Does not upgrade the engine.
Plugin default valuesValues inserted by the plugin when creating the bundle. May differ from the engine's own defaults.
Host settings / native configApp and platform settings that the engine reads when some flags are omitted. Results may differ per app.

Starting with React plugin 0.9.0, targetSdkVersion was deprecated and maintained as an alias for engineVersion. The verified 0.18.3 and 0.20.2 allow both, but use engineVersion for new configurations. If both are specified, engineVersion takes priority, and the plugin default when both are omitted is 3.2. When referring to target SDK below, it means this target version passed to the engine. Package change history

PluginItems to configure
pluginReactLynxOptions exposed to React build such as enableCSSSelector, enableCSSInvalidation, enableCSSInheritance, customCSSInheritanceList, enableNewGesture
pluginLynxConfigOptions exposed to Config and CompilerOptions for that version. The four items in the minimum example and supported event/layout options

While some keys exist in both plugins, you cannot consolidate all flags into pluginLynxConfig. The verified React plugin reads and overwrites only keys in its own default option list from shared config. The config plugin validates public keys and passes them to compiler and page settings, rejecting keys outside the list with an error. Set the same key in only one place. React implementation · Config implementation

Flags that matter in Crispy

Keep enabled means the feature is required, and keep explicitly set means the option must remain in the code. The following table is based on settings confirmed in Engine 3.6·3.7·3.8·3.9·4.0·4.1 release tags. true/false are the values when there is no separate host override; exceptions are explained below.

FlagWhy it matters in CrispyEngine 3.6–3.7Engine 3.8–4.0Engine 4.1Where to set it
enableCSSSelectorCrispy CSS matching such as class and descendant/child selectorsKeep enabled, omit for React defaultSameSameReact
enableCSSInvalidationUpdates combined-selector styles when an ancestor's class etc. changesKeep enabled, omit for React defaultSameSameReact
enableCSSInheritanceInheritance of color/typography for child textSet true explicitlySet true explicitlySet true explicitlyConfig or React
enableCSSInlineVariablesCSS variables that components pass inlineSet true explicitlySet true explicitlySet true explicitlyConfig
fontScaleEffectiveOnlyOnSpDistinguishes Dynamic (sp) vs Static (px) typographySet true explicitlySet true explicitlySet true explicitlyConfig
enableFixedNewLayout/insertion handling for fixed elementsRecommended true when using fixedSameSee explanation below if a different unified fixed path is enabledConfig
enableMultiTouchUses multi-finger event info in touch-based components/screensSet true explicitly if multi-touch is neededSameSameConfig
globalPropsModeDelivers host setting changes such as theme·reduced motion to Crispy hooksChoose default "reactive" or event-subscription "event"SameSameReact
enableTextRefactorImproved path for text measurement·baseline etc.Omit if target SDK ≥ 2.2SameNot exposed in latest Config
enableFlexBasisZeroPercentWhen choosing web-like flex shorthand interpretationNot supportedtrue if neededCan be omitted if target SDK ≥ 4.1, otherwise true if neededConfig

The condition for omitting Selector·Invalidation is that the default value true was confirmed in React plugin 0.18.3·0.20.2. It does not mean "always on from Engine 3.6 and up." The first version where older plugins changed their default is unconfirmed.

CSS matching and updates

The engine compiler config default for both enableCSSSelector and enableCSSInvalidation is false. The React plugin sets both to true, so you don't need to repeat them in the minimal example. If you do need to set them explicitly, use the following location. Engine config · React options

Both are options of the shared CSS compiler/style engine; the config definition's introduction record is Selector 2.8, Invalidation 2.10. This introduction record does not mean the React plugin's default enable point.

pluginReactLynx({
  enableCSSSelector: true,
  enableCSSInvalidation: true,
});

Invalidation makes the styles of affected descendant elements recompute when an ancestor's class etc. changes, when a selector like .a .b is present. Turning it off does not recompute all styles — rather, even if a combined selector matched initially, subsequent related style updates from later changes may not run.

Collecting and updating the affected elements also has a cost. The official docs say you can turn it off for performance if you don't use such selectors, but don't turn it off without checking whether Crispy and the app's state/theme updates need it. Official explanation · 3.6 doc source

This flag does not mean all web selectors are supported. Crispy Lynx's state styles use the className that the recipe variant produces. Don't assume you can carry over the web's data-* attribute selector as-is.

CSS inheritance and inline variables

These two options are different features. Official Config explanation · 3.6 config definition

FlagPlatform·introduction recordDefault and retention condition
enableCSSInheritanceAndroid·iOS·HarmonyOS, Since 1.6 in the config definitionEngine/React default false. Keep true for Crispy's inherited text styles. No engine version boundary found for uniformly omitting it, up through the confirmed 4.1
enableCSSInlineVariablesShared style engine, Since 3.6false by definition, native/settings fallback possible if omitted. Keep true for the CSS variables that Crispy components pass inline. Do not omit unless host enablement is guaranteed

CSS inheritance applies to the range of properties Lynx supports. It does not mean all web properties inherit the same way. If you need to change the inheritance list, use customCSSInheritanceList on pluginReactLynx. This is an option that specifies the list rather than adding to the default list, so make sure not to omit inheritance properties Crispy uses.

Turning off enableCSSInlineVariables does not remove the stylesheet's CSS variables themselves. Also, do not treat class-based theme switching and inline variable updates as the same feature.

Text and layout

FlagPlatform·introduction recordWhen to set it and when to omit it?
fontScaleEffectiveOnlyOnSpAndroid·iOS·HarmonyOS, Since 2.4Default false. Keep true since Crispy's Dynamic tokens are sp and Static tokens are px. The claim that system scaling applies to all px margins/icons is inaccurate; this option controls scaling of font-related lengths
enableFixedNewAndroid·iOS·HarmonyOS, Since 2.10Default false, settings fallback possible. Recommended true when using fixed elements. 4.1 also has a unified fixed path, so distinguish the case where the host enables that path, but don't remove it based on Engine version alone
enableTextRefactorAndroid·iOS, Since 2.2false by definition, but true when unspecified if target SDK ≥ 2.2. The confirmed React plugin's default target SDK is also 3.2, so no separate true is needed. Not an option that guarantees the same font size/measurement results as the web
enableFlexBasisZeroPercentAndroid·iOS·HarmonyOS, Since 3.8Treats an omitted basis such as in flex: 1 as 0% instead of 0. Not recommended as a required condition for all of Crispy. 3.8–4.0 default false, 4.1 defaults to true when target SDK ≥ 4.1

3.6 definition · 3.8 definition · 4.1 definition · 4.1 decoder · fixed handling

Even when running on Engine 4.1, the flex-basis default of a bundle with engineVersion: "3.6" does not change automatically. If you need only this behavior, set the flag on a supported engine. Don't raise the app's minimum target version just to change the default. Engine 3.6 does not have this flag, so setting true does not guarantee the same behavior.

Touch and host setting updates

enableMultiTouch and globalPropsMode matter for interaction and setting updates on screens that use Crispy, but they are not options that force a particular value on every screen.

SettingDefault and meaning in CrispyRetention/omission condition
enableMultiTouch: trueDefault false, settings fallback possible if unspecified. Includes multiple finger info in Android·iOS·HarmonyOS touch events. The engine definition's Since is 2.14, and the current public API docs list it as 3.2. Crispy Slider etc. read touches·changedTouches, but also support a single-touch coordinate fallback.Keep true for features that use multi-finger info. Not considered required for all Crispy components that only use single touch. No basis was found for uniformly omitting it based on engine version alone, across the confirmed 3.6–4.1.
globalPropsMode: "event"The React plugin's default is "reactive". "event" delivers global props changes via event subscription. Crispy's useSeedClassName, icon color, and ScaleFeedback hooks read theme·motion changes through useGlobalProps().Keep "event" if using the event-subscription approach. The default "reactive" can also be used, so "event" is not a required value for Crispy. This is not a flag removed because of engine version, but a choice of React's update method.

Multi-touch official explanation · 3.6 config definition · globalPropsMode official explanation

In the confirmed React 0.125.0, useGlobalProps() directly subscribes to change events in "event" mode. So there is no need to add a duplicate event listener for Crispy components using this hook. On the other hand, if app code only reads lynx.__globalProps directly, it does not subscribe to changes, so use the hook or an explicit event subscription wherever you need to react to runtime changes such as theme. React implementation

enableMultiTouchParamsCompatible is a payload-compatibility option separate from enabling multi-touch. Don't substitute this option, which is missing from the public config, in its place — set enableMultiTouch according to the feature you need.

Flags you choose when using a feature

The following options are not required settings for all of Crispy. Choose them when a given screen depends on that API or behavior. The introduction record in the table is the Since of the engine config definition. Items whose actual per-platform support is unclear are marked separately.

Events and gestures

FlagRole·platform·introduction recordDefault and setting conditionCurrent setting location
enableNewGestureGesture Handler path. Android·iOS·HarmonyOS, Since 2.16Engine/React default false. true for screens using the Gesture Handler API; not required for plain bindtap alone. No uniform omission boundary found across confirmed 3.6–4.1Recommended for React. Also exposed in Config
enableEventHandleRefactorEvent listener rebinding·dispatch path. Android·iOS·HarmonyOS, Since 3.5false by definition, uses settings if unspecified. Keep true if that path is needed. Does not mean dynamic changes to normal React event handlers are entirely impossibleRe-exposed starting Config 0.2.1 (added in type-config 4.1.2; the plugin here uses 4.1.3)
enablePlatformGestureCoordination layer between native and Lynx gestures. Android·iOS, Since 3.6Default false. Consider when coordinating contention with native gestures. Engine 4.1 also has usages, so it is not classified as removedExcluded from public config starting Config 0.2.0
enableTransformedTouchPositionTouch coordinates reflecting transform. Android·HarmonyOSDefault false. Consider for features using transformed elements' coordinates. Official Since is 3.6, but the 3.6.0 tag has no config definition while 3.7.0 does, so the 3.6 introduction boundary is unconfirmedCurrently exposed in Config
enableMultiTouchParamsCompatibleMakes multi-touch payload compatible with the single-touch format. Android·iOS·HarmonyOS, Since 3.2false by definition, uses the host's multi-touch environment setting if unspecified. If relying on old payloads, don't unconditionally remove the legacy setting — check the event-consuming code. Separate from enableMultiTouch itselfExcluded from public config starting Config 0.2.0

Official Config explanation · 3.6 definition and fallback · 4.1 definition · Config changelog

enableMultiTouch is currently exposed in Config as well. Don't interpret the disappearance of enableMultiTouchParamsCompatible as multi-touch itself being discontinued. Apps that still need to control an option missing from the latest public API must check the host's config path and existing behavior, and should not simply move it to the React plugin.

Observation and rendering

FlagRole·platform·introduction recordDefault and retention/omission conditionCurrent setting location
enableNewIntersectionObserverObserver path that doesn't depend on scroll event binding. Android·iOS, Since 2.8In the React build combinations confirmed below, the template sets true, so it can be omitted. In other build paths, don't remove it based on engine version aloneConfig
enableVsyncAlignedFlushPath that aligns UI-operation flush to VSync. Per the config definition, Android 2.11, iOS 3.2Default false. Choose after measuring performance/latency on screens with high update frequency. The config definition alone does not guarantee the same effect on iOS as on AndroidExcluded from public config starting Config 0.2.0
unifyVWVHBehaviorUnifies viewport-unit calculation for layout/dynamic styles. Android·iOS·HarmonyOS, Since 2.3false by definition, defaults to true if target SDK ≥ 2.3. Can be omitted at the confirmed React plugin's default target version. Disabling it does not mean all vw/vh are always fixed to their initial valueConfig

Observer default change · 3.9 decoder · 3.9 settings fallback · 4.1 decoder · 4.1 settings fallback

Observer requires checking both the build and the engine.

  • React build: In the two combinations confirmed above, @lynx-js/template-webpack-plugin 0.15.0·0.16.1 set enableNewIntersectionObserver: true in the page config. If not overwritten by Config or another plugin, you can omit the explicit setting. The first version this build default was introduced in is unconfirmed. Release template code
  • Engine: The config definition default is false through 3.8.1 and true starting 3.9.0. However, the 3.9·4.1 decoders also read settings when the bundle has no value, and that fallback is false. Don't remove it in apps using a different build path just because Engine is 3.9 or higher.

Performance and alternative style paths

The items below have all been excluded from the default public config starting with config plugin 0.2.0. Don't add them to new examples. They are allowed in the older config plugin 0.1.1, but are not uniformly recommended as general optimization settings needed by Crispy. Config changelog · Current types

FlagRole·platform·introduction recordDefault and judgment
enableCSSLazyImportHandles scoped CSS's import dependency on demand. Android·iOS·HarmonyOS, Since 2.18Falls back to environment settings when unspecified, and the default fallback is false. Choose after checking scoped CSS usage and initial cost. Engine path also exists in confirmed 4.1
enableTextLayoutCacheReuses text layout/renderer. Android·iOS, Since 3.3Follows the platform environment setting if unspecified. Does not guarantee the same default/performance gain on all platforms. Cache-option usage also exists in confirmed 4.1 iOS
enableCSSClassMergeLegacy compiler path that merges CSS declarations for the same selector. Shared CSS compiler, Since 2.1Default false by definition. The new Selector path merges declarations on its own, so no separate flag is needed on the React default Selector path. Not to be described as a simple bundle-size optimization option
enableSimpleStylingSeparate StyleObject-based style path. Shared style engine, Since 3.3Default false. Do not add to normal Crispy CSS config. Don't interpret the fact that the setting and related implementation remain as feature removal or always-enabled
enablePropertyBasedSimpleStyleChanges SimpleStyle updates from StyleObject-unit to property-unit. Shared style engine, Since 3.5Default false. A choice about handling and performance of overlapping-property StyleObjects; does not mean a generally faster optimization

3.6 definition · 4.1 definition · CSS class merge implementation · SimpleStyle implementation · Text cache usage

Cleaning up old configuration

First check the build package version, then check the existing app's behavioral dependencies. @lynx-js/config-rsbuild-plugin used type-config 3.6.0 in 0.1.1, then switched to 4.1.1's public list in 0.2.0. The keys excluded below were dropped from the default types/validation without a separate deprecation grace period. Change history

Old settingJudgment under the latest settingWhen continuing to use older tools/engines
Config's enableCSSSelector: true·enableCSSInvalidation: trueRemoved from Config. Leave to React 0.18.3·0.20.2 defaults, or move to React optionsThe engine feature is still needed. If the React default in use differs, or it's a different build path, keep it explicitly enabled
enableCSSStrictMode: falseNot exposed starting Config 0.2.0, removed from the minimal exampleConfig definition Since 1.6, default false. An option for strict handling/diagnostics in the shared CSS parser; no reproducible basis was found that false is a required workaround for using Crispy
enableTextRefactor: trueNot exposed starting Config 0.2.0. No explicit setting needed if target SDK ≥ 2.2A conditional decoder and iOS usages exist in Engine 3.6·4.1. Omitted based on the target SDK default, not because the feature was removed or is always enabled
enableMultiTouchParamsCompatibleRemoved from Config's public settings, but multi-touch itself is not removedKeep it if payload compatibility is needed and an older tool allows it. Check the host fallback if unspecified
enablePlatformGesture·enableVsyncAlignedFlush and the performance options aboveNot exposed starting Config 0.2.0. Excluded from new examplesIf the existing feature is needed, check the meaning of the old setting. Don't guess at alternative public options or an engine cutoff version
enableEventHandleRefactorExcluded in Config 0.2.0, but re-exposed starting 0.2.1Check the public list per version. Don't classify it as permanently discontinued

enableCSSStrictMode still has parser config and usages in the confirmed Engine 3.6·4.1. For example, the length parser outputs diagnostics for invalid values depending on this value, but that example alone cannot be used to claim that false allows every invalid length, or that true gives parsing fully identical to the web. Parser implementation

Basis and scope of verification

This document is the result of comparing the types/defaults/config-passing code of released packages, official version docs, and Engine release tags. It is not the result of running each combination on native devices.

  • Introduction record: The Since in the table is from 3.6 config definition and 4.1 config definition. Some past features are listed as Since 3.2 in the current API docs, so older tags were also referenced to avoid confusing the introduction record with the default-enable point. The initial release tag and per-platform introduction timing for items before 3.2 were not separately confirmed.
  • Exact boundary unconfirmed: The gap between enableTransformedTouchPosition's 3.6 introduction record and the 3.6.0 tag, the first package version where Selector·Invalidation defaulted to true in React, the first version the Observer's template default was enabled, and the per-platform effect/change boundary of VSync flush are all unconfirmed.
  • Removal judgment: Exclusion from public config was not marked as engine feature removal. Flags with a host fallback or another execution path are not assumed to be "unneeded" based on engine version alone. Unverified later versions and unreleased changes on next/main are also not applied.

Table of contents