问 - 如何在卡内的背景图像前添加文本

时间:2016-10-03 09:11:13

标签: javascript react-native native-base

因此,我使用NativeBase作为我的组件框架开发了React Native App 我使用卡组件。
这是我的代码:

render(){
    return(
      <View>
          <View style={[styles.cardWrapper]}>
            <Card>
              <CardItem>
                <Image style={{ resizeMode: 'repeat', width: null }} source={require('../../assets/bg_1.jpg')} />
              </CardItem>
              <CardItem>
                <Icon name='ios-musical-notes' style={{color : '#ED4A6A'}} />
                <Text>Listen now</Text>
              </CardItem>
            </Card>
          </View>
      </View>
    )
  }

这是我的css:

const styles = StyleSheet.create({
  cardWrapper:{
    padding: 20,
  }
});

我想在背景图片层前添加一些文字,如下所示: enter image description here 我怎么能这样做?

2 个答案:

答案 0 :(得分:1)

检查

hm <- paste(ifelse(grepl("h", df[[1]]), "", "0 h"), df[[1]])
with(read.table(text = hm), 60 * V1 + V3)
## [1] 70 67 60 86 97

这适用于iOS和Android

答案 1 :(得分:0)

你尝试过这样的事吗?

<CardItem>
    <Image
      style={{ resizeMode: 'repeat', width: null }}
      source={require('../../assets/bg_1.jpg')}>
        <Text>Holla</Text>
    </Image>
</CardItem>
相关问题