Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

522
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!