Skip to content

Commit 099887f

Browse files
Srirang.KalantriSrirangK
authored andcommitted
fix: multiple FAB
1 parent a1cfd61 commit 099887f

3 files changed

Lines changed: 22 additions & 12 deletions

File tree

packages/pluggableWidgets/floating-action-button-native/e2e/specs/maestro/FloatingActionButton.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ appId: "${APP_ID}"
1212
text: "Music w/ action"
1313
- tapOn:
1414
id: "floatingActionButtonBottomLeft"
15-
# - assertVisible:
16-
# text: "Zooooom"
15+
- assertVisible:
16+
text: "Zooooom"
1717
- tapOn:
1818
id: "floatingActionButtonBottomRight"
19-
# - assertVisible:
20-
# text: "Email"
19+
- assertVisible:
20+
text: "Email"
2121
- tapOn:
2222
id: "floatingActionButtonTopRight"
2323
- takeScreenshot:

packages/pluggableWidgets/floating-action-button-native/src/FloatingActionButton.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ export function FloatingActionButton(props: FloatingActionButtonProps<FloatingAc
9494
top: 0,
9595
bottom: 0,
9696
direction: "ltr",
97-
zIndex: 999,
9897
pointerEvents: "box-none"
9998
};
10099

@@ -126,6 +125,8 @@ export function FloatingActionButton(props: FloatingActionButtonProps<FloatingAc
126125
outputRange: [0, yOffset]
127126
});
128127

128+
// For bottom FABs, use top positioning with translated offset
129+
// This ensures proper rendering when multiple FABs are on screen
129130
const buttonTop = props.verticalPosition === "top" ? margin : undefined;
130131
const buttonBottom = props.verticalPosition === "bottom" ? margin : undefined;
131132

@@ -141,7 +142,8 @@ export function FloatingActionButton(props: FloatingActionButtonProps<FloatingAc
141142
top: buttonTop,
142143
bottom: buttonBottom,
143144
width: secondaryButtonSize,
144-
height: secondaryButtonSize
145+
height: secondaryButtonSize,
146+
zIndex: 100
145147
},
146148
secondaryButtonHorizontal
147149
]}
@@ -187,7 +189,8 @@ export function FloatingActionButton(props: FloatingActionButtonProps<FloatingAc
187189
top: buttonTop,
188190
bottom: buttonBottom,
189191
height: secondaryButtonSize,
190-
justifyContent: "center"
192+
justifyContent: "center",
193+
zIndex: 100
191194
},
192195
secondaryLabelHorizontal
193196
]}
@@ -212,7 +215,8 @@ export function FloatingActionButton(props: FloatingActionButtonProps<FloatingAc
212215
top: mainButtonTop,
213216
bottom: mainButtonBottom,
214217
width: mainButtonSize,
215-
height: mainButtonSize
218+
height: mainButtonSize,
219+
zIndex: 200
216220
},
217221
mainButtonHorizontal
218222
]}

packages/pluggableWidgets/floating-action-button-native/src/__tests__/__snapshots__/FloatingActionButton.spec.tsx.snap

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
1111
"position": "absolute",
1212
"right": 0,
1313
"top": 0,
14-
"zIndex": 999,
1514
}
1615
}
1716
>
@@ -34,6 +33,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
3433
},
3534
],
3635
"width": 40,
36+
"zIndex": 100,
3737
}
3838
}
3939
>
@@ -111,6 +111,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
111111
"translateY": 0,
112112
},
113113
],
114+
"zIndex": 100,
114115
}
115116
}
116117
>
@@ -149,6 +150,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
149150
},
150151
],
151152
"width": 40,
153+
"zIndex": 100,
152154
}
153155
}
154156
>
@@ -226,6 +228,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
226228
"translateY": 0,
227229
},
228230
],
231+
"zIndex": 100,
229232
}
230233
}
231234
>
@@ -264,6 +267,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
264267
},
265268
],
266269
"width": 40,
270+
"zIndex": 100,
267271
}
268272
}
269273
>
@@ -341,6 +345,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
341345
"translateY": 0,
342346
},
343347
],
348+
"zIndex": 100,
344349
}
345350
}
346351
>
@@ -369,6 +374,7 @@ exports[`FloatingActionButton renders correct props with secondary buttons 1`] =
369374
"position": "absolute",
370375
"top": undefined,
371376
"width": 54,
377+
"zIndex": 200,
372378
},
373379
{
374380
"right": 30,
@@ -465,7 +471,6 @@ exports[`FloatingActionButton renders correct props without secondary buttons 1`
465471
"position": "absolute",
466472
"right": 0,
467473
"top": 0,
468-
"zIndex": 999,
469474
}
470475
}
471476
>
@@ -478,6 +483,7 @@ exports[`FloatingActionButton renders correct props without secondary buttons 1`
478483
"position": "absolute",
479484
"top": undefined,
480485
"width": 54,
486+
"zIndex": 200,
481487
},
482488
{
483489
"right": 30,
@@ -574,7 +580,6 @@ exports[`FloatingActionButton vertical position renders position bottom correctl
574580
"position": "absolute",
575581
"right": 0,
576582
"top": 0,
577-
"zIndex": 999,
578583
}
579584
}
580585
>
@@ -587,6 +592,7 @@ exports[`FloatingActionButton vertical position renders position bottom correctl
587592
"position": "absolute",
588593
"top": undefined,
589594
"width": 54,
595+
"zIndex": 200,
590596
},
591597
{
592598
"right": 30,
@@ -683,7 +689,6 @@ exports[`FloatingActionButton vertical position renders position top correctly 1
683689
"position": "absolute",
684690
"right": 0,
685691
"top": 0,
686-
"zIndex": 999,
687692
}
688693
}
689694
>
@@ -696,6 +701,7 @@ exports[`FloatingActionButton vertical position renders position top correctly 1
696701
"position": "absolute",
697702
"top": 30,
698703
"width": 54,
704+
"zIndex": 200,
699705
},
700706
{
701707
"right": 30,

0 commit comments

Comments
 (0)