Skip to content

Commit cd63b88

Browse files
committed
docs: document Card, Dialog, List and ToggleButton.Row breaking changes
1 parent bae10cc commit cd63b88

1 file changed

Lines changed: 96 additions & 0 deletions

File tree

‎docs/6.x/docs/guides/migration.md‎

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,99 @@ const theme = {
126126
style={{ fontSize: 16, color: '#1C1B1F' }}
127127
/>
128128
```
129+
130+
### Card
131+
132+
#### `Card.Actions`
133+
134+
`Card.Actions` no longer assigns `mode` to its buttons, previously `outlined` for the first one and `contained` for the rest, and no longer injects `compact`. Set both on the buttons.
135+
136+
```tsx
137+
// Before (v5)
138+
<Card.Actions>
139+
<Button>Cancel</Button>
140+
<Button>Ok</Button>
141+
</Card.Actions>
142+
143+
// After (v6)
144+
<Card.Actions>
145+
<Button mode="outlined">Cancel</Button>
146+
<Button mode="contained">Ok</Button>
147+
</Card.Actions>
148+
```
149+
150+
#### `Card.Content`
151+
152+
`Card.Content` uses the same vertical padding everywhere. Before it changed depending on the sections next to it.
153+
154+
### Dialog
155+
156+
#### `Dialog.Actions`
157+
158+
`Dialog.Actions` no longer injects `compact` and `uppercase` into the action buttons. Set them yourself if you want the old look.
159+
160+
```tsx
161+
// Before (v5)
162+
<Dialog.Actions>
163+
<Button onPress={hide}>Done</Button>
164+
</Dialog.Actions>
165+
166+
// After (v6)
167+
<Dialog.Actions>
168+
<Button compact uppercase onPress={hide}>
169+
Done
170+
</Button>
171+
</Dialog.Actions>
172+
```
173+
174+
### List
175+
176+
#### `List.Accordion`
177+
178+
When `List.Accordion` has a `left` element, it used to indent every child that rendered no `left` or `right` of its own, whatever the child was. The indent now comes from context and only `List.Item` reads it, so a custom child keeps its own padding. Indent it yourself if you need the old alignment.
179+
180+
```tsx
181+
// Before (v5)
182+
<List.Accordion title="Group" left={props => <List.Icon {...props} icon="folder" />}>
183+
<View>
184+
<Text>Custom row</Text>
185+
</View>
186+
</List.Accordion>
187+
188+
// After (v6)
189+
<List.Accordion title="Group" left={props => <List.Icon {...props} icon="folder" />}>
190+
<View style={{ paddingLeft: 40 }}>
191+
<Text>Custom row</Text>
192+
</View>
193+
</List.Accordion>
194+
```
195+
196+
`theme` set on `List.Accordion` no longer reaches its children either. Pass it to the child that needs the override.
197+
198+
### ToggleButton
199+
200+
#### `ToggleButton.Row`
201+
202+
`ToggleButton.Row` no longer clones its children to give them a position in the row. The segmented look comes from context, so a `ToggleButton` wrapped in a component of your own now picks it up, while a child that is not a `ToggleButton` gets no treatment at all.
203+
204+
The dividers moved to the row with it. Buttons used to draw their own borders, the row now paints an `outline` background and the hairline gaps between buttons show through. A border set on a single `ToggleButton` no longer builds the segmented outline.
205+
206+
The row also sits on `alignSelf: 'flex-start'`, so it wraps its buttons instead of stretching to the parent. Set it back if you relied on the full width.
207+
208+
```tsx
209+
// Before (v5)
210+
<ToggleButton.Row value={value} onValueChange={setValue}>
211+
<ToggleButton icon="format-align-left" value="left" />
212+
<ToggleButton icon="format-align-right" value="right" />
213+
</ToggleButton.Row>
214+
215+
// After (v6)
216+
<ToggleButton.Row
217+
value={value}
218+
onValueChange={setValue}
219+
style={{ alignSelf: 'stretch' }}
220+
>
221+
<ToggleButton icon="format-align-left" value="left" />
222+
<ToggleButton icon="format-align-right" value="right" />
223+
</ToggleButton.Row>
224+
```

0 commit comments

Comments
 (0)