Adelin Bojan
Adelin Bojan

Reputation: 37

I want to import an image and idk how

I've tried several times with , but didn't work. Maybe I don't know where to put it in code. I'm a beginner in react-native, but I need your help. Please share your answers!

render() {
    console.log('render register  -> renderComponent');
    return (
      <View style={styles.container}>
        <Image source={require('../components/logo.png')} />
        <KeyboardAvoidingView style={styles_register.containerView} behavior="padding">
          <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
            <View style={styles_register.registerScreenContainer}>
              <View style={styles_register.registerFormView}>
               <ThemeProvider theme={theme}>
                  <Button
                  buttonStyle={styles.loginButtonn}
                  onPress={() => {
                  this.registerWithFacebook();
                }}
                title = "Login with Facebook"
              />
             </ThemeProvider>
              </View>
            </View>
          </TouchableWithoutFeedback>
        </KeyboardAvoidingView>
      </View>
    );
  }
}

Upvotes: 0

Views: 39

Answers (2)

Orgil
Orgil

Reputation: 711

First of all, make sure that your image is in that path ../components/logo.png, also set the size to your image component. Since you are beginner always start with the documentation

<Image
  style={{width: 50, height: 50}}
  source={require('../components/logo.png')}
/>

Upvotes: 1

Adelin Bojan
Adelin Bojan

Reputation: 37

render() { console.log('render register -> renderComponent'); return (

Upvotes: 0

Related Questions