From 77e68db9a57be8841eb9dd310ed149996e7b6cb7 Mon Sep 17 00:00:00 2001 From: Le Trong Nghia Huynh Date: Fri, 13 Mar 2020 11:43:36 +0100 Subject: [PATCH 1/2] Add parameter in config to change the background fill color of the reaction selector (need for dark mode) --- Sources/ReactionSelector.swift | 4 ++++ Sources/ReactionSelectorConfig.swift | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Sources/ReactionSelector.swift b/Sources/ReactionSelector.swift index fd8c794..7d5ed82 100644 --- a/Sources/ReactionSelector.swift +++ b/Sources/ReactionSelector.swift @@ -147,6 +147,10 @@ public final class ReactionSelector: UIReactionControl { backgroundLayer.add(pathAnimation, forKey: "morhingPath") + if config.backgroundFillColor != nil { + backgroundLayer.fillColor = config.backgroundFillColor + } + for index in 0 ..< reactionIconLayers.count { updateReactionAtIndex(index, highlighted: stateHighlightedReactionIndex == index) } diff --git a/Sources/ReactionSelectorConfig.swift b/Sources/ReactionSelectorConfig.swift index ef80f7b..49ef79d 100644 --- a/Sources/ReactionSelectorConfig.swift +++ b/Sources/ReactionSelectorConfig.swift @@ -44,6 +44,9 @@ public final class ReactionSelectorConfig: Configurable { /// Boolean value to know whether the reactions needs to be sticked when they are selected. public var stickyReaction: Bool = false + + /// The fill color of the reaction selector. + public var backgroundFillColor: CGColor = nil // MARK: - Initializing a Reaction Selector From c8d57d9558dd7f068832703a84d92bd1045f42e3 Mon Sep 17 00:00:00 2001 From: Le Trong Nghia Huynh Date: Fri, 13 Mar 2020 11:52:22 +0100 Subject: [PATCH 2/2] Forgot optional type value --- Sources/ReactionSelectorConfig.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/ReactionSelectorConfig.swift b/Sources/ReactionSelectorConfig.swift index 49ef79d..4d84f40 100644 --- a/Sources/ReactionSelectorConfig.swift +++ b/Sources/ReactionSelectorConfig.swift @@ -46,7 +46,7 @@ public final class ReactionSelectorConfig: Configurable { public var stickyReaction: Bool = false /// The fill color of the reaction selector. - public var backgroundFillColor: CGColor = nil + public var backgroundFillColor: CGColor? = nil // MARK: - Initializing a Reaction Selector