diff --git a/packages/app/components/children.component.js b/packages/app/components/children.component.js
index 79cc99a7..2d8c8070 100644
--- a/packages/app/components/children.component.js
+++ b/packages/app/components/children.component.js
@@ -126,7 +126,9 @@ export const Children = ({ navigation }) => {
contentContainerStyle={styles.contentContainer}
data={children}
renderItem={renderItem} />
- : Laddar...}
+ :
+ Laddar...
+ }
)
@@ -142,7 +144,9 @@ const styles = StyleSheet.create({
margin: 10
},
itemDescription: {
- zIndex: 1,
+ marginVertical: 16
+ },
+ loading: {
marginVertical: 16
},
itemFooter: {
diff --git a/packages/app/components/details.component.js b/packages/app/components/details.component.js
deleted file mode 100644
index 71b7a0ff..00000000
--- a/packages/app/components/details.component.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import React from 'react';
-import { SafeAreaView } from 'react-native';
-import { Divider, Icon, Layout, Text, TopNavigation, TopNavigationAction } from '@ui-kitten/components';
-
-const BackIcon = (props) => (
-
-);
-
-export const DetailsScreen = ({ navigation }) => {
-
- const navigateBack = () => {
- navigation.goBack();
- };
-
- const BackAction = () => (
-
- );
-
- return (
-
-
-
-
- DETAILS
-
-
- );
-};
\ No newline at end of file
diff --git a/packages/app/components/login.component.js b/packages/app/components/login.component.js
index 3fcf83ee..5e1542df 100644
--- a/packages/app/components/login.component.js
+++ b/packages/app/components/login.component.js
@@ -20,16 +20,14 @@ export const Login = ({ navigation }) => {
useEffect(() => {
setValid(Personnummer.valid(socialSecurityNumber))
- if (jwt) navigateDetails([])
-
- //setHasBankId(Linking.canOpenUrl('bankid://'))
+ // setHasBankId(Linking.canOpenUrl('bankid://'))
}, [socialSecurityNumber])
useEffect(() => {
setArgument(funArguments[Math.floor(Math.random() * funArguments.length)])
}, [])
- const navigateDetails = (children) => {
+ const navigateToChildren = (children) => {
console.log('continuing..')
navigation.navigate('Children', {children});
};
@@ -67,28 +65,14 @@ export const Login = ({ navigation }) => {
console.log('got token', token)
if (hasBankId) Linking.openURL(`bankid:///?autostarttoken=${token.token}`)
- const jwt = await fetch(`${baseUrl}/login/${token.order}/jwt`, {timeoutInterval: 60000}).then(res => res.json())
+ const jwt = await fetch(`${baseUrl}/login/${token.order}/jwt`, {timeoutInterval: 60000}).then(res => res.ok ? res : Promise.reject(res.json())).then(res => res.json())
console.log('got jwt', jwt)
await setJwt(jwt)
- console.log('requesting children...')
setVisible(false)
- if (jwt) return navigateDetails([])
- } catch (err) {
+ if (jwt) return navigateToChildren([])
+ } catch (err) {
console.error(err)
- setError(err.message)
- }
- }
-
- // TODO - move this logic to other file than login...
- const getChildren = async (jwt) => {
- const headers = {authorization: 'Bearer ' + jwt}
- try {
- console.log('requesting children...', {headers})
- const children = await fetch(`${baseUrl}/children`, {headers}).then(res => res.json())
- console.log('got children', children)
- return children
- } catch (err) {
- setError(children.err)
+ setError(err.message || err)
}
}
@@ -100,29 +84,45 @@ export const Login = ({ navigation }) => {
return (
-
- Vårdnadshavare
- handleInput(text)}
- placeholder="Ditt personnr (12 siffror)"/>
-
+ }
+ setVisible(false)}>
{hasBankId ? Öppnar BankID. Växla tillbaka till denna app sen. : Väntar på BankID...}
+
setVisible(false)}>
diff --git a/packages/app/components/navigation.component.js b/packages/app/components/navigation.component.js
index a6aa79f3..02e038d0 100644
--- a/packages/app/components/navigation.component.js
+++ b/packages/app/components/navigation.component.js
@@ -4,21 +4,21 @@ import { createStackNavigator } from '@react-navigation/stack';
import { Login } from './login.component';
import { Children } from './children.component';
import { Child } from './child.component';
-import { DetailsScreen } from './details.component';
+import { NewsItem } from './newsItem.component';
const { Navigator, Screen } = createStackNavigator();
const HomeNavigator = () => (
-
-
-
-
+
+
+
+
);
-export const AppNavigator = (children) => (
+export const AppNavigator = () => (
diff --git a/packages/app/components/newsList.component.js b/packages/app/components/newsList.component.js
index 1e793e5b..740efdbe 100644
--- a/packages/app/components/newsList.component.js
+++ b/packages/app/components/newsList.component.js
@@ -1,26 +1,26 @@
import React from 'react'
import { StyleSheet, View } from 'react-native'
import { Card, List, Text, Layout } from '@ui-kitten/components'
-import Markdown from 'react-native-markdown-display'
import { Image } from 'react-native-svg'
+import { NavigationContainer } from '@react-navigation/native'
+import { useNavigation } from '@react-navigation/native'
export const NewsList = ({news}) => {
+ const navigation = useNavigation()
const renderItemHeader = (headerProps, info) => (
{info.item.header}
- By Wikipedia
+ Publicerad på Skolplattformen
)
const renderItem = (info) => (
navigation.navigate('NewsItem', {newsItem: info.item})}
header={headerProps => renderItemHeader(headerProps, info)}>
-
- {decodeURIComponent(info.item.body)}
-
)