Skip to content

Commit b6a39cd

Browse files
committed
chore: Add v10 migration guide for ReactionPickerIconList
This commit updates the `v10-migration.md` document to include a detailed migration guide for the `ReactionPickerIconList` widget. The guide outlines key changes, including: - Removal of the `message` parameter. - A type change for `reactionIcons` to `List<ReactionPickerIcon>`. - Renaming `onReactionPicked` to `onIconPicked` with an updated signature. It provides a clear before-and-after code example demonstrating how to adapt to the new API, which now requires handling the reaction selection state externally.
1 parent 684d0c3 commit b6a39cd

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

migrations/v10-migration.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This guide includes breaking changes grouped by release phase:
1111
### 🚧 Upcoming Beta
1212

1313
- [onAttachmentTap](#-onattachmenttap)
14+
- [ReactionPickerIconList](#-reactionpickericonlist)
1415

1516
### 🚧 v10.0.0-beta.8
1617

@@ -115,6 +116,62 @@ StreamMessageWidget(
115116
116117
---
117118

119+
### 🛠 ReactionPickerIconList
120+
121+
#### Key Changes:
122+
123+
- `message` parameter has been removed
124+
- `reactionIcons` type changed from `List<StreamReactionIcon>` to `List<ReactionPickerIcon>`
125+
- `onReactionPicked` callback renamed to `onIconPicked` with new signature: `ValueSetter<ReactionPickerIcon>`
126+
- `iconBuilder` parameter changed from default value to nullable with internal fallback
127+
- Message-specific logic (checking for own reactions) moved to parent widget
128+
129+
#### Migration Steps:
130+
131+
**Before:**
132+
```dart
133+
ReactionPickerIconList(
134+
message: message,
135+
reactionIcons: icons,
136+
onReactionPicked: (reaction) {
137+
// Handle reaction
138+
channel.sendReaction(message, reaction);
139+
},
140+
)
141+
```
142+
143+
**After:**
144+
```dart
145+
// Map StreamReactionIcon to ReactionPickerIcon with selection state
146+
final ownReactions = [...?message.ownReactions];
147+
final ownReactionsMap = {for (final it in ownReactions) it.type: it};
148+
149+
final pickerIcons = icons.map((icon) {
150+
return ReactionPickerIcon(
151+
type: icon.type,
152+
builder: icon.builder,
153+
isSelected: ownReactionsMap[icon.type] != null,
154+
);
155+
}).toList();
156+
157+
ReactionPickerIconList(
158+
reactionIcons: pickerIcons,
159+
onIconPicked: (pickerIcon) {
160+
final reaction = ownReactionsMap[pickerIcon.type] ??
161+
Reaction(type: pickerIcon.type);
162+
// Handle reaction
163+
channel.sendReaction(message, reaction);
164+
},
165+
)
166+
```
167+
168+
> ⚠️ **Important:**
169+
> - This is typically an internal widget used by `StreamReactionPicker`
170+
> - If you were using it directly, you now need to handle reaction selection state externally
171+
> - Use `StreamReactionPicker` for most use cases instead of `ReactionPickerIconList`
172+
173+
---
174+
118175
## 🧪 Migration for v10.0.0-beta.8
119176

120177
### 🛠 customAttachmentPickerOptions
@@ -831,6 +888,7 @@ StreamMessageWidget(
831888
- ✅ Update `onAttachmentTap` callback signature to include `BuildContext` as first parameter
832889
- ✅ Return `FutureOr<bool>` from `onAttachmentTap` - `true` if handled, `false` for default behavior
833890
- ✅ Leverage automatic fallback to default handling for standard attachment types (images, videos, URLs)
891+
- ✅ Update any direct usage of `ReactionPickerIconList` to handle reaction selection state externally
834892

835893
### For v10.0.0-beta.8:
836894
- ✅ Replace `customAttachmentPickerOptions` with `attachmentPickerOptionsBuilder` to access and modify default options

0 commit comments

Comments
 (0)