標籤:
1.項目中新加入組件,應執行npm install命令
2.項目執行react-native run-android 報錯,應進入android目錄,執行gradlew.bat clean命令
3.ListView引用函數,應先在構造器中進行this綁定
constructor(props) { this.renderItem = this.renderItem.bind(this);}onPressIcon(uid, aid) { const {navigator} = this.props; InteractionManager.runAfterInteractions(() => { navigator.push({ component: LoadMyTeamMemberInfoContainer, name: ‘成員詳細‘, uid: uid, aid: aid }); });}<ListView initialListSize={1} dataSource={dataSource} renderRow={this.renderItem} onEndReached={this.onEndReached.bind(this,dataState)} onEndReachedThreshold={0} renderFooter={this.renderFooter.bind(this,dataState)} refreshControl={ <RefreshControl refreshing={dataState.isRefreshing} onRefresh={this.onRefresh.bind(this)} title="載入中..." colors={COLOR_REFRESH_CONTROL} /> } /><TouchableOpacity onPress={this.onPressIcon.bind(this,doctor.id,doctor.applyId)}> <View style={styles.opeContent}> <View> <Text style={styles.textDefault}><Text style={styles.textWeight}>狀態:</Text><Text style={styles.textRed}>{doctor.state}</Text></Text> </View> <View style={styles.opeRightContent}> <Text style={[styles.textDefault,styles.textOpe]}>查看詳情></Text> </View> </View> </TouchableOpacity>
react native 遇到的坑