@carlos3g/element-dropdown

中文文档
2.18.1发布于 2026/04/23MITTypeScriptESM + CJS构建来源已验证近 30 天下载 2226

A maintained React Native dropdown and multi-select. Drop-in fork of react-native-element-dropdown, actively shipping upstream bug fixes with signed releases via npm Trusted Publishing.

原始使用文档
文档目录8 节
  1. Why this fork
  2. What you get
  3. Quick example
  4. Use with AI assistants
  5. Sample prompt
  6. Demo
  7. Contributing
  8. License

react-native-element-dropdown, maintained.

📚 Full documentation →

A drop-in fork of react-native-element-dropdown. Bugs get fixed, the toolchain stays current, and every release is signed. Same API, same components (Dropdown, MultiSelect, SelectCountry), same props — change two lines and keep shipping.

npm install @carlos3g/element-dropdown
- import { Dropdown } from 'react-native-element-dropdown';
+ import { Dropdown } from '@carlos3g/element-dropdown';

Why this fork

The original package is unmaintained — a large open issue backlog, plus clean community PRs sitting untouched for years. If you're already on react-native-element-dropdown, you've probably hit at least one of these:

  • Invariant Violation: scrollToIndex out of range when searching long lists
  • The list flashes at the wrong position for a frame when you reopen it
  • IDropdownRef / IMultiSelectRef missing when you build for web or Expo
  • Every item has a non-overridable padding: 17 — itemContainerStyle can't shrink it
  • MultiSelect trigger uses placeholderStyle even after you've selected something

Fixed — along with plenty more. See the roadmap in docs/upstream-triage.md and per-version detail in the release notes.

What you get

  • Dropdown + MultiSelect + SelectCountry — three components, one package, same feel on iOS and Android
  • Drop-in migration — public API unchanged from [email protected], peerDependencies: *
  • Active maintenance — upstream bugs get triaged and fixed in every release; see the changelog for the current set
  • Better defaults — per-item disable via disabledField, hitSlop for bigger tap targets, allowFontScaling, isInsideModal for nested Modal positioning
  • Proper accessibility — trigger announces as combobox, items expose selected/disabled state
  • A real test suite — integration tests cover the core interaction flows
  • Signed releases — published via npm Trusted Publishing, with provenance attestation on every version

Quick example

import { useState } from 'react';
import { Dropdown } from '@carlos3g/element-dropdown';

const data = [
  { label: 'Apple', value: 'apple' },
  { label: 'Banana', value: 'banana' },
];

export function FruitPicker() {
  const [value, setValue] = useState<string | null>(null);
  return (
    <Dropdown
      data={data}
      labelField="label"
      valueField="value"
      placeholder="Pick a fruit"
      value={value}
      onChange={(item) => setValue(item.value)}
    />
  );
}

For the full API (Dropdown, MultiSelect, SelectCountry), migration guide, and 18 hands-on recipes, see the docs.

Use with AI assistants

This package is designed to work well with LLM-powered tools (Claude, Cursor, GitHub Copilot, ChatGPT, Aider, etc.):

  • llms.txt / llms-full.txt — the docs site exposes both files at the root, following the llmstxt.org standard:
    • /llms.txt — short manifest with links to every page
    • /llms-full.txt — every doc page concatenated, optimized for a single fetch
  • Rich JSDoc on every prop in DropdownProps, MultiSelectProps, and SelectCountryProps — your IDE's IntelliSense (and any AI integrated with it) sees @default, @example, and links to the matching guide for each prop.
  • Stable, drop-in API — agents can safely refactor existing react-native-element-dropdown codebases just by changing the install name and import path.

Sample prompt

"I'm using @carlos3g/element-dropdown. Read its full documentation at https://carlos3g.github.io/element-dropdown/llms-full.txt and build me a <UserPicker> component that wraps MultiSelect, debounces search, paginates with onEndReached, and shows a sticky modal header with a counter."

Demo


Contributing

See the upstream triage at docs/upstream-triage.md for the current roadmap and the prioritized list of upstream issues and PRs worth porting. Issues and pull requests are the interface — please include a repro when filing.

License

MIT — see LICENSE. This is a fork; the original copyright is preserved in contributor metadata.

版本与发布记录

@carlos3g/element-dropdown 共发布 8 个版本,首次发布于 2026/04/19;过去 12 个月发布了 8 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
2.18.1latest2026/04/236 个月前
2.18.02026/04/206 个月前
2.17.02026/04/206 个月前
2.16.02026/04/206 个月前
2.15.02026/04/206 个月前
2.14.02026/04/196 个月前

关于 @carlos3g/element-dropdown 的常见问题

@carlos3g/element-dropdown 是什么?

A maintained React Native dropdown and multi-select. Drop-in fork of react-native-element-dropdown, actively shipping upstream bug fixes with signed releases via npm Trusted Publishing.

如何安装 @carlos3g/element-dropdown?

在项目目录运行 npm install @carlos3g/element-dropdown,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(*)、react-native(*)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@carlos3g/element-dropdown 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@carlos3g/element-dropdown 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@carlos3g/element-dropdown 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@carlos3g/element-dropdown 可以商用吗?

@carlos3g/element-dropdown 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@carlos3g/element-dropdown 的下载量有多少?

根据 npm 官方下载统计,@carlos3g/element-dropdown 在 2026/10/09 – 2026/11/07 这 30 天内被下载 2,226 次,日均约 74 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@carlos3g/element-dropdown 还在维护吗?

最新版本 2.18.1 发布于 2026/04/23(6 个月前);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/04/19。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。