小编Max*_*lll的帖子

图像组件上的React-native失败propType

我刚刚开始使用React-native并且对React创建Web应用程序有相当不错的把握......我遇到了一个令人困惑的问题,这个问题在处理web响应时从未发生过.

基本上我正在渲染一个组件,其图像是通过映射其父组件中的对象数组来动态生成的.

export default class ImageComponent extends React.Component {
  render() {
    return (
        <Image source={this.props.source}/>
    );
  }
};
Run Code Online (Sandbox Code Playgroud)

它的父组件:

export default class MainComponent extends React.Component {
  constructor(props) {
    super(props);
   this.state = {
      images:[
        { src: './src/images/1.png'},
        { src: '/src/images/2.png'},
        { src: './src/images/3.png'}
      ]
    }
   }

  render() {
    let images = this.state.images.map((image) => {
      return(<ImageComponent source={image.src}  />);
    })

    return (
      <View>
        {images}
      </View>
    );
  }
};
Run Code Online (Sandbox Code Playgroud)

在设备模拟器中,我收到以下错误:

"警告:propType失败:提供给'Image'的prop'ource'无效,检查'BasicComponent'的渲染方法"

有谁知道这里会发生什么?

javascript xcode reactjs react-native

27
推荐指数
2
解决办法
3万
查看次数

是否有命令列出当前在本地运行的所有服务器?

我确定这个问题在我很难找到之前已经被问到了......目前当我去启动我的 rails 服务器时,我遇到了

`initialize': Address already in use - bind(2) for "0.0.0.0" port 5000 (Errno::EADDRINUSE)
Run Code Online (Sandbox Code Playgroud)

显然 port:5000 当前正在使用,但是有没有快速的方法来列出所有本地 Web 服务器并杀死所说的服务器。请原谅我的无知。

macos terminal command-line ruby-on-rails localhost

1
推荐指数
1
解决办法
2993
查看次数