npx claudepluginhub 15195999826/lomomarketplace --plugin UE_ReactUMGWant just this skill?
Then install: npx claudepluginhub u/[userId]/[slug]
ReactUMG 常见组件陷阱/坑/问题提醒。在使用 ComboBoxString、EditableTextBox、SpinBox、ScrollBox、ProgressBar 等复杂组件时激活。涵盖动态选项不生效、ref 回调重复调用、深色主题配置等常见问题的解决方案。
This skill uses the workspace's default tool permissions.
ReactUMG 常见组件陷阱
ComboBoxString 动态选项
⚠️ DefaultOptions 属性不工作!
// ❌ 错误:DefaultOptions 无效
const options = UE.NewArray(UE.BuiltinString);
options.Add("Option1", "Option2");
<ComboBoxString DefaultOptions={options} /> // 不会显示选项!
// ✅ 正确:必须用 ref + AddOption()
<ComboBoxString
ref={(ref) => {
if (ref?.nativePtr && !this.initialized) {
ref.nativePtr.ClearOptions();
ref.nativePtr.AddOption("Option1");
ref.nativePtr.AddOption("Option2");
ref.nativePtr.SetSelectedOption("Option1");
this.initialized = true;
}
}}
/>
推荐:封装 ManagedComboBoxString
// 使用封装组件(如果项目中有)
<ManagedComboBoxString
options={["Option1", "Option2"]}
selectedValue="Option1"
onSelectionChanged={(item) => console.log(item)}
/>
ref 回调优化
⚠️ 内联箭头函数导致重复调用
// ❌ 问题:每次 render 都创建新函数
<CanvasPanel ref={(ref) => { this.canvasRef = ref?.nativePtr; }} />
// React 会反复调用 ref(null) → ref(instance)
// ✅ 正确:构造函数中绑定
constructor(props) {
super(props);
this.boundHandleRef = this.handleRef.bind(this);
}
handleRef(ref) {
this.canvasRef = ref ? ref.nativePtr : null;
}
<CanvasPanel ref={this.boundHandleRef} /> // 固定引用
EditableTextBox 深色主题
<EditableTextBox
WidgetStyle={{
BackgroundImageNormal: {
TintColor: {
SpecifiedColor: {R: 0.004777, G: 0.004777, B: 0.004777, A: 1},
ColorUseRule: 0 // 必须!
},
DrawAs: 4, // RoundedBox
OutlineSettings: {
CornerRadii: {X: 4, Y: 4, Z: 4, W: 4},
RoundingType: 0
}
},
ForegroundColor: {
SpecifiedColor: {R: 0.5, G: 0.5, B: 0.5, A: 1},
ColorUseRule: 0 // 必须!
},
FocusedForegroundColor: {
SpecifiedColor: {R: 1, G: 1, B: 1, A: 1},
ColorUseRule: 0 // 必须!
}
}}
/>
关键点:
DrawAs: 4= RoundedBoxRoundingType: 0= FixedRadius- 所有 WidgetStyle 中的颜色都需要
ColorUseRule: 0
Similar Skills
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.