首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用ImageBackground时,react本机错误代码500

使用ImageBackground时,react本机错误代码500
EN

Stack Overflow用户
提问于 2019-03-12 12:11:12
回答 1查看 111关注 0票数 1

我正在学习react native,在我的代码中有一个错误

代码语言:javascript
复制
import React, {Component} from 'react';
import {View, ImageBackground, StyleSheet, Text} from 'react-native';

export default class Welcome extends Component{
    render() {
        return (
        <ImageBackground  source={require('./Image_app/welcome.jpg')}  style={styles.container} >
          <View style={styles.container}>
             <Text style={styles.headerText}>
               Setting background image in react native application
             </Text>
          </View>
        </ImageBackground>
        );
      }
    }

const styles = StyleSheet.create({
    container: {
    flex: 1,
    justifyContent: "center",
    alignItems: 'center',
    width: null,
    height: null,
    },
    headerText: {
    fontSize: 24,
    textAlign: "center",
    margin: 10,
    color: "white",
    fontWeight: "bold"
    }
});

这个错误是enter image description here

我的源enter image description here中的put文件夹图像

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-03-12 12:44:17

关闭捆绑程序,删除您的node_modules,重新安装npm i的所有内容,然后重新启动捆绑程序。这应该会解决你的问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55114019

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档