React Native获得以下错误 - this.props.sendDataToTagGroups不是函数

时间:2017-10-11 04:20:45

标签: reactjs react-native

我在我的本机应用程序中遇到以下错误 - this.props.sendDataToTagGroups不是函数

我确实有绑定设置,不确定我在这里缺少的是我的代码

//绑定 this._getSelectedData = this._getSelectedData.bind(this);

// Render tag groups
    _renderTagGroups() {
        const tagGroups = this.state.tagGroupsArray;
        const renderedTagGroups = tagGroups.map(function(tagGroup, key){
             return (
                 <View key={key} style={{flexDirection:'row',flexWrap:'wrap',alignItems: 'flex-start',}}>
                     <View style={styles.tagGroupContainer}>
                         <Icon name='tag' size={29} type={"font-awesome"} color={'#58595B'} style={{paddingLeft:20, paddingRight:10,}}/>
                         <Text style={styles.tagSectionHeaderText}>Select {tagGroup.tagGroupName}</Text>
                     </View>
                     <View style={{flexDirection:'row',flexWrap:'wrap',alignItems: 'flex-start',}}>
                         <Tags tags={tagGroup.tags} tagGroupName={tagGroup.tagGroupName} tagGroupId={tagGroup.tagGroupId} sendDataToTagGroups={this._getSelectedData}/>
                     </View>
                 </View>
             )

         });
         return renderedTagGroups
    }

render() {
        const projectTags = store.getState().selectedProject.project.tagGroups;
        const isEmptyProjectTags = _.isEmpty(projectTags);
        return (
            <View style={[styles.wrapTags]}>
                {this.state.indeterminate &&
                <Progress.Circle
                    style={styles.progressContainer}
                    progress={this.state.progress}
                    indeterminate={this.state.indeterminate}
                />
                }


                {!isEmptyProjectTags &&
                <View style={[styles.wrapTags]}>
                    {this._renderTagGroups()}
                </View>
                }

                {isEmptyProjectTags &&
                <View>
                    <Text style={{marginLeft:10, marginTop:15, fontSize:18}}>No tags have been created. Please see your Project Controller or Team Controller to create new tags.</Text>
                </View>
                }
            </View>
        )
    }

1 个答案:

答案 0 :(得分:0)

通过以下操作让它工作希望它可以帮助别人。

sendDataToTagGroups={ () => {this._getSelectedData} }