Skip to content

Commit 9672ce8

Browse files
committed
fix: change validation in newtaskscreen
1 parent 497a910 commit 9672ce8

File tree

3 files changed

+1644
-2121
lines changed

3 files changed

+1644
-2121
lines changed

config.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
module.exports.baseURL = "http://192.168.3.18:3000";
2-
// module.exports.baseURL = "http://172.20.10.6:3000";
1+
module.exports.baseURL = "http://192.168.1.22:3000"

src/screens/NewTaskScreen.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
ActivityIndicator,
3+
Alert,
34
Keyboard,
45
Modal,
56
ScrollView,
@@ -58,9 +59,16 @@ const NewTaskScreen = ({ setModalVisible }) => {
5859
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
5960

6061
console.log("formData", formData);
61-
if (title === "") alert("Please add title");
62-
// else if (description === "") alert("Please add description");
63-
else if (taskDate === "") alert("Please choose date");
62+
if (title.trim().length === 0) {
63+
Alert.alert("Please add title");
64+
return;
65+
} else if (description.trim().length === 0) {
66+
Alert.alert("Please add description");
67+
return;
68+
} else if (taskDate.trim().length === 0) {
69+
Alert.alert("Please choose date");
70+
return;
71+
}
6472
else {
6573
setLoading(true);
6674
const newSavedTask = await tasksAPI.createTask(

0 commit comments

Comments
 (0)