简体   繁体   English

大小不正确的来电

[英]malformed calls from sizes

I need to push images to the array .However with this code ,I am getting the error 'malformed calls from sizes' 我需要将图像推送到数组。但是,使用此代码,我得到了错误“来自大小的格式错误的调用”

Here is the code . 这是代码。

constructor(props){
         super(props);
         this.state={
             min_rating: 2 ,
             max_rating: 5 ,
         }
           this.star_with_rating=<Image source={require('../assets/images/star_filled.png')}/>;
           this. star_without_rating =<Image source={require('../assets/images/star_corner.png')}/>;
     }
render(){
          let arr=[];
           for( let index=1;index<=10;index++){
               arr.push(
                   <TouchableOpacity
                          activeOpacity={0.7}
                          key={index}
                          onPress={this.UpdateRating(index)}>
                          <Image
                             source={
                             index <= this.state.min_rating
                             ? {uri:this.star_with_rating} 
                              : {uri:this.star_without_rating}
                             }
                          />
                    </TouchableOpacity>

               )
           }

However when i remove the uri portion inside Image component ,i get the error this is a reserved word . 但是,当我删除I​​mage组件中的uri部分时,出现错误,这是保留字。

The problem you are setting as the uri as Image component instead of a string. 您正在将uri设置为Image组件而不是字符串的问题。 Which should be: 应该是:

this.star_with_rating = '../assets/images/star_filled.png';

so also I would call it start_with_rating_uri 所以我也称它为start_with_rating_uri

Check the documentation for more details. 查看文档以获取更多详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:HostFunction 中的异常:来自 JS 的错误调用:字段大小不同。 在动画视图中 - Error: Exception in HostFunction: Malformed calls from JS: field sizes are different. In an Animated View Expo React Native Calendar - 错误:HostFunction 中的异常:来自 JS 的错误调用:字段大小不同 - Expo React Native Calendar - Error: Exception in HostFunction: Malformed calls from JS: field sizes are different API中的JSON格式错误 - Malformed JSON from API 产生不同尺寸的电弧的相同呼吁 - Identical calls to arc producing different sizes 从Jquery发送到PHP时JSON格式错误 - Malformed JSON when sending from Jquery to PHP ionic 2从格式错误的json获取数据 - ionic 2 get data from malformed json WebGL-顶点着色器调用中的变量数组大小 - WebGL - Variables array sizes over vertex shader calls 格式错误的JSON字符串从AngularJS传递JSON时出错 - malformed JSON string Error while passing JSON from AngularJS 基于多个字符,使用 Javascript 从格式错误的 URL 中提取字符串 - Extract string from malformed URL using Javascript, based on multiple characters WebRTC - 从Chrome获取'格式错误的约束对象',而不是Firefox - WebRTC - getting 'malformed constraints object' from Chrome but not Firefox
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM