我收到相同的错误“ AboutHelpButton未定义”,即使
  我评论了与AboutHelpButton相关的代码
  
  
  半小时后,它最初运行正常,它的状态显示“ AboutHelpButton未定义”,然后注释了与
  AboutHelpButton用于调试,但注释后也变得相同
  错误
  


   import React, {Component} from 'react';
    import { Text, View, ScrollView, Image } from 'react-native';
    import Header from '../header';
    import Button  from './PreferenceScreenButtons';
    // import AboutHelpButton from './AboutHelpButton';
    import NotificationButton from './NotificationButton';

    class Preferences extends Component {
      render() {
        // debugger;
        return (
          <View
          style={{ flex: 1, backgroundColor:'#EEEEEE' }}
          >
            <Header headerText={'Preferences'} />
            {/* <Text>Hi</Text> */}
         <ScrollView>
         <NotificationButton onPress={() => console.log('Notification button presssed')}>
         Notification
        </NotificationButton>
         <Button onPress={() => console.log('Feedback button presssed')}>
        Feedback
        </Button>
        <Button onPress={() => console.log('Recommend button presssed')}>
        Recommend
        </Button>
        {/* <AboutHelpButton onPress={() => console.log('About Help button presssed')}>
          About Help
          </AboutHelpButton> */}
          </ScrollView>
         <View style={styles.viewStyle}>
           <Image style={styles.imageStyle}
            source={require('../../images/setting_tab.png'
            )}
           />
           <View style={styles.textAndButtonContainerStyle}>
             <View style={styles.textContainerStyle}>
             <Text>© 2019 name. All Rights Reserved. </Text>
           </View>
           </View>
         </View>
         </View>
        );
      }
    }

    const styles ={
      imageStyle: {
        width: 30,
        height: 30,
        marginLeft: 10,
        marginTop: 10
      },
      viewStyle:{
        backgroundColor:'white',
        marginLeft: 10,
        marginTop: 5,
        marginBottom:5
      },
      textContainerStyle:{
        marginLeft: 0,
        marginTop: 0,
        marginBottom:0,
        alignSelf: 'flex-start'
      },
      textAndButtonContainerStyle:{
        flex:1,
        marginLeft: 10,
        marginTop: 10,
        marginBottom:5,
        alignSelf: 'flex-start',
        flexDirection: 'row'
      }
    }

    export default Preferences;


预期加载按钮

最佳答案

尝试删除代码,而不要对其进行注释。注释也会影响代码。

09-25 17:43