Skip to content

Commit

Permalink
FEATURE: Navigating to DeckDetails
Browse files Browse the repository at this point in the history
Action to navigate to deck details screen is working
  • Loading branch information
diogosilverio committed Jan 23, 2018
1 parent 789f6e6 commit fb9c039
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 11 additions & 1 deletion components/flashcards/DeckDetails.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import React, { Component } from 'react';
import { Text, View } from 'react-native';


export default class DeckDetails extends Component {

static navigationOptions = ({ navigation }) => {
const { deckKey } = navigation.state.params;

return {
title: `'${deckKey}' Details`,
}
}

render() {

return (
<View>
<Text>DeckDetails</Text>
<Text>DeckDetails: {this.props.navigation.state.params.deckKey}</Text>
</View>
);
}
Expand Down
4 changes: 1 addition & 3 deletions components/flashcards/DeckList.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class DeckList extends Component {
routeName
});

console.log(navigation);

this.props.navigation.dispatch(navigation);
}

Expand All @@ -64,7 +62,7 @@ class DeckList extends Component {
return (
<ScrollView style={styles.container}>
{this.props.decks.map((deck) => (
<TouchableOpacity key={deck.name}>
<TouchableOpacity key={deck.name} onPress={() => this.props.screenProps.rootNavigation.navigate('DeckDetails', { deckKey: deck.name })}>
<DeckItem deck={deck} />
</TouchableOpacity>
))}
Expand Down
4 changes: 2 additions & 2 deletions components/navigators/FlashTabNavigator.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default class FlashTabNavigator extends Component {
}

render() {

const tabBarOptions = {
inactiveTintColor: COLOR_B_1,
activeTintColor: COLOR_A_1,
Expand All @@ -39,7 +39,7 @@ export default class FlashTabNavigator extends Component {
});

return (
<FlashTab />
<FlashTab screenProps={{rootNavigation: this.props.navigation}} />
);
}

Expand Down

0 comments on commit fb9c039

Please sign in to comment.