React-native failed propType on Image component

前端 未结 2 1645
广开言路
广开言路 2020-12-24 05:20

I am just starting out with React-native and have a pretty decent grasp on React for creating web apps... I am running into a confusing issue here that never occured when wo

2条回答
  •  生来不讨喜
    2020-12-24 05:55

    You should either require the local assets or use object with uri key.

    So either in MainComponent:

    this.state = {
      images:[
        require('./src/images/1.png'),
        require('./src/images/2.png'),
        require('./src/images/3.png')
      ]
    }
    

    or in BasicComponent:

    return (
      
    );
    

提交回复
热议问题