Skip to content

Commit c20800b

Browse files
authored
Add Prop Reference in README
Added Reference for Props in the README, similar to how it's done in `reactnative.dev`
1 parent b9dc665 commit c20800b

File tree

1 file changed

+107
-51
lines changed

1 file changed

+107
-51
lines changed

README.md

Lines changed: 107 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -77,59 +77,115 @@ return (
7777
}}
7878
/>
7979
);
80-
81-
type SegmentedControlIOSProps = $ReadOnly<{|
82-
...ViewProps,
83-
/**
84-
* The labels for the control's segment buttons, in order.
85-
*/
86-
values?: $ReadOnlyArray<string>,
87-
/**
88-
* The index in `props.values` of the segment to be (pre)selected.
89-
*/
90-
selectedIndex?: ?number,
91-
/**
92-
* Callback that is called when the user taps a segment;
93-
* passes the segment's value as an argument
94-
*/
95-
onValueChange?: ?(value: number) => mixed,
96-
/**
97-
* Callback that is called when the user taps a segment;
98-
* passes the event as an argument
99-
*/
100-
onChange?: ?(event: Event) => mixed,
101-
/**
102-
* If false the user won't be able to interact with the control.
103-
* Default value is true.
104-
*/
105-
enabled?: boolean,
106-
/**
107-
* Accent color of the control.
108-
*/
109-
tintColor?: ?string,
110-
/**
111-
* (For iOS >= 13)
112-
* Text color of the control.
113-
*/
114-
textColor?: ?string,
115-
/**
116-
* Text color of the control when selected.
117-
* NOTE: this prop will only work for iOS >= 13
118-
*/
119-
activeTextColor?: ?string,
120-
/**
121-
* (For iOS >= 13)
122-
* Background color of the control.
123-
*/
124-
backgroundColor?: ?string,
125-
/**
126-
* If true, then selecting a segment won't persist visually.
127-
* The `onValueChange` callback will still work as expected.
128-
*/
129-
momentary?: ?boolean,
130-
|}>;
13180
```
13281

82+
---
83+
84+
# Reference
85+
86+
## Props
87+
88+
Inherits [View Props](view.md#props).
89+
90+
### `enabled`
91+
92+
If false the user won't be able to interact with the control. Default value is true.
93+
94+
| Type | Required |
95+
| ---- | -------- |
96+
| bool | No |
97+
98+
---
99+
100+
### `momentary`
101+
102+
If true, then selecting a segment won't persist visually. The `onValueChange` callback will still work as expected.
103+
104+
| Type | Required |
105+
| ---- | -------- |
106+
| bool | No |
107+
108+
---
109+
110+
### `onChange`
111+
112+
Callback that is called when the user taps a segment; passes the event as an argument
113+
114+
| Type | Required |
115+
| -------- | -------- |
116+
| function | No |
117+
118+
---
119+
120+
### `onValueChange`
121+
122+
Callback that is called when the user taps a segment; passes the segment's value as an argument
123+
124+
| Type | Required |
125+
| -------- | -------- |
126+
| function | No |
127+
128+
---
129+
130+
### `selectedIndex`
131+
132+
The index in `props.values` of the segment to be (pre)selected.
133+
134+
| Type | Required |
135+
| ------ | -------- |
136+
| number | No |
137+
138+
---
139+
140+
### `tintColor`
141+
142+
Accent color of the control.
143+
144+
| Type | Required |
145+
| ------ | -------- |
146+
| string | No |
147+
148+
---
149+
150+
### `textColor`
151+
152+
Text color of the control. (iOS 13+ only)
153+
154+
| Type | Required | Supported Version |
155+
| ------ | -------- | ----- |
156+
| string | No | iOS 13+ |
157+
158+
---
159+
160+
### `activeTextColor`
161+
162+
Text color of the active control. (iOS 13+ only)
163+
164+
| Type | Required | Supported Version |
165+
| ------ | -------- | ----- |
166+
| string | No | iOS 13+ |
167+
168+
---
169+
170+
### `backgroundColor`
171+
172+
Background color color of the control. (iOS 13+ only)
173+
174+
| Type | Required | Supported Version |
175+
| ------ | -------- | ----- |
176+
| string | No | iOS 13+ |
177+
178+
---
179+
180+
### `values`
181+
182+
The labels for the control's segment buttons, in order.
183+
184+
| Type | Required |
185+
| --------------- | -------- |
186+
| array of string | No |
187+
188+
133189
## Maintainers
134190

135191
- [M.Haris Baig](https://github.com/harisbaig100)

0 commit comments

Comments
 (0)