diff --git a/src/App.js b/src/App.js
index db9db30..0d9b16b 100644
--- a/src/App.js
+++ b/src/App.js
@@ -30,7 +30,6 @@ const AppNavigator = createBottomTabNavigator({
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
const { routeName } = navigation.state;
- let IconComponent = Ionicons;
let iconName;
switch(routeName) {
case "Home":
@@ -46,7 +45,7 @@ const AppNavigator = createBottomTabNavigator({
iconName = "ios-settings";
break;
}
- return ;
+ return ;
},
}),
});
diff --git a/src/routes/home.js b/src/routes/home.js
index 404756e..828d4e8 100644
--- a/src/routes/home.js
+++ b/src/routes/home.js
@@ -7,34 +7,47 @@ import { Text, View, TouchableOpacity, FlatList, Image } from "react-native";
export default class HomeScreen extends React.Component {
state = {
dataSource: [],
- debug: "deeeebug"
+ columns: 1,
+ debug: "0.00px"
};
handleScroll = e => {
const el = e.nativeEvent;
+ return;
this.setState({
debug: `${el.contentOffset.y.toFixed(2)}px`
});
};
- handleLayout = e => {
+ handleLayout = async e => {
console.log(e.nativeEvent.layout);
- };
- async componentDidMount() {
- const res = await (await fetch("https://dev.f0ck.me/api/p?eps=54")).json();
+ let h = e.nativeEvent.layout.height;
+ let w = e.nativeEvent.layout.width;
+ let columns = ~~(w / 128);
+ let rows = ~~(h / 128);
+ let eps = 200;//columns * rows;
+
+ const res = await (await fetch(`https://dev.f0ck.me/api/p?eps=${eps}`)).json();
const items = res.items.map(e => ({
id: e.id,
src: `https://f0ck.me/t/${e.id}.png`
}));
this.setState({
- dataSource: items
+ dataSource: items,
+ columns: columns,
+ debug: `c: ${columns} r: ${rows} eps: ${eps}`
});
+ };
+
+ async componentDidMount() {
+ return true; // lul
}
render() {
+
return (
-
+
{this.state.debug}
(
-
+
)}
- numColumns={4}
+ key = {this.state.columns}
+ numColumns={this.state.columns}
keyExtractor={(item, index) => index.toString()}
/>