Output does not work in List View
import React, {Component} from 'react'; import { Alert, AppRegistry, StyleSheet, Text, View, ListView, TouchableHighlight } from 'react-native'; const data = require('./assets/upr/categories.json'); class AppBB extends Component { renderList (data) { data.map((upr) => { return ( <View style={styles.wrapper}> <View> <Text style={styles.text}>{upr.uprtitle}</Text> </View> </View> ); }); } render () { return ( <ListView ref="listView" automaticallyAdjustContentInsets={false} dataSource={this.state.dataSource} renderRow={this.renderList} /> ); } }
Writes
null is not an object (evaluting this.state.dataSource)
renderList
methodrenderList
not return data from you. Missingreturn
beforedata.map(...)
- Vasily Barbashevstyles
that are used in therenderList
will beundefined
and will fall when accessing the property. - Vasily Barbashevthis.state
it is null and not processed in theAppBB
classAppBB
- Vasily Barbashev