FlatList测试

import React,{Component} from 'react';
import {
	View,Text,FlatList
} from 'react-native';

const data = [
		{key:'a',text:'jiangzhixi'},
		{key:'b',text:'jiangdonlin'},
		{key:'c',text:'huqianlong'},
	];
const dataone = [{key: 'a',title:'aa'}, {key: 'b',title:'ba'}];
class Separator extends Component{
	render(){
		return (
			   ---
		);
	}
}
export default class TestList extends Component{
	
	_renderItem(item){
		return (
			
				{item.text}
			
		)
	}
	
	_separator(){
		return ;
	}
	
	_headComp(){
		return 我是头
	}
	
	_endComp(){
		return 我是end
	}
	
	 _keyExtractor(item, index){
	 	console.log(item);//这里的item就是data里的每一项
	 	console.log(index);//index就是每一项的索引
	 }
	
	render(){
		return (
			
				 this._renderItem(item)}
					keyExtractor={this._keyExtractor}
					/>
			
		);
	}
}

你可能感兴趣的:(【react.js】)