2016-03-24 29 views
0

içinde çalışmıyor. Örneğim basittir. Ben düzgün kaydırıcı referansı atıyorum ve daha sonra yerli adım pervane ayarlamaya çalışırken:setNativeProps ({adım: num}), React Native

<SliderIOS 
    ref={(slider) => this.slider = slider} 
    onValueChange={(value) { 
    if(value >= 1000) this.slider.setNativeProps({step: 100}); 
    else this.slider.setNativeProps({step: 100}); 
    }} 

ama hata alıyorum: "

tanımsız bir 'validAttributes' özelliğini okuyamaz yerli tepki "

Kaydırıcı tanımlanmıştır. Konsola giriş yaptım ve setNativeProps yöntemine vb. Sahip. Hata, daha sonra yerel tepki modunda gerçekleşiyor.

cevap

0

Bu problemle dün karşılaşmıştım. Ben ListView yılında refreshControl kullanıldığında , bir hata yakalandı tanımsız
malı 'validAttributes' okuyamıyor Bu benim kod

bu bileşen gibi
 
    <ListView  
    dataSource={theDataSource} 
    renderRow={this._renderRow.bind(this)} 
    onEndReached={this.props.pullUp.bind(this)} 
    refreshControl={ 
     <RefreshControl 
      ref='freshIndicator' 
      refreshing={this.state.isRefreshing} 
      onRefresh={()=>this._onRefresh()} 
      title={this.state.freshText} 
      titleColor={Util.themeColor} 
      tintColor={Util.themeColor}/> 
      } 
    /> 
_onRefresh(){ 
    console.log(this.refs['freshIndicator']); 
    this.refs['freshIndicator']._nativeRef.setNativeProps({ 
     refreshing: true, 
     title:'loading' 
    }); 
    this.props.onRefresh();} 

kullanmayın setNativeProps aksi halde bunun yerine this.refs['freshIndicator']._nativeRef.setNativeProps kullanın.
dikkati _nativeRef özelliği
Canlandırıcılık güzel çalışıyor.