由于这种情况,我正在用反应生态学习,我想为Android创建导航,实际上,我遇到了一个错误
错误:REECT Native Undefined不是对象(evalue'_react3.default.proptypes.object')
反应:0.51
import React, { Component } from 'react';
import {StyleSheet,Text,View,TextInput,KeyboardAvoidingView,TouchableOpacity,
AsyncStorage} from 'react-native';
import AtoZList from 'react-native-atoz-list';
import randomcolor from 'randomcolor';
import _ from 'lodash';
let names = require('./names');
names = _.groupBy(require('./names'), (name) => name[0].toUpperCase());
export default class startActivity extends React.Component {
constructor(props, context) {
super(props, context);
this._renderCell = this._renderCell.bind(this);
this._renderHeader = this._renderHeader.bind(this);
}
_renderHeader(data) {
return (
<View style={{ height: 35, justifyContent: 'center', backgroundColor: '#eee', paddingLeft: 10 }}>
<Text>{data.sectionId}</Text>
</View>
)
}
_renderCell(data) {
return (
<View style={styles.cell}>
<View style={[styles.placeholderCircle, { backgroundColor: randomcolor() }]} />
<Text style={styles.name}>
{data} {data.split('').reverse().join('')}
</Text>
</View>
);
}
render() {
const title = "let's go";
return (
<AtoZList
sectionHeaderHeight={35}
cellHeight={95}
data={names}
renderCell={this._renderCell}
renderSection={this._renderHeader}
/>
);
}
}
尝试以下:
var self
export default class startActivity extends React.Component {
constructor(props, context) {
super(props, context);
self = this
}
_renderHeader(data) {
return (
<View style={{ height: 35, justifyContent: 'center', backgroundColor: '#eee', paddingLeft: 10 }}>
<Text>{data.sectionId}</Text>
</View>
)
}
_renderCell(data) {
return (
<View style={styles.cell}>
<View style={[styles.placeholderCircle, { backgroundColor: randomcolor() }]} />
<Text style={styles.name}>
{data} {data.split('').reverse().join('')}
</Text>
</View>
);
}
render() {
const title = "let's go";
return (
<AtoZList
sectionHeaderHeight={35}
cellHeight={95}
data={names}
renderCell={self._renderCell}
renderSection={self._renderHeader}
/>
);
}
}