React Native Tutorial #28 - Background Images

Поделиться
HTML-код
  • Опубликовано: 14 ноя 2024

Комментарии • 62

  • @arwahsapi
    @arwahsapi 4 года назад +17

    Shaun, are you currently in a project or working an office job or something? How do you manage your time in in producing such awesome tutorials?

  • @FirasKarboul
    @FirasKarboul 4 года назад +4

    I came for this feature, to add a background image, ended up starting from the first video because i like the way he explains everything... good job and you helped me a lot to understand a lot of things

  • @lordolunch
    @lordolunch 3 года назад +1

    You are the only person on the internet that actually knows how to do this lol

  • @jaalbites
    @jaalbites Год назад +1

    Muchas Gracias! Donde mucha gente decia que no se podia, usted explica de forma excelente y facil como hacerlo. 👍👍👍

  • @asddd2182
    @asddd2182 10 месяцев назад

    YOOO not even CHATGPT could help me and I watched this vid and got it in a sec, you goated

  • @rishabsharma5307
    @rishabsharma5307 4 года назад +8

    Hey Shaun! Your tutorials are awesome. I love them. Can you please make tutorials on Material-UI

  • @MrXXxPainxXx
    @MrXXxPainxXx 4 года назад +4

    For navigation v5, I use headerBackground to match the height and width of the app bar but it also occupies status bar.
    1. headerBg.js
    import React from 'react';
    import { StyleSheet, ImageBackground, } from 'react-native';
    export default function HeaderBg() {
    return(



    )
    }
    const styles = StyleSheet.create({
    container: {
    flex: 1,
    elevation: 3,
    borderRadius: 1,
    },
    })
    2. stack.js
    import HeaderBg from '../shared/headerBg'
    options={{
    headerTitle: () => ,
    headerBackground: () =>
    }}
    *header.js - just replace ImageBackground with View

    • @chandrachou8148
      @chandrachou8148 3 года назад +1

      This is worked for latest react navigation version. Thanks

    • @HassanNaqvi5
      @HassanNaqvi5 3 года назад

      Hi!
      Please send me drawer work of your's and Header for v5,, I am kinda lost after Drawer

  • @iqleo447
    @iqleo447 2 года назад

    SO HELPFUL. I WAS STRUGGLING WITH THIS SO MUCH THANK YOU THANK YOU THANK, YOU'RE SUCH A BLESSING

    • @NetNinja
      @NetNinja  2 года назад

      That's brilliant to hear, glad it was helpful Leo!

  • @MustafaAgaDev
    @MustafaAgaDev 4 года назад +8

    Since it wasn't working with my packages this is how i solved. Maybe someone else can need it too:
    import React from 'react'
    import { View, StyleSheet, Text, Dimensions, Image, ImageBackground } from 'react-native';
    import {MaterialIcons} from '@expo/vector-icons';
    export default function Header({navigation, title}) {
    const openMenu =()=>{
    navigation.openDrawer();
    }
    return (





    {title}



    )
    }
    const styles = StyleSheet.create({
    header: {
    width:Dimensions.get('screen').width,
    height: '125%',
    marginTop:-15,
    marginLeft:-15,
    flexDirection: 'row',
    flex:1,
    alignItems: 'center',
    },
    headerText: {
    fontWeight: 'bold',
    fontSize: 20,
    color: '#333',
    marginTop:15,
    letterSpacing: 1,
    height: '100%',
    alignItems:"center",
    },
    icon: {
    position: 'relative',
    flexDirection:'column',
    flex:0.5,
    marginTop:15,
    },
    headerImage:{
    width: 26,
    height: 26,
    marginHorizontal:10,
    marginTop:15,
    },
    headerTitle: {
    flexDirection:'row'
    }
    });

    • @ruset-dewss4698
      @ruset-dewss4698 4 года назад +2

      I too had some problems with images and bkg images, Thanks for putting the full 'Header' coding on line. It works .Thanks a lot

    • @feliciaf8
      @feliciaf8 4 года назад +2

      the header image is fucked here, it should be smaller but it's gigantic

    • @moaazbhnas886
      @moaazbhnas886 4 года назад +1

      Thank u

    • @MustafaAgaDev
      @MustafaAgaDev 4 года назад +1

      @@feliciaf8 If you want I can send you the whole repository cause I think later it needs some other edits.

  • @suryabhusal1527
    @suryabhusal1527 3 года назад +1

    For those who are facing issue with headerBackground.
    const HomeStack = createStackNavigator(screens, {
    defaultNavigationOptions: {
    headerTintColor: "teal",
    headerStyle: {
    backgroundColor: "#eee",
    height: 80
    },
    headerBackground: (
    )
    }
    });

  • @JH4eva
    @JH4eva 3 года назад

    An idea to fix the white left corner not taking the background image:
    Add it on homeStack and aboutStack files on each Stack.Screen you want
    headerBackground: () =>

  • @silviovieira7724
    @silviovieira7724 4 года назад +3

    Hi! Because of the problem in lecture 25, we had another problem in this lecture. The background image does not apply properly. Could you please help us? Thanks a lot!

  • @rahmatmaulana4671
    @rahmatmaulana4671 4 года назад +2

    ALRIGHT THEN GANG 🔥🔥

  • @samudrafaris1026
    @samudrafaris1026 4 года назад +3

    I tried this as a solution for the background image for not taking 100% of the height. (React Navigation v5)
    In the homeStack and aboutStack, change the headerTitle into header :
    ({
    header: () => ,
    })}
    />
    In the header.js :
    Do some styling for the header :
    import React from "react";
    import { StyleSheet, Text, View, Image, ImageBackground } from "react-native";
    import { MaterialIcons } from "@expo/vector-icons";
    const header = ({ navigation, title }) => {
    const openMenu = () => {
    navigation.openDrawer();
    };
    return (


    {title}

    );
    };
    export default header;
    const styles = StyleSheet.create({
    header: {
    flexDirection: "row",
    alignItems: "center",
    justifyContent: "center",
    height: 80, //must specify the height
    elevation: 3, //add elevation for shadow effect
    },
    headerText: {
    color: "#444",
    letterSpacing: 1,
    fontSize: 20,
    fontWeight: "bold",
    },
    icon: {
    position: "absolute",
    left: 16,
    paddingTop: 10, //put some padding to push the icon a little bit
    },
    headerTitle: {
    flexDirection: "row",
    alignItems: "center",
    paddingTop: 10, //same as icon
    },
    headerImage: {
    height: 20,
    width: 20,
    marginHorizontal: 10,
    },
    });

  • @jeongirl1095
    @jeongirl1095 Год назад +1

    Thank uu🌟❤️

    • @NetNinja
      @NetNinja  Год назад +1

      You’re welcome 😊

  • @fernandoviera8583
    @fernandoviera8583 2 года назад

    Great tutorial!!!!

  • @ankitvishwakarma530
    @ankitvishwakarma530 4 года назад

    Hey I have been following you for a while and loved your tutorial since I want to learn cross platform which is best flutter or react native please reply me ninja luv from India ♥

  • @mahmoudelrabee2456
    @mahmoudelrabee2456 4 года назад

    The best of the best, keep going 😍

  • @daboren1547
    @daboren1547 4 года назад

    ok Gang!! so funny . First time heard Gang !

  • @franciscocorvalan7485
    @franciscocorvalan7485 2 года назад

    Hello, where can I find such images, do they have a specific name?

  • @Fleshlight_Reviewer
    @Fleshlight_Reviewer 4 года назад +4

    anyone else having issues with the image not fitting the entire width and height of the header?

    • @ruset-dewss4698
      @ruset-dewss4698 4 года назад

      Issues with images, there seems to be too many parameters involved to adjust each and everything in display of components, images,. The message from Mustafa Aga, above helped me in understanding the various parameters and settings

  • @nyambayargg
    @nyambayargg 4 года назад

    I Love you dude! Could you make the plans of this series? I want to know when would that series ends and how am I progressing currently along the full series plan

    • @NetNinja
      @NetNinja  4 года назад +2

      Hey, thanks :). There are another 7 videos in total after this one! Should all be up within a week.

    • @nyambayargg
      @nyambayargg 4 года назад

      @@NetNinja Yeahhh!!!!

  • @poshiyaraj
    @poshiyaraj 4 года назад

    Whats your website,or something i can gets note from? I need notes for css styling, i watched all your css video,liked them, but i need something from which i can read ,if you can help me with that i would really appreciate it.

  • @gamaquad6765
    @gamaquad6765 4 года назад

    I have a question, can i add borderRadius on this imageBackground? i tried but i didnt get

  • @romimaximus
    @romimaximus 4 года назад

    Awesome...thankx Ninja..!!

  • @lanreadedara2607
    @lanreadedara2607 3 года назад

    is there a way to use SVG as a background image?

  • @rajat-s-kale1771
    @rajat-s-kale1771 Год назад

    tqsm for this

  • @mifzeena7390
    @mifzeena7390 2 года назад

    How to add an image to a flat List from a different folder?

  • @manoj-k
    @manoj-k 3 года назад

    🔥🔥🔥

  • @arthurcueva
    @arthurcueva 3 года назад

    yeahhh thanks!! 2021 febrary

  • @salahalsamarraaee650
    @salahalsamarraaee650 2 года назад

    thank you

  • @ali.programmer
    @ali.programmer 4 года назад +2

    Anyone having issue in background not having full width and height
    Solution:
    in homeStack.js and aboutStack.js, replace "headerTitle" with "header"
    in Header.js change height from "100%" to 70

    • @caiotoledo405
      @caiotoledo405 4 года назад

      I had, but I m having issue in the icon too

  • @benstuijts5620
    @benstuijts5620 4 года назад

    I dare you to explain animation / sprites with images.... ;-)

  • @tanzimibthesam5861
    @tanzimibthesam5861 4 года назад

    Sir a request to make some Tailwind CSS tutorial. I also have another request for you to make a node Js with express course in future.

  • @raphalugs
    @raphalugs 4 года назад

    Hi Shaun. In the Lesson 25, some people including me couldn't setting the width and height 100% to the header. I don't know why this is happening. In this link prnt.sc/ql2570 I've printed my phone screen (it's an android). I've downloaded your project and the dimensions are right. Maybe your npm dependencies are "older" than nowadays and React updated some of them.

    • @raphalugs
      @raphalugs 4 года назад

      I've upload the entire project until now as well -> github.com/raphabarreto/gamezone/ - Thanks for your patience 🙏

    • @MustafaAgaDev
      @MustafaAgaDev 4 года назад

      I've published a workaround to that if you are interested, it's in Lesson 25 comments

    • @VictorRivas_vctr
      @VictorRivas_vctr 4 года назад

      It might be too late but I found a post for a solution to the 100% problem github.com/react-navigation/react-navigation/issues/7010 , this is what I ended up with the styles for the header with something like this:
      import React from 'react';
      import { Text, View, StyleSheet, Image, ImageBackground } from 'react-native';
      import { MaterialIcons } from '@expo/vector-icons';
      import { useRoute, useNavigation } from '@react-navigation/native';
      export const Header = () => {
      const route = useRoute();
      const navigation = useNavigation();
      const params = route.params;
      const title = params ? params.title : 'Home';
      const openDrawer = () => navigation.openDrawer();
      return (


      {title}

      );
      };
      const styles = StyleSheet.create({
      headerContainer: {
      flexDirection: 'row',
      alignItems: 'center',
      backgroundColor: 'white',
      width: '100%',
      height: 70,
      paddingTop: 25,
      paddingHorizontal: 25
      },
      texHeader: {
      },
      headerContent: {
      flex: 4,
      justifyContent: 'center',
      flexDirection: 'row'
      },
      drawer: {
      },
      headerLogo: {
      height: 28,
      width: 28,
      marginRight: 10
      }
      });

    • @harshalthakre825
      @harshalthakre825 4 года назад

      @@VictorRivas_vctr This still doesn't resolve issue in my Env. Can you help?

    • @VictorRivas_vctr
      @VictorRivas_vctr 4 года назад

      @@harshalthakre825 Do you have a github repo or a gist? Disclaimer I am fairly new to React Native but yes, I will be willing to help :)