I’m currently working on a design project and facing a challenge in achieving a specific curve effect. I have attached two images for reference:
As you can see, I have successfully created a basic structure, but I’m struggling to curve the center of the view from the left side inwards, as shown in the first image. I have tried various approaches, but none seem to produce the desired effect.
import {Image, StyleSheet, Text, View} from 'react-native';
import React from 'react';
const ProfieTopCard = () => {
return (
<View
style={{
flexDirection: 'row',
backgroundColor: 'green',
height: '45%',
justifyContent: 'center',
alignItems: 'center',
overflow: 'hidden',
}}>
<View
style={{
flexDirection: 'column',
width: '25%',
height: '100%',
justifyContent: 'center',
alignItems: 'center',
// backgroundColor: 'red',
}}>
<Image
source={require('../../assets/test.png')}
resizeMode="stretch"
style={{height: '85%', width: '85%', borderRadius: 50}}
/>
</View>
<View
style={{
flexDirection: 'column',
backgroundColor: '#fff',
borderTopRightRadius: 30,
borderBottomRightRadius: 30,
width: '70%',
height: '85%',
alignItems: 'center',
justifyContent: 'center',
}}>
<View
style={{
flexDirection: 'row',
height: '100%',
width: '100%',
// backgroundColor: 'red',
}}>
<View
style={{
flexDirection: 'column',
width: '80%',
justifyContent: 'center',
}}>
<Text>hello</Text>
</View>
<View
style={{
flexDirection: 'column',
width: '20%',
justifyContent: 'center',
}}>
<Text>hello</Text>
</View>
</View>
</View>
</View>
);
};
export default ProfieTopCard;
const styles = StyleSheet.create({});`
2
Answers
Solving the View Curving Challenge in React Native
To curve the view inwards in React Native, you can utilize the "react-native-curve" library, providing a straightforward solution to achieve the desired effect. Simply install the library, import it into your component, and apply the curve styling to the specific view or container😊
you can do like this
Edit: Here is how it looks.