Add text when no subject is shown.

This commit is contained in:
Ceda EI 2020-03-16 20:43:14 +05:30
parent 52360965c2
commit 635dbbf709
1 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import {
Button,
Card,
FAB,
Text
} from "react-native-paper";
import {
@ -20,6 +21,10 @@ export default function Subjects({ subjects, addSubject, removeSubject }) {
}
return (
<>
{subjects.length === 0 ?
<Text style={style.text}>No Subjects added. Press + to add a subject.</Text>
: null
}
{subjects.map(subject => (
<Card key={subject.id} style={style.card}>
<Card.Title title={subject.name} />
@ -62,5 +67,9 @@ Subjects.propTypes = {
const style = StyleSheet.create({
card: {
marginTop: 12,
},
text: {
marginTop: 12,
textAlign: "center",
}
});