Skip to content

Commit

Permalink
rebased from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
danicaMat committed Feb 25, 2022
1 parent 976a47c commit 59bf7e5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
8 changes: 6 additions & 2 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
const { getDefaultConfig } = require('@expo/metro-config');

module.exports = getDefaultConfig(__dirname);
const defaultConfig = getDefaultConfig(__dirname);

defaultConfig.resolver.assetExts.push('md');

module.exports = defaultConfig;
28 changes: 20 additions & 8 deletions screens/Profile/Credits.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React, { useEffect, useState } from 'react';
import { Asset } from 'expo-asset';
import { Dimensions, StyleSheet, View } from 'react-native';
import { Divider, Icon, ListItem, Overlay } from 'react-native-elements';
import Markdown from 'react-native-simple-markdown'
import { Button, Text, Column, Row } from '../../components/ui';
import { Colors } from '../../components/ui/styleUtils';
const mdFile = require('../../Credits.md')

export const Credits: React.FC<CreditsProps> = (props) => {
const [isViewing, setIsViewing] = useState(false);
const [content, setContent] = useState("");

const styles = StyleSheet.create({
buttonContainer: {
Expand All @@ -19,7 +22,7 @@ export const Credits: React.FC<CreditsProps> = (props) => {
width: Dimensions.get('screen').width
},
markdownView: {
padding: 8
padding: 20
}
});

Expand All @@ -29,6 +32,19 @@ export const Credits: React.FC<CreditsProps> = (props) => {
}
}

const fetchLocalFile = async () => {
let file = Asset.fromModule(mdFile)
file = await fetch(file.uri)
file = await file.text()
setContent(file);
}

useEffect(() => {
(async () => {
await fetchLocalFile();
})();
}, [])

return (
<ListItem bottomDivider onPress={() => setIsViewing(true)}>
<ListItem.Content>
Expand All @@ -45,15 +61,11 @@ export const Credits: React.FC<CreditsProps> = (props) => {
<View style={styles.buttonContainer}>
<Button type="clear" icon={<Icon name="chevron-left" color={Colors.Orange} />} title="Back" onPress={() => setIsViewing(false)}/>
</View>
<Text>Credits</Text>
<Text size="small">Credits and legal notices</Text>
</Row>
<Divider />
<View styles={styles.markdownView}>
<Markdown styles={markdownStyles}>
#Legal Notices! {'\n\n'}
#Legal Notices! {'\n\n'}
#Legal Notices! {'\n\n'}
</Markdown>
<View style={styles.markdownView}>
<Markdown children={content} />
</View>
</View>

Expand Down

0 comments on commit 59bf7e5

Please sign in to comment.