2017-04-26 33 views
1

我遇到了ScrollViewClass未定義的問題,但僅在應用程序的一個位置,並且僅適用於react-native中的iOS版本。ScrollViewClass不能是未定義的 - 反應本機iOS

滾動型是在應用中的多個位置使用和工作正常,但在應用程序的這一個特定組成部分,它導致一個錯誤屏幕,指出ScrollViewClass must not be undefined

ScrollViewClass must not be undefined

    <ScrollView style={styles.descriptionContainer} 
          contentContainerStyle={styles.descriptionContainerInner}> 
        {/* The description text */} 
        <Text style={styles.descriptionText}> 
         {this.state.description} 
        </Text> 
       </ScrollView> 

回答

4

...基本上,有一個不好的平等檢查:

if (Platform.OS = 'android') { ...

componentDidMount() { 
    if (Platform.OS === 'android') { 
      BackAndroid.addEventListener('hardwareBackPress', this.handleBackOnOverlay); 
    } 

這導致在iOS應用程序中爲Android後退按鈕添加事件監聽器。上面的錯誤是由於它看起來的結果而顯示的。永遠不要假設錯誤信息就是這樣的錯誤。

相關問題