Skip to content

Commit b05af09

Browse files
author
Brandon Vigne
committed
Fix zIndex to allow Draggable being rendered on top of others
Mentionned in tongyy#90
1 parent 502f92d commit b05af09

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Draggable.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -179,15 +179,15 @@ export default function Draggable(props) {
179179
left: 0,
180180
width: Window.width,
181181
height: Window.height,
182+
elevation: z,
183+
zIndex: z,
182184
};
183-
}, []);
185+
}, [z]);
184186

185187
const dragItemCss = React.useMemo(() => {
186188
const style = {
187189
top: y,
188190
left: x,
189-
elevation: z,
190-
zIndex: z,
191191
};
192192
if (renderColor) {
193193
style.backgroundColor = renderColor;
@@ -208,7 +208,7 @@ export default function Draggable(props) {
208208
width: renderSize,
209209
height: renderSize,
210210
};
211-
}, [children, isCircle, renderColor, renderSize, x, y, z]);
211+
}, [children, isCircle, renderColor, renderSize, x, y]);
212212

213213
const touchableContent = React.useMemo(() => {
214214
if (children) {

Draggable.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ export default function Draggable(props: IProps) {
211211
left: 0,
212212
width: Window.width,
213213
height: Window.height,
214+
elevation: z,
215+
zIndex: z,
214216
};
215-
}, []);
217+
}, [z]);
216218

217219
const dragItemCss = React.useMemo(() => {
218220
const style: StyleProp<ViewStyle> = {
219221
top: y,
220222
left: x,
221-
elevation: z,
222-
zIndex: z,
223223
};
224224
if (renderColor) {
225225
style.backgroundColor = renderColor;
@@ -240,7 +240,7 @@ export default function Draggable(props: IProps) {
240240
width: renderSize,
241241
height: renderSize,
242242
};
243-
}, [children, isCircle, renderColor, renderSize, x, y, z]);
243+
}, [children, isCircle, renderColor, renderSize, x, y]);
244244

245245
const touchableContent = React.useMemo(() => {
246246
if (children) {

0 commit comments

Comments
 (0)