Skip to content

Commit 2db958b

Browse files
committed
feat: merge componentProps with default params instead of replacing it
1 parent 9caca46 commit 2db958b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Notifier.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ export class NotifierRoot extends React.PureComponent<ShowNotification, StateInt
105105
}
106106

107107
public showNotification(functionParams: ShowNotification) {
108-
const params = { ...this.props, ...functionParams };
108+
const params = {
109+
...this.props,
110+
...functionParams,
111+
componentProps: { ...this.props?.componentProps, ...functionParams?.componentProps },
112+
};
109113

110114
if (this.isShown) {
111115
switch (params.queueMode) {
@@ -139,13 +143,13 @@ export class NotifierRoot extends React.PureComponent<ShowNotification, StateInt
139143
Component,
140144
componentProps,
141145
...restParams
142-
} = params ?? {};
146+
} = params;
143147
this.setState({
144148
title,
145149
description,
146150
Component: Component ?? NotificationComponent,
147151
swipeEnabled: swipeEnabled ?? DEFAULT_SWIPE_ENABLED,
148-
componentProps: componentProps ?? {},
152+
componentProps: componentProps,
149153
});
150154
this.showParams = restParams;
151155
if (duration && !isNaN(duration)) {
@@ -226,11 +230,7 @@ export class NotifierRoot extends React.PureComponent<ShowNotification, StateInt
226230
style={[
227231
s.container,
228232
{
229-
transform: [
230-
{
231-
translateY: this.translateYInterpolated,
232-
},
233-
],
233+
transform: [{ translateY: this.translateYInterpolated }],
234234
},
235235
]}
236236
>

0 commit comments

Comments
 (0)