2019-06-29 13:37:21 +02:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import * as React from 'react';
|
2019-08-06 13:28:11 +02:00
|
|
|
import {Body, Container, Content, ListItem, Text} from 'native-base';
|
2019-06-27 11:08:56 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-06-29 13:37:21 +02:00
|
|
|
type Props = {
|
|
|
|
navigation: Object
|
|
|
|
}
|
2019-06-27 11:08:56 +02:00
|
|
|
|
2019-06-29 15:43:57 +02:00
|
|
|
/**
|
|
|
|
* Class defining a screen showing the list of libraries used by the app, taken from package.json
|
|
|
|
*/
|
2019-06-29 13:37:21 +02:00
|
|
|
export default class AboutDependenciesScreen extends React.Component<Props> {
|
2019-06-27 11:08:56 +02:00
|
|
|
|
|
|
|
render() {
|
|
|
|
const nav = this.props.navigation;
|
|
|
|
const data = generateListFromObject(nav.getParam('data', {}));
|
|
|
|
return (
|
|
|
|
<Container>
|
2019-08-07 10:24:35 +02:00
|
|
|
<CustomHeader hasBackButton={true} navigation={nav} title={i18n.t('aboutScreen.libs')}/>
|
2019-06-27 11:08:56 +02:00
|
|
|
<Content>
|
|
|
|
<FlatList
|
|
|
|
data={data}
|
2019-06-29 13:37:21 +02:00
|
|
|
keyExtractor={(item) => item.name}
|
2019-06-27 11:08:56 +02:00
|
|
|
style={{minHeight: 300, width: '100%'}}
|
|
|
|
renderItem={({item}) =>
|
|
|
|
<ListItem>
|
|
|
|
<Body>
|
|
|
|
<Text>
|
|
|
|
{item.name}
|
|
|
|
</Text>
|
|
|
|
<Text note>
|
|
|
|
{item.version.replace('^', '')}
|
|
|
|
</Text>
|
|
|
|
</Body>
|
|
|
|
</ListItem>}
|
|
|
|
/>
|
|
|
|
</Content>
|
|
|
|
</Container>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|