insert variable within image link

How can I achieve something close to this:

const type = "Male";
<Image source={require("../assets/icons/card_" + type + ".png")} />

EDIT: FOUND IT!

const images = {
     Male: require("../assets/icons/card_Male.png"),     
     Female: require("../assets/icons/card_Male.png")
}
const type = "Male";
<Image source={images[type]} />

Glad you got it figured out. For future reference, please create topics like this one in this category: How to / Third Party Tooling - Forums

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.