skip to Main Content

I want to make a view something like this
View with curved triangle arrow

But I am not able to achieve this

What I achieve is

![enter image description here] (https://i.sstatic.net/Ivzxy1Wk.png)

The code which I have made till now is


const Coachmark = () => {
  return (
    <View style={styles.container}>
      <View style={[styles.coachmark, styles.coachmarkTop]}>
        <Text style={styles.text}>Got a code,Enter it here now</Text>
      </View>

      <View
        style={
          styles.topTriangleMarker
        }></View>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    paddingHorizontal: 10,
  },
  coachmark: {
    backgroundColor: 'white',
    padding: 20,
    borderRadius: 10,
    elevation: 5,
    shadowColor: '#232323',
    shadowOffset: { width: 0, height: 4 },
    shadowOpacity: 0.8,
    shadowRadius: 8,
  },
  text: {
    color: 'black',
    fontSize: 16,
  },
  topTriangleMarker: {
    position: 'absolute',
    width: 0,
    height: 0,
    backgroundColor: 'transparent',
    borderLeftWidth: 30,
    borderRightWidth: 30,
    borderBottomWidth: 30,
    borderLeftColor: 'transparent',
    borderRightColor: 'transparent',
    borderBottomColor: 'white',
    top: -20,
    right: 60,
    transform: [{ rotate: '360deg' }],
    elevation: 5,
  },

});


Can anyone help make the view with an arrow with shadow and the arrow should be curved.

2

Answers


  1. You could do something like this:

      topTriangleMarker: {
        position: 'absolute',
        backgroundColor: 'white',
        width: 30,
        height: 30,
        borderRadius: 5,
        transform: [{ rotate: '45deg' }],
        borderLeftColor: 'transparent',
        borderRightColor: 'transparent',
        borderBottomColor: 'white',
        top: 40,
        right: 60,
      },
    

    But using SVG might be a better approach for an chat bubble.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search