-
-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Active Dot Style behaves differently on setting height and widtth #679
Comments
Hey @sinanverve7! I'm here to help you with the issue you've encountered. Let's tackle this together! The issue you're experiencing with the Here is the relevant part of the code: /**
* TODO: Keep this for future implementation
* Used to change the size of the active dot with animation
*/
// const animatedSize = {
// width: activeDotStyle?.width,
// height: activeDotStyle?.height,
// }; Since this part is commented out, the To fix this, you would need to uncomment and properly implement the Additionally, ensure that const animStyle = useAnimatedStyle(() => {
const {
width = size || defaultDotSize,
height = size || defaultDotSize,
borderRadius,
backgroundColor = "#FFF",
...restDotStyle
} = dotStyle ?? {};
const {
width: activeWidth = width,
height: activeHeight = height,
borderRadius: activeBorderRadius,
backgroundColor: activeBackgroundColor = "#000",
...restActiveDotStyle
} = activeDotStyle ?? {};
let val = Math.abs(animValue?.value - index);
if (index === 0 && animValue?.value > count - 1)
val = Math.abs(animValue?.value - count);
const inputRange = [0, 1, 2];
const restStyle = (val === 0 ? restActiveDotStyle : restDotStyle) ?? {};
return {
width: interpolate(
val,
inputRange,
[activeWidth, width, width],
Extrapolation.CLAMP,
),
height: interpolate(
val,
inputRange,
[activeHeight, height, height],
Extrapolation.CLAMP,
),
borderRadius: interpolate(
val,
inputRange,
[activeBorderRadius ?? borderRadius ?? 0, borderRadius ?? 0, borderRadius ?? 0],
Extrapolation.CLAMP,
),
backgroundColor: interpolateColor(val, inputRange, [
activeBackgroundColor,
backgroundColor,
backgroundColor,
]),
...restStyle,
...(customReanimatedStyleRef.value ?? {}),
transform: [
...(restStyle?.transform ?? []),
...(customReanimatedStyleRef.value?.transform ?? []),
],
};
}, [
animValue,
index,
count,
horizontal,
dotStyle,
activeDotStyle,
customReanimatedStyle,
]); Ensure that the |
Facing the same limitation. I used a parent view with transform: [{ scale: 0.5 }] to reduce dots size in half. |
Describe the bug
My active dot has different width and height than other dots.but when i set width and height doesnot have any effect on pagination dots. instead all pagination dots takes active color
To Reproduce
Expected behavior
Active dot item need to be with specified width and height
Screenshots
If applicable, add screenshots to help explain your problem.
All 2 carousel has same dot color which active dot color ( width and height not applied )
**Slided to second slide active dot color correctly applying but still height and width didn't apply **
Versions (please complete the following information):
Smartphone (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: