Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

519
Vistas
Set phone background image using React Native

I'm new to React, I managed to upload an image from the local phone gallery and store its URI in a global variable, but I can't find anywhere how to set the image to my phone background image (not in react!). The end goal is to allow a change by date in the background. Assuming I can use global.frstImgURI, and global.secImgURI and global.thrdImgURI as my images path (by import). How can I achieve that?

Currently, I manage to upload an image, then show it in my react native, BG, but not on my phone. My current code for choosing image:

import React from 'react';
import {View, ImageBackground, StyleSheet, Dimensions} from 'react-native';
import global from '../components/global'

const screenHeight = Dimensions.get('window').height;
const screenWidth = Dimensions.get('window').width;

const BackgroundImg = () => {
    return <View>
                <ImageBackground
                    source={{uri: global.day1_image }}
                    resizeMode="stretch"
                    style={styles.img}>
                </ImageBackground>
            </View>
};
export default BackgroundImg;
const styles = StyleSheet.create({
    img: {
        height: screenHeight,
        width: screenWidth,
        justifyContent: 'center',
        alignItems: 'center',
    }
})

Show it on React BG:

import * as React from 'react';
import { View } from 'react-native';
import BackgroundImg from '../components/Background_image'
const App = () => {
    return (
        <View>
            <BackgroundImg />
        </View>
    );
};
export default App;

My thought is using a dynamic list, and changing images by if statement connected to time (still didn't implement), but as said, I can't find how to change the phone image BG at all. Thanks!

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

In the case , import image with their extension , then direct pass ImageBackground

import global from '../assets/global.png'

const screenHeight = Dimensions.get('window').height;
const screenWidth = Dimensions.get('window').width;

const BackgroundImg = () => {
    return <View>
                <ImageBackground
                    source={global}
                    resizeMode="stretch"
                    style={styles.img}>
                </ImageBackground>
            </View>
};
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda