Skip to content

Commit f0b208e

Browse files
Add files via upload
1 parent 958c04f commit f0b208e

37 files changed

+867
-30
lines changed

app/assets/adaptive-icon.png

17.1 KB
Loading

app/assets/favicon.png

1.43 KB
Loading

app/components/AppForm.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Formik } from "formik";
2+
import React from "react";
3+
4+
function AppForm({ initValues, onSubmit, validationSchema, children }) {
5+
return (
6+
<Formik
7+
initialValues={initValues}
8+
onSubmit={onSubmit}
9+
validationSchema={validationSchema}
10+
>
11+
{() => <>{children}</>}
12+
</Formik>
13+
);
14+
}
15+
16+
export default AppForm;

app/components/AppFormField.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from "react";
2+
import AppTextInput from "./AppTextInput";
3+
import ErrorMessage from "./ErrorMessage";
4+
import { useFormikContext } from "formik";
5+
function AppFormField({ name, ...otherProps }) {
6+
const {setFieldTouched,handleChange,errors,touched} = useFormikContext();
7+
return (
8+
<>
9+
<AppTextInput
10+
{...otherProps}
11+
onBlur={() => setFieldTouched(name)}
12+
onChangeText={handleChange(name)}
13+
/>
14+
<ErrorMessage error={errors[name]} visible={touched[name]} />
15+
</>
16+
);
17+
}
18+
19+
export default AppFormField;

app/components/AppPicker.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ function AppPicker({ icon, items, onSelectItem, placeholder, selectedItem }) {
2929
style={styles.icon}
3030
/>
3131
)}
32-
<AppText style={styles.text}>
33-
{selectedItem ? selectedItem.label : placeholder}
34-
</AppText>
32+
{selectedItem ? (
33+
<AppText style={styles.text}>{selectedItem.label}</AppText>
34+
) : (
35+
<AppText style={styles.placeholder}>{placeholder}</AppText>
36+
)}
37+
3538
<MaterialCommunityIcons
3639
name="chevron-down"
3740
size={20}
@@ -73,6 +76,10 @@ const styles = StyleSheet.create({
7376
icon: {
7477
marginRight: 10,
7578
},
79+
placeholder: {
80+
color: defaultStyles.colors.medium,
81+
flex: 1,
82+
},
7683
text: {
7784
flex: 1,
7885
},

app/components/AppTextInput.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ function AppTextInput({ icon, ...otherProps }) {
1515
style={styles.icon}
1616
/>
1717
)}
18-
<TextInput style={defaultStyles.text} {...otherProps} />
18+
<TextInput
19+
placeholderTextColor={defaultStyles.colors.medium}
20+
style={defaultStyles.text}
21+
{...otherProps}
22+
/>
1923
</View>
2024
);
2125
}

app/components/Button.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from "react";
2+
import { StyleSheet, Text, TouchableOpacity } from "react-native";
3+
4+
import colors from "../config/colors";
5+
6+
function AppButton({ title, onPress, color = "primary" }) {
7+
return (
8+
<TouchableOpacity
9+
style={[styles.button, { backgroundColor: colors[color] }]}
10+
onPress={onPress}
11+
>
12+
<Text style={styles.text}>{title}</Text>
13+
</TouchableOpacity>
14+
);
15+
}
16+
17+
const styles = StyleSheet.create({
18+
button: {
19+
backgroundColor: colors.primary,
20+
borderRadius: 25,
21+
justifyContent: "center",
22+
alignItems: "center",
23+
padding: 15,
24+
width: "100%",
25+
marginVertical: 10,
26+
},
27+
text: {
28+
color: colors.white,
29+
fontSize: 18,
30+
textTransform: "uppercase",
31+
fontWeight: "bold",
32+
},
33+
});
34+
35+
export default AppButton;

app/components/Card.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
import React from "react";
22
import { View, StyleSheet, Image } from "react-native";
33

4-
import AppText from "./AppText";
4+
import Text from "./Text";
55
import colors from "../config/colors";
66

77
function Card({ title, subTitle, image }) {
88
return (
99
<View style={styles.card}>
1010
<Image style={styles.image} source={image} />
1111
<View style={styles.detailsContainer}>
12-
<AppText style={styles.title}>{title}</AppText>
13-
<AppText style={styles.subTitle}>{subTitle}</AppText>
12+
<Text style={styles.title} numberOfLines={1}>
13+
{title}
14+
</Text>
15+
<Text style={styles.subTitle} numberOfLines={2}>
16+
{subTitle}
17+
</Text>
1418
</View>
1519
</View>
1620
);

app/components/CategoryPickerItem.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import React from "react";
2+
import { View, StyleSheet, TouchableOpacity } from "react-native";
3+
4+
import Icon from "./Icon";
5+
import Text from "./Text";
6+
7+
function CategoryPickerItem({ item, onPress }) {
8+
return (
9+
<View style={styles.container}>
10+
<TouchableOpacity onPress={onPress}>
11+
<Icon
12+
backgroundColor={item.backgroundColor}
13+
name={item.icon}
14+
size={80}
15+
/>
16+
</TouchableOpacity>
17+
<Text style={styles.label}>{item.label}</Text>
18+
</View>
19+
);
20+
}
21+
22+
const styles = StyleSheet.create({
23+
container: {
24+
paddingHorizontal: 30,
25+
paddingVertical: 15,
26+
alignItems: "center",
27+
width: "33%",
28+
},
29+
label: {
30+
marginTop: 5,
31+
textAlign: "center",
32+
},
33+
});
34+
35+
export default CategoryPickerItem;

app/components/ErrorMessage.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from 'react';
2+
import {StyleSheet} from 'react-native'
3+
import AppText from './AppText';
4+
function ErrorMessage({error,visible}) {
5+
console.log(error,visible);
6+
if (!error || !visible) {
7+
return null
8+
}
9+
return (
10+
<AppText style={styles.error}>{error}</AppText>
11+
);
12+
}
13+
const styles = StyleSheet.create({
14+
error : {color:'red'}
15+
})
16+
export default ErrorMessage;

0 commit comments

Comments
 (0)