# useReactNativeValidPlatformColors

Rule `biome/useReactNativeValidPlatformColors`. Require `PlatformColor()` and `DynamicColorIOS()` calls to use values written directly in the call.

- Source: biome
- Technologies: React
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #605 by reach, #240 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/useReactNativeValidPlatformColors` | yes | no | group nursery, since 2.6.3 | [docs](https://biomejs.dev/linter/rules/use-react-native-valid-platform-colors/) |

## Code examples

### Incorrect: the rule reports this

```js
import { PlatformColor } from "react-native";

const color = PlatformColor();
```

```js
import { PlatformColor } from "react-native";

const labelColor = "labelColor";
const color = PlatformColor(labelColor);
```

```js
import { DynamicColorIOS } from "react-native";

const colors = { light: "black", dark: "white" };
const color = DynamicColorIOS(colors);
```

### Correct: the rule accepts this

```js
import { DynamicColorIOS, PlatformColor } from "react-native";

const label = PlatformColor("labelColor");
const accent = PlatformColor("controlAccentColor", "controlColor", { fallback: "red" });
const text = DynamicColorIOS({ light: "black", dark: PlatformColor("labelColor") });
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "useReactNativeValidPlatformColors": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/useReactNativePlatformComponents](https://lintradar.dev/rules/biome/useReactNativePlatformComponents.md): Ensure that platform-specific React Native components are only imported in files named for that platform.
- [biome/useSimpleNumberKeys](https://lintradar.dev/rules/biome/useSimpleNumberKeys.md): Disallow number literal object member names which are not base 10 or use underscore as separator.
- [biome/useReactAsyncServerFunction](https://lintradar.dev/rules/biome/useReactAsyncServerFunction.md): Require functions with the "use server" directive to be async.
- [biome/useSvelteEventDispatcherTypes](https://lintradar.dev/rules/biome/useSvelteEventDispatcherTypes.md): Require `createEventDispatcher` calls to declare the types of their events.
- [biome/useQwikValidLexicalScope](https://lintradar.dev/rules/biome/useQwikValidLexicalScope.md): Disallow unserializable expressions in Qwik dollar ($) scopes.
- [biome/useSvelteKitResolve](https://lintradar.dev/rules/biome/useSvelteKitResolve.md): Require internal navigation in SvelteKit apps to use paths built with `resolve()`.

---

Web page: https://lintradar.dev/rules/biome/useReactNativeValidPlatformColors. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
