2

My initial image source is something like this

<Image
    style={[styles.iconArea,
            focused ? styles.focusTint : styles.unFocusTint,
        ]}
    source={require(`../assets/Icons/home.png`)}
></Image>

So I want to create a function that return different images rather than home image only.

So I create a func like this

function something(icon){
    <Image
        style={[styles.iconArea,
                focused ? styles.focusTint : styles.unFocusTint,
            ]}
        source={require(`../assets/Icons/${icon}.png`)}
    ></Image>
}

something("cart")

This thing is whenever I tried to run its giving me syntax error with this message

enter image description here

What am I doing wrong

Kerry
  • 384
  • 3
  • 25

0 Answers0