fix: SlideToConfirm inputRange crash when maxX=0 before layout
This commit is contained in:
@@ -45,8 +45,10 @@ export function SlideToConfirm({ label = 'Slide to confirm', color = '#059669',
|
||||
).current;
|
||||
|
||||
// Interpolate opacity of the label as handle moves right
|
||||
// Guard: inputRange must be monotonically non-decreasing (maxX could be 0 before layout)
|
||||
const safeMax = Math.max(maxX * 0.5, 1);
|
||||
const labelOpacity = pan.interpolate({
|
||||
inputRange: [0, maxX * 0.5],
|
||||
inputRange: [0, safeMax],
|
||||
outputRange: [1, 0],
|
||||
extrapolate: 'clamp',
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user