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)

  • 2
    The renderList method renderList not return data from you. Missing return before data.map(...) - Vasily Barbashev
  • 2
    Also, the styles that are used in the renderList will be undefined and will fall when accessing the property. - Vasily Barbashev
  • one
    And by the way, you don't have this.state it is null and not processed in the AppBB class AppBB - Vasily Barbashev

0