application-amicale/screens/About/AboutDependenciesScreen.js
2019-06-27 11:08:56 +02:00

47 lines
1.7 KiB
JavaScript

import React from 'react';
import {Container, Text, Content, ListItem, Body, Left, Thumbnail, Right, Button, Icon} from 'native-base';
import CustomHeader from "../../components/CustomHeader";
import {FlatList} from "react-native";
import i18n from "i18n-js";
function generateListFromObject(object) {
let list = [];
let keys = Object.keys(object);
let values = Object.values(object);
for (let i = 0; i < keys.length; i++) {
list.push({name: keys[i], version: values[i]});
}
return list;
}
export default class AboutDependenciesScreen extends React.Component {
render() {
const nav = this.props.navigation;
const data = generateListFromObject(nav.getParam('data', {}));
return (
<Container>
<CustomHeader backButton={true} navigation={nav} title={i18n.t('aboutScreen.libs')} />
<Content>
<FlatList
data={data}
keyExtractor={(item, index) => item.name}
style={{minHeight: 300, width: '100%'}}
renderItem={({item}) =>
<ListItem>
<Body>
<Text>
{item.name}
</Text>
<Text note>
{item.version.replace('^', '')}
</Text>
</Body>
</ListItem>}
/>
</Content>
</Container>
);
}
}