Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
How can I fill text with Image or gif in react native?

I've tried to replicate this https://codepen.io/iamdejean/pen/wvwjjer. But I can't do like that. I've tried like the below:

import React from 'react'
import { ImageBackground, StyleSheet, Text, View, Image } from 'react-native';
import { TouchableOpacity } from 'react-native-gesture-handler'

export const CustomGifContainer = ({onPress, text, image}) => {
  return (
    <View style={GifContainerStyles.container}>
        <TouchableOpacity
          onPress={onPress} 
          style={GifContainerStyles.Gifcontainer}
          activeOpacity={ 0.5}
        >
            <ImageBackground source={image} style={GifContainerStyles.GifBackground}>
                <View style={GifContainerStyles.Gifoverlay}>
                   <Text style={GifContainerStyles.text}>{text}</Text>
                </View>
            </ImageBackground>
        </TouchableOpacity>
    </View>
  )
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

react-native-masked-view can do what you're looking for, although it doesnt have support for the web.

export default function CustomGifContainer ({onPress, text, imgSource,imgDimensions={}}){
  const {width=600,height=600} = imgDimensions
  return (
    <TouchableOpacity
      style={{backgroundColor:'rgba(0,0,0,.25)',margin:5}}
      onPress={onPress}
    >
      <MaskedView
        style={{padding:5}}
        maskElement={
          /*maskElement needs transparent background*/
         <View style={{backgroundColor:'transparent'}}>
            <View style={styles.textWrapper}>
              <Text style={styles.text}>{text}</Text>
            </View>
          </View>
        }
      >
        <Image
          source={imgSource}
          style={{width,height,alignSelf:'center'}}
          resizeMode="cover"
        />
      </MaskedView>
    </TouchableOpacity>
  )
}

Here's a demo.

Make sure to run on android/ios as it doesnt work on the web

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda