From 491f3219abb4b8a4d55c5e9786a01cb6d0c0b1b9 Mon Sep 17 00:00:00 2001 From: Rickard Natt och Dag Date: Mon, 15 Feb 2021 08:50:04 +0100 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20direktl=C3=A4nkning=20fr=C3=A5n=20kn?= =?UTF-8?q?apparna=20i=20barnlistan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/app/components/child.component.js | 12 +++++++----- packages/app/components/childListItem.component.js | 12 ++++++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/app/components/child.component.js b/packages/app/components/child.component.js index a91c1b4a7..e5f8cf937 100644 --- a/packages/app/components/child.component.js +++ b/packages/app/components/child.component.js @@ -117,8 +117,10 @@ const TopTabBar = ({ navigation, state }) => ( ) -const TabNavigator = () => ( - }> +const TabNavigator = ({initialRouteName = 'Nyheter'}) => ( + }> @@ -126,8 +128,8 @@ const TabNavigator = () => ( ) -export const Child = ({ route, navigation }) => { - const { child, color } = route.params +export const Child = ({route, navigation}) => { + const {child, color, selectedTab} = route.params const BackIcon = (props) => @@ -148,7 +150,7 @@ export const Child = ({ route, navigation }) => { accessoryLeft={BackAction} style={styles.topBar} /> - + ) diff --git a/packages/app/components/childListItem.component.js b/packages/app/components/childListItem.component.js index 9e36c9020..474a98430 100644 --- a/packages/app/components/childListItem.component.js +++ b/packages/app/components/childListItem.component.js @@ -76,7 +76,7 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', { child, color, selectedTab: 0 }) + navigation.navigate('Child', {child, color, selectedTab: 'Nyheter'}) } accessoryLeft={NewsIcon}> {`${(news || []).length}`} @@ -86,7 +86,11 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', { child, color, selectedTab: 1 }) + navigation.navigate('Child', { + child, + color, + selectedTab: 'Notifieringar', + }) } accessoryLeft={NotificationsIcon}> {`${(notifications || []).length}`} @@ -96,7 +100,7 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', { child, color, selectedTab: 2 }) + navigation.navigate('Child', {child, color, selectedTab: 'Kalender'}) } accessoryLeft={CalendarIcon}> {`${(notifications || []).length}`} @@ -106,7 +110,7 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', { child, color, selectedTab: 3 }) + navigation.navigate('Child', {child, color, selectedTab: 'Klassen'}) } accessoryLeft={PeopleIcon}> {`${(classmates || []).length}`} From da2892c6a577b79cca4340ff3c6036f051319a70 Mon Sep 17 00:00:00 2001 From: Rickard Natt och Dag Date: Mon, 15 Feb 2021 08:54:42 +0100 Subject: [PATCH 2/2] refactor: konsekvent namngivning av navigeringsparameter --- packages/app/components/child.component.js | 4 ++-- .../app/components/childListItem.component.js | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/app/components/child.component.js b/packages/app/components/child.component.js index e5f8cf937..5f6a956b6 100644 --- a/packages/app/components/child.component.js +++ b/packages/app/components/child.component.js @@ -129,7 +129,7 @@ const TabNavigator = ({initialRouteName = 'Nyheter'}) => ( ) export const Child = ({route, navigation}) => { - const {child, color, selectedTab} = route.params + const {child, color, initialRouteName} = route.params const BackIcon = (props) => @@ -150,7 +150,7 @@ export const Child = ({route, navigation}) => { accessoryLeft={BackAction} style={styles.topBar} /> - + ) diff --git a/packages/app/components/childListItem.component.js b/packages/app/components/childListItem.component.js index 474a98430..f35b001cd 100644 --- a/packages/app/components/childListItem.component.js +++ b/packages/app/components/childListItem.component.js @@ -76,7 +76,11 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', {child, color, selectedTab: 'Nyheter'}) + navigation.navigate('Child', { + child, + color, + initialRouteName: 'Nyheter', + }) } accessoryLeft={NewsIcon}> {`${(news || []).length}`} @@ -89,7 +93,7 @@ export const ChildListItem = ({ navigation, child, color }) => { navigation.navigate('Child', { child, color, - selectedTab: 'Notifieringar', + initialRouteName: 'Notifieringar', }) } accessoryLeft={NotificationsIcon}> @@ -100,7 +104,11 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', {child, color, selectedTab: 'Kalender'}) + navigation.navigate('Child', { + child, + color, + initialRouteName: 'Kalender', + }) } accessoryLeft={CalendarIcon}> {`${(notifications || []).length}`} @@ -110,7 +118,11 @@ export const ChildListItem = ({ navigation, child, color }) => { status="control" size="small" onPress={() => - navigation.navigate('Child', {child, color, selectedTab: 'Klassen'}) + navigation.navigate('Child', { + child, + color, + initialRouteName: 'Klassen', + }) } accessoryLeft={PeopleIcon}> {`${(classmates || []).length}`}