Open carlos3g opened 2 years ago
Got same issue using animatedProps
Same issue on IOS too, it works only sometimes, wonder if there's a solution, I need to animate the fontSize.
Video shows:
const AnimatedIcon = Animated.createAnimatedComponent(MaterialIcons);
const animatedTrashIcon = useAnimatedStyle(() => ({
fontSize: scaledSharedValue.value,
}));
<AnimatedIcon
name="delete"
color="white"
size={10}
style={animatedTrashIcon}
/>
hey @tomekzaw, sorry for pinging directly, do you have an update on this? I see that it was part of the Jan 2022 bug bash there's not been an update and this issue still persists
Hey @MehediH, apparently there's no update on this issue.
As a workaround, have you tried wrapping Ionicon
inside an Animated.View
?
@tomekzaw I have tried wrapping inside an Animated.View
and it doesn't work because I need the Icon
's fontSize
to be animated, but we are not allowed to set fontSize
as a style property on View
Currently I have:
import Animated from "react-native-reanimated";
export const AnimatedAntDesign = Animated.createAnimatedComponent(AntDesign);
const maskIconStyle = useAnimatedStyle(() => ({
fontSize: iconSize.value
}));
return (
<AnimatedAntDesign
style={[maskIconStyle]}
name="heart"
/>
)
the above doesn't work, the size only changes on re-renders, but not on the initial render.
and I can't do something like this either:
return (
<Animated.View style={[maskIconStyle]}
<AnimatedAntDesign
style=[[maskIconStyle]
name="heart"
/>
</Animated.View>
)
Thoughts? đź‘€
it's really important to be able to animate the icon size so it's a bummer that this isn't working. FYI I also tried with animatedProps
(to set the size
) but it doesn't work (something about setNativeProps
not being defined). Thank you!
@MehediH Hi, as a workaround you may try wrapping your SVG with Animated.View
and applying style using scale
property
@MehediH Hi, as a workaround you may try wrapping your SVG with
Animated.View
and applying style usingscale
property
Doing so works but the icon appears granulated because it's just doing a simple zoom in instead of increasing the svg's font size.
@MehediH Hi, as a workaround you may try wrapping your SVG with
Animated.View
and applying style usingscale
propertyDoing so works but the icon appears granulated because it's just doing a simple zoom in instead of increasing the svg's font size.
In that scenario you can try using bigger icon by default and in your animation scaling it in range 0-1
It does seem like the issue may be with the @expo/vector-icons
package for some reason I've not figured out yet..
I had some errors animating the opacity and transform after using the Animated.createAnimatedComponent()
method. I switched to the react-native-vector-icons
package and that seems to work.
Description
I created a animated component of Ionicons icon set using
Animated.createAnimatedComponent
and tried to animate its translateY, but nothing happensExpected behavior
The
Animated Icon
change position due to translateX changes from 0 to 100Actual behavior & steps to reproduce
Nothing happens. The
AnimatedIcon
stays in the initial positionSnack or minimal code example
Package versions
Affected platforms