I want to change the SVG path or the shape from curve to rectangular whenever the user click on the text input. How to do it with animation or transition from curve to rectangular shape? So that the curve go up until it becomes a line. I am able to do it but without animation. like the images below:
Here is my JSX code:
return (
<KeyboardAvoidingView style={{ flex: 1 }} behavior="padding" enabled>
<View style={styles.container}>
<Svg height={280} width={WIDTH}>
<Path
d= { numInputTouched? "M0 0 V200 C0 200, 400 400, 0" + WIDTH + ", 120 V0 ":"M0 0 V200 H" + WIDTH + ", V0"}
//"M0 0 V200 H" + WIDTH + ", V0"
// d={"M0 0 V200 C0 200, 400 400, 0" + WIDTH + ", 120 V0"}
fill={Colors.primary}
stroke={Colors.primary}
/>
<View style={styles.titleContaier}>
<Text style={styles.title}>
اشتراك / تسجيل الدخول{"\n"}
<Text style={styles.subTitle}>ادخل رقم موبايلك</Text>
</Text>
</View>
</Svg>
<Text style={styles.SMSText}>ستصلك رسالة قصيرة تحتوي على رمز</Text>
<View style={{}}>
<View style={styles.numberInputContainer}>
<View style={styles.numberInput}>
<View style={{}}>
<Text style={styles.numberTextFixed}>07</Text>
</View>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[1]}
onKeyPress={textHandler(1)}
keyboardType="number-pad"
onChangeText={text => setText1(text)}
onTouchStart={() => setNumInputTouched(true)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[2]}
onKeyPress={textHandler(2)}
onChangeText={text => setText2(text)}
keyboardType="number-pad"
value={text2}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[3]}
onKeyPress={textHandler(3)}
keyboardType="number-pad"
onChangeText={text => setText3(text)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[4]}
onKeyPress={textHandler(4)}
keyboardType="number-pad"
onChangeText={text => setText4(text)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[5]}
onKeyPress={textHandler(5)}
keyboardType="number-pad"
onChangeText={text => setText5(text)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[6]}
onKeyPress={textHandler(6)}
keyboardType="number-pad"
onChangeText={text => setText6(text)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[7]}
onKeyPress={textHandler(7)}
keyboardType="number-pad"
onChangeText={text => setText7(text)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[8]}
onKeyPress={textHandler(8)}
keyboardType="number-pad"
onChangeText={text => setText8(text)}
/>
<TextInput
style={styles.numberText}
placeholder="X"
maxLength={1}
ref={textInput[9]}
onKeyPress={textHandler(9)}
keyboardType="number-pad"
onChangeText={text => setText9(text)}
/>
</View>
</View>
<View>
<TouchableOpacity
style={{ alignItems: "flex-end", width: "85%", marginTop: 50 }}
>
<View style={styles.buttonContainer}>
<Ionicons
name="ios-arrow-round-forward"
size={45}
color="white"
style={styles.icon}
/>
</View>
</TouchableOpacity>
</View>
</View>
</View>
</KeyboardAvoidingView>
);
};