Skip to content

Commit d5c1de0

Browse files
committed
fix for newDrawer actions container style
1 parent 3f54d89 commit d5c1de0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/interactableComponents/drawer/newDrawer.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class NewDrawer extends PureBaseComponent {
8585
/**
8686
* Perform the animation in natively
8787
*/
88-
useNativeAnimations: PropTypes.bool,
88+
useNativeAnimations: PropTypes.bool
8989
};
9090

9191
static defaultProps = {
@@ -97,8 +97,10 @@ class NewDrawer extends PureBaseComponent {
9797

9898
this._swipeableRow = React.createRef();
9999
this.animationOptions = {bounciness: props.bounciness || 5};
100-
this.rightActionsContainerStyle = this.getActionsContainerStyle(Constants.isRTL ? [props.leftItem] : props.rightItems);
101-
this.leftActionsContainerStyle = this.getActionsContainerStyle(Constants.isRTL ? props.rightItems : [props.leftItem]);
100+
101+
this.rightActionsContainerStyle = this.getRightActionsContainerStyle();
102+
this.leftActionsContainerStyle = this.getLeftActionsContainerStyle();
103+
102104
this.leftRender = props.leftItem ? (Constants.isRTL ? this.renderRightActions : this.renderLeftActions) : undefined;
103105
this.rightRender = props.rightItems ? (Constants.isRTL ? this.renderLeftActions : this.renderRightActions) : undefined;
104106

@@ -119,6 +121,16 @@ class NewDrawer extends PureBaseComponent {
119121
});
120122
}
121123

124+
getLeftActionsContainerStyle() {
125+
const {rightItems, leftItem} = this.getThemeProps();
126+
return this.getActionsContainerStyle(Constants.isRTL ? rightItems : [leftItem]);
127+
}
128+
129+
getRightActionsContainerStyle() {
130+
const {rightItems, leftItem} = this.getThemeProps();
131+
return this.getActionsContainerStyle(Constants.isRTL ? [leftItem] : rightItems);
132+
}
133+
122134
getActionsContainerStyle(items) {
123135
return {backgroundColor: _.get(_.first(items), 'background', DEFAULT_BG)};
124136
}
@@ -137,6 +149,7 @@ class NewDrawer extends PureBaseComponent {
137149
onSwipeableWillOpen = () => {
138150
_.invoke(this.props, 'onSwipeableWillOpen', this.props);
139151
};
152+
140153
onSwipeableWillClose = () => {
141154
_.invoke(this.props, 'onSwipeableWillClose', this.props);
142155
};
@@ -237,6 +250,7 @@ class NewDrawer extends PureBaseComponent {
237250

238251
render() {
239252
const {children, style, ...others} = this.props;
253+
240254
return (
241255
<Swipeable
242256
{...others}

0 commit comments

Comments
 (0)