0

So, I develop React Native App using NativeBase as my Component framework.
I'm using card component.
This is my codes:

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>
    )
  }

This is my css:

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

I want to put some text in front of background image layer, something like this: enter image description here How can I do that?

yogieputra
  • 637
  • 2
  • 14
  • 28

2 Answers2

1

Check this

<CardItem>
    <Image
      style={{ resizeMode: 'repeat', paddingTop: 60, width: null }}
      source={require('../../assets/bg_1.jpg')}>
        <Text style={{ textAlign: 'center', backgroundColor: 'transparent', color: '#fff' }}>Holla</Text>
    </Image>
</CardItem>

This works for both, iOS and Android

Supriya Kalghatgi
  • 1,155
  • 9
  • 10
0

Did you try something like this?

<CardItem>
    <Image
      style={{ resizeMode: 'repeat', width: null }}
      source={require('../../assets/bg_1.jpg')}>
        <Text>Holla</Text>
    </Image>
</CardItem>
Supriya Kalghatgi
  • 1,155
  • 9
  • 10