import React from "react"; import theme from "../config/themes"; import { Text, View, TouchableOpacity, FlatList, Image } from 'react-native'; export default class HomeScreen extends React.Component { state = { dataSource: [], debug: "deeeebug" }; handleScroll = e => { const el = e.nativeEvent; this.setState({ debug: `${el.contentOffset.y.toFixed(2)}px` }); }; handleLayout = e => { console.log(e.nativeEvent.layout); }; async componentDidMount() { const res = await (await fetch("https://dev.f0ck.me/api/p?eps=54")).json(); const items = res.items.map(e => ({ id: e.id, src: `https://f0ck.me/t/${e.id}.png` })); this.setState({ dataSource: items }); } render() { return ( {this.state.debug} ( )} numColumns={4} keyExtractor={(item, index) => index.toString()} /> ); } }