How can I make my view look like this, (the sharp edges below Karamel in red)
Asked
Active
Viewed 182 times
-1
-
share your code what you have done yet. – Muhammad Iqbal Sep 21 '20 at 10:36
-
@MuhammadIqbal Haven't done anything yet, I dont know how to do it – Talha Nadeem Sep 21 '20 at 10:37
1 Answers
0
You should use react-native-canvas
for it.
This is my previous code with canvas so you can reference it.
import Canvas from 'react-native-canvas';
handleHeader(canvas, color) {
if (canvas) {
const height = 230;
console.log(width, height);
canvas.width = width;
canvas.height = height;
const context = canvas.getContext('2d');
context.fillStyle = color;
context.moveTo(0, 0);
context.lineTo(0, height - 40);
context.quadraticCurveTo(width / 4, height - 80, width / 2, height - 40);
context.quadraticCurveTo((width / 4) * 3, height, width, height - 40);
context.lineTo(width, 0);
context.fill();
}
}
render() {
return (
<Canvas ref={canvas => this.handleHeader(canvas, this.props.color)} />
);
}

Shing Ho Tan
- 931
- 11
- 30