You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While checking badge positions (coordinates, offsets, alignment with the icon), build with CYL_BADGE_ANIMATION_DISABLED on. An animated badge (Bounce, Shake, Scale, Breathe, the one-shot types) is drawn away from its laid-out place, so a screenshot taken during the animation gives wrong coordinates (2026-11-17: the HarmonyOS 消息 (Messages) badge looked 13 vp too low because a Bounce animation was still running). With the option on, the badge is drawn exactly where the layout puts it. Turn it off before committing; never commit or ship it on. After the positions are right, check once more with animations on. Label screenshots taken with it: "badge animations off (CYL_BADGE_ANIMATION_DISABLED)".
[CN]默认值
[EN]Default value
中文
English
本节按用户要求使用英文(见右列)。
Badge animation build controls default to NO (added 2026-11-17): every build control that turns badge animations off, including but not limited to the iOS Swift compilation condition CYL_BADGE_ANIMATION_DISABLED, the Android Gradle property -PcylBadgeAnimationDisabled (BuildConfig.CYL_BADGE_ANIMATION_DISABLED, also in the React Native and Flutter Android builds), the HarmonyOS buildProfileFields entry CYL_BADGE_ANIMATION_DISABLED in cylbadge/build-profile.json5, the WeChat Mini Program constant CYL_BADGE_ANIMATION_DISABLED in src/cyl-badge/cyl_badge_debug.js, and any badge animation switch added later, defaults to NO (not set, false): badges animate as the app asks. Set one to YES (true) only while debugging badges: badge coordinates, offsets and alignment with the icon or other views. Set it on locally only; never commit, merge, release or publish it as YES (no Podfile, Xcode project, gradle.properties, CI setting or package with it on), and set it back to NO when the debugging is done, then check once more with animations on. Checked 2026-11-17: no Podfile, Xcode project, .xcconfig, Package.swift, podspec or gradle.properties in the repository sets the iOS or Android control; the HarmonyOS entry and the Mini Program constant are false, and a Mini Program unit test fails if its constant is committed as true.
[CN]各平台的编译选项
[EN]The build option on each platform
中文
English
本节按用户要求使用英文(见右列)。
iOS (core, UIView+CYLBadgeExtention.swift, cyl_beginAnimation): the Swift compilation condition CYL_BADGE_ANIMATION_DISABLED on the CYLTabBarController pod target. In the Podfile's post_install: config.build_settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = '$(inherited) CYL_BADGE_ANIMATION_DISABLED' if target.name == 'CYLTabBarController', then pod install and a clean build.
Correction, 2026-11-29: the iOS badge code is now in its own CYLBadge pod, so set the condition on the CYLBadge target (the CYLTabBarController target in the row above is out of date).
本节按用户要求使用英文(见右列)。
Android (core, Example-Android/cylbadge, CYLBadgeView.play / playAnimator): the Gradle property -PcylBadgeAnimationDisabled=true (or cylBadgeAnimationDisabled=true in gradle.properties), read into the generated bool resource cyl_badge_animation_disabled. The React Native and Flutter components use the iOS and Android host views, so the same options apply to them.
本节按用户要求使用英文(见右列)。
HarmonyOS (core, CrossPlatform/harmonyos-cyltabbar/cylbadge, CYLBadge.ets, cylPlay): "CYL_BADGE_ANIMATION_DISABLED": true in buildOption.arkOptions.buildProfileFields of cylbadge/build-profile.json5, then rebuild. The generated cylbadge/BuildProfile.ets is ignored by git.
本节按用户要求使用英文(见右列)。
React Native and Flutter (assessed 2026-11-17): no own switch is needed. Neither has badge animation code of its own (React Native and Dart only pass badgeAnimation on); the badges are drawn by the iOS and Android cores. iOS: the same Podfile post_install setting on the CYLTabBarController pod target. Android: inside this repository their Android modules compile the library's sources (Example-Android/cyltabbar) themselves, under the com.cyl.tabbar namespace, so their android/build.gradle (React Native) and android/build.gradle.kts (Flutter) now generate the same BuildConfig.CYL_BADGE_ANIMATION_DISABLED from -PcylBadgeAnimationDisabled=true; without it, CYLBadge.kt did not compile there. Outside the repository they use the published Maven library, built with the option off.
本节按用户要求使用英文(见右列)。
WeChat Mini Program (core, CrossPlatform/wechat-miniprogram-cyltabbar/src/cyl-badge): its core animates badges itself with CSS keyframes (cyl-badge/cyl_badge_animations.wxss, the cyl-badge-<type> classes), so it has its own switch. A mini program has no compile-time defines, so the switch is a constant in the source: set CYL_BADGE_ANIMATION_DISABLED = true in cyl-badge/cyl_badge_debug.js (cyl-tab-bar/cyl_debug.js re-exports it), run npm run setup in example/ (it copies the component into miniprogram_npm), and recompile in WeChat DevTools. cylBadgeAnimationClass() then leaves out the animation class of the tabs' badges (cyl_tab_bar_item_model.js) of the plus button's badge (cyl-tab-bar/index.js) and of cyl-badge itself. A unit test fails if the constant is committed as true.
[CN]验证
[EN]Verification
中文
English
本节按用户要求使用英文(见右列)。
2026-11-17: HarmonyOS built with the option on and run on the Mate 70 Pro emulator (HarmonyOS 6.0.1, API 21, 127.0.0.1:5559), Liquid Glass. Four screenshots in a row of the 消息 "99+" and 我的 "NEW" badges are byte-identical (same MD5), so nothing moves (assets/badge-debugging-animations-off-harmonyos.png); with the option off (default) the HAP builds as before. Android: :cyltabbar:compileDebugKotlin passes with the property on and off, and BuildConfig has CYL_BADGE_ANIMATION_DISABLED = true / false. React Native and Flutter (Android, build mirror /tmp/xpa/cyl): :react-native-cyltabbar:compileDebugKotlin and :flutter_cyltabbar:compileDebugKotlin pass with the property on and off; the generated BuildConfig has CYL_BADGE_ANIMATION_DISABLED = true when on. WeChat Mini Program: npm test passes (20 tests, one new: off by default, cyl-badge-bounce when off, no class when on); npm run setup with the switch on copied it into the example, and npm run check passes after switching it back off. TODO: the DevTools check (badge classes in the simulator and screenshots with the switch on) did not run, because WeChat DevTools answered "Login is required" (it needs the maintainer's QR code login). iOS: swiftc -parse passes with and without -D CYL_BADGE_ANIMATION_DISABLED; TODO: a full simulator build with the condition on.
Correction, 2026-11-29: the iOS TODO in the row above is done: a full simulator build of Example-Swift-04 with the condition on succeeds (Xcode 27.2, iOS 27.2); screenshots under "Acceptance evidence" in Animated-Item-Badge.md.
HarmonyOS, Mate 70 Pro emulator, HarmonyOS 6.0.1, API 21 SDK (DevEco Studio 6.0.1), commit on feat/cross-platform-components after 136b4f5, 2026-11-17; badge animations off (CYL_BADGE_ANIMATION_DISABLED); four consecutive shots, top to bottom, left to right.