Skip to content

Commit 6162874

Browse files
committed
Add more docs
1 parent 95f540b commit 6162874

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

docsite/api/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ slug: /
77

88
Welcome to the React Native macOS API reference documentation. This section covers macOS-specific props and events that extend the standard React Native components.
99

10-
Most of the additional functionality out of React Native macOS directly is in the form of additional props and callback events implemented on `<View>`, to provide macOS and desktop specific behavior
10+
Most of the additional functionality out of React Native macOS directly is in the form of additional props and callback events implemented on `<View>`, to provide macOS and desktop specific behavior. We also have some additional APIs, like platform specific colors.

docsite/api/platform-color.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
sidebar_label: 'Platform Colors'
3+
sidebar_position: 2
4+
---
5+
6+
# Platform Colors
7+
8+
React Native macOS extends the core `PlatformColor` API with helpers that map directly to AppKit system colors. These helpers make it easier to adopt macOS appearance and accessibility behaviors without writing native code.
9+
10+
## `DynamicColorMacOS`
11+
12+
`DynamicColorMacOS` creates a color that automatically adapts to light, dark, and high-contrast appearances on macOS.
13+
14+
:::note
15+
`DynamicColorIOS` works on macOS too, they are essentially equivalent
16+
:::
17+
18+
| Option | Description |
19+
| -------------------- | --------------------------------------------------------------- |
20+
| `light` | Color used in the standard light appearance. |
21+
| `dark` | Color used in the standard dark appearance. |
22+
| `highContrastLight` | Optional color for high-contrast light mode. Defaults to `light`.|
23+
| `highContrastDark` | Optional color for high-contrast dark mode. Defaults to `dark`. |
24+
25+
## `ColorWithSystemEffectMacOS`
26+
27+
`ColorWithSystemEffectMacOS(color, effect)` wraps an existing color so AppKit can apply control state effects such as pressed, disabled, or rollover.
28+
29+
| Parameter | Description |
30+
| --------- | ----------- |
31+
| `color` | A string produced by `PlatformColor`, `DynamicColorMacOS`, or a CSS color string. |
32+
| `effect` | One of `none`, `pressed`, `deepPressed`, `disabled`, or `rollover`. |
33+
34+
```javascript
35+
import {
36+
ColorWithSystemEffectMacOS,
37+
DynamicColorMacOS,
38+
PlatformColor,
39+
StyleSheet,
40+
} from 'react-native';
41+
42+
const styles = StyleSheet.create({
43+
buttonPressed: {
44+
backgroundColor: ColorWithSystemEffectMacOS(
45+
PlatformColor('controlColor'),
46+
'pressed',
47+
),
48+
},
49+
});
50+
```

docsite/sidebarsApi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
33
const sidebars: SidebarsConfig = {
44
apiSidebar: [
55
'intro',
6+
'platform-color',
67
'view-props',
78
'view-events',
89
],

0 commit comments

Comments
 (0)