react-component / react-component/select

使用 optionLabelProp 自定义选中项, 无法通过外部依赖项更新选中项属性

Open
#1,027 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

场景:
自定义 Select 选中项后, 需要支持 dark mode 主题, Select 选中项文字样式跟随主题切换

问题:
外部感知到 dark mode 更新后, 尝试更新 Select 已 选中项 文字颜色, 结果更新失败

SandBox

https://github.com/react-component/select/assets/26668179/8959036b-c68c-46e2-8394-c9e5fd216e0e

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the linked CodeSandbox, using /src/App.tsx around line 86 and the Select configured with optionLabelProp. Trace how an external dark-mode update reaches the selected label. Done means the selected item's text color updates when the theme changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.