I have the following code:
let fileIcon = props.type == DOCUMENT_TYPE.Project ? "024-folder-16" : "file";
let concatString = '../assets/images/'.concat(fileIcon, 'png');
and I'm trying to use the value "concatString" later on:
let fileIcon = props.type == DOCUMENT_TYPE.Project ? "024-folder-16" : "file";
let concatString = '../assets/images/'.concat(fileIcon, 'png');
const renderChapterItem = chapterData => {
return (
<TouchableOpacity
style={styles.gridItem}
onPress={() => {
props.navigation.navigate("Document", {text: chapterData.item[1]})
}}
>
<Image
style={styles.image}
source={require(concatString)}/>
)
}
However, I keep getting an error
Invalid call at line 21: require(concatString)