Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Input handling in AddCard Decompose component into smaller component
- Loading branch information
1 parent
01d0643
commit 41438ef
Showing
6 changed files
with
149 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
|
||
const styles = { | ||
deckText: { | ||
fontSize: 40, | ||
color: 'white', | ||
fontFamily: 'Menlo-Bold', | ||
textAlign: 'center', | ||
marginTop: 50, | ||
}, | ||
cardNumber: { | ||
color: 'white', | ||
fontSize: 15, | ||
textAlign: 'center', | ||
marginTop: 10, | ||
}, | ||
}; | ||
|
||
// eslint-disable-next-line react/prop-types | ||
const DeckViewDetails = ({ title, questions }) => ( | ||
<View> | ||
<Text style={styles.deckText}> | ||
{title} | ||
</Text> | ||
<Text style={styles.cardNumber}> | ||
{questions.length === 1 | ||
? `${questions.length} Card` | ||
: `${questions.length} Cards` | ||
} | ||
</Text> | ||
</View> | ||
); | ||
|
||
export default DeckViewDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React from 'react'; | ||
import { | ||
createBottomTabNavigator, | ||
createMaterialTopTabNavigator, | ||
createStackNavigator, | ||
createAppContainer, | ||
} from 'react-navigation'; | ||
import { Ionicons } from '@expo/vector-icons'; | ||
import { Platform } from 'react-native'; | ||
import AddDeck from './components/AddDeck'; | ||
import DeckList from './components/DeckList'; | ||
import DeckView from './components/DeckView'; | ||
import AddCard from './components/AddCard'; | ||
import Quiz from './components/Quiz'; | ||
|
||
const Tabs = { | ||
DeckList: { | ||
screen: DeckList, | ||
navigationOptions: { | ||
tabBarLabel: 'Deck List', | ||
tabBarIcon: () => <Ionicons name="ios-list" size={32} color="black" />, | ||
}, | ||
}, | ||
AddDeck: { | ||
screen: AddDeck, | ||
navigationOptions: { | ||
tabBarLabel: 'Add Deck', | ||
tabBarIcon: () => <Ionicons name="ios-add" size={32} color="black" /> | ||
, | ||
}, | ||
}, | ||
}; | ||
|
||
const tabOptions = { | ||
navigationOptions: { | ||
header: null, | ||
}, | ||
tabBarOptions: { | ||
activeTintColor: 'black', | ||
labelStyle: { fontSize: 18 }, | ||
style: { | ||
height: 56, | ||
backgroundColor: '#f6f5f5', | ||
shadowColor: 'rgba(0, 0, 0, 0.24)', | ||
shadowOffset: { | ||
width: 0, | ||
height: 3, | ||
}, | ||
shadowRadius: 6, | ||
shadowOpacity: 1, | ||
}, | ||
}, | ||
}; | ||
|
||
const tabNavigationPlatform = Platform.OS === 'ios' | ||
? createBottomTabNavigator(Tabs, tabOptions) | ||
: createMaterialTopTabNavigator(Tabs, tabOptions); | ||
const TabNavigator = createAppContainer(tabNavigationPlatform); | ||
|
||
const Stack = createStackNavigator({ | ||
Home: { | ||
screen: TabNavigator, | ||
}, | ||
AddDeck: { | ||
screen: AddDeck, | ||
}, | ||
DeckList: { | ||
screen: DeckList, | ||
navigationOptions: () => ({ | ||
title: 'Deck List', | ||
}), | ||
}, | ||
DeckView: { | ||
screen: DeckView, | ||
navigationOptions: () => ({ | ||
title: 'Deck', | ||
}), | ||
}, | ||
AddCard: { | ||
screen: AddCard, | ||
navigationOptions: () => ({ | ||
title: 'Add Card', | ||
}), | ||
}, | ||
Quiz: { | ||
screen: Quiz, | ||
navigationOptions: () => ({ | ||
title: 'Quiz', | ||
}), | ||
}, | ||
}); | ||
|
||
const StackNavigator = createAppContainer(Stack); | ||
export default StackNavigator; |