I’m trying to find the way to change the dimensions of the SVG when the keyboard event or any other event occurs. For example, using React native Animated prop we can change the image dimensions using Animated. Image
. So how can we do the same with SVG image? any help would be appreciated.
const keyboardListenerShow = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow';
const keyboardListenerHide = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide';
useEffect(() => {
Keyboard.addListener(keyboardListenerShow, _listnerShow);
Keyboard.addListener(keyboardListenerHide, _listerHide);
return () => {
Keyboard.removeListener(keyboardListenerShow, _listnerShow);
Keyboard.removeListener(keyboardListenerHide, _listerHide);
}},[])
const imageOriginal = useRef( new Animated.Value(200)).current;
const _listnerShow = (event) => {
Animated.timing(imageOriginal, {
duration: event.duration,
toValue: 80,
useNativeDriver:false,
}).start();
};
const _listerHide = (event) => {
Animated.timing(imageOriginal, {
duration: event.duration,
toValue: 200,
useNativeDriver:false,
}).start();
};
Now how can I change my SVG image width and height when keyboardWillShow
event occurs? and vise versa?
Here is the example of what I want :