-
Notifications
You must be signed in to change notification settings - Fork 0
/
HistoryScreen.js
44 lines (39 loc) · 1.08 KB
/
HistoryScreen.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { useContext } from 'react'
import { ScrollView } from 'react-native'
import { MainContext } from './MainContext'
import HistoryItem from './components/HistoryItem'
import Screen from './components/Screen'
export default function HistoryScreen() {
const {
history,
setHistory,
historyVisible,
setHistoryVisible,
} = useContext(MainContext)
function deleteAll() {}
// onHideScreenPress = () => setHistoryVisible(false)
return <Screen
component={<Component history={history} />}
title="History"
iconName="trash-2"
iconSize={24}
iconOnPress={deleteAll}
setHistory={setHistory}
screenVisible={historyVisible}
onHideScreenPress={() => setHistoryVisible(false)}
/>
}
export function Component({ history }) {
return (
<ScrollView contentContainerStyle={{}}>
{history.map(({ pageTitle, pageUrl }, idx) => (
<HistoryItem
key={idx}
pageTitle={pageTitle}
pageUrl={pageUrl}
pageIdx={idx}
/>
))}
</ScrollView>
)
}