Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
ReactNativeToDo2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Isaac Solomon
ReactNativeToDo2
Commits
18ab96cc
Commit
18ab96cc
authored
2 months ago
by
isaacwsolomon
Browse files
Options
Downloads
Patches
Plain Diff
Check mark displayed
parent
39aafcbf
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/screens/list.tsx
+19
-6
19 additions, 6 deletions
app/screens/list.tsx
with
19 additions
and
6 deletions
app/screens/list.tsx
+
19
−
6
View file @
18ab96cc
import
{
addDoc
,
collection
,
onSnapshot
}
from
'
firebase/firestore
'
;
import
{
addDoc
,
collection
,
onSnapshot
}
from
'
firebase/firestore
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
{
View
,
Text
,
Button
,
TextInput
,
StyleSheet
,
FlatList
}
from
'
react-native
'
;
import
{
View
,
Text
,
Button
,
TextInput
,
StyleSheet
,
FlatList
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
FIRESTORE_DB
}
from
'
../../firebaseConfig
'
;
import
{
FIRESTORE_DB
}
from
'
../../firebaseConfig
'
;
import
Ionicons
from
'
@expo/vector-icons/Ionicons
'
;
export
interface
Todo
{
export
interface
Todo
{
title
:
string
;
title
:
string
;
...
@@ -41,11 +42,23 @@ const addTodo = async () => {
...
@@ -41,11 +42,23 @@ const addTodo = async () => {
setTodo
(
''
);
setTodo
(
''
);
};
};
const
renderTodo
=
({
item
}:
any
)
=>
{
const
renderTodo
=
({
item
}
:
any
)
=>
{
const
toggleDone
=
async
()
=>
{
}
const
deleteItem
=
async
()
=>
{
}
return
(
return
(
<
Text
>
{
item
.
title
}
</
Text
>
<
View
>
)
<
TouchableOpacity
onPress
=
{
toggleDone
}
>
}
{
!
item
.
done
&&
<
Ionicons
name
=
"checkmark-circle"
/>
}
<
Text
>
{
item
.
title
}
</
Text
>
</
TouchableOpacity
>
</
View
>
);
};
return
(
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
form
}
>
<
View
style
=
{
styles
.
form
}
>
...
@@ -58,7 +71,7 @@ return (
...
@@ -58,7 +71,7 @@ return (
<
View
>
<
View
>
<
FlatList
<
FlatList
data
=
{
todos
}
data
=
{
todos
}
renderItem
=
{
renderTodo
}
renderItem
=
{
(
item
)
=>
renderTodo
(
item
)
}
keyExtractor
=
{
(
todo
:
Todo
)
=>
todo
.
id
}
keyExtractor
=
{
(
todo
:
Todo
)
=>
todo
.
id
}
/>
/>
</
View
>
</
View
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment