-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
36 lines (30 loc) · 928 Bytes
/
App.tsx
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
import React, { useState } from "react";
import { View, Text, Button, FlatList } from "react-native";
import * as Haptics from "expo-haptics";
import { fakeContactData } from "./__mocks__/expo-contacts";
const App = () => {
const [showContacts, setShowContacts] = useState(false);
const handleOpenContacts = async () => {
await Haptics.selectionAsync();
setShowContacts(true);
};
return (
<View>
<Text>Hybrid App Development Week Assignment 2</Text>
<Button title="Open Contacts" onPress={handleOpenContacts} />
{showContacts && (
<View>
<Text>Contacts list:</Text>
<FlatList
data={fakeContactData}
keyExtractor={(contact) => contact.id.toString()}
renderItem={({ item: contact }) => (
<Text>{contact.name}</Text>
)}
/>
</View>
)}
</View>
);
};
export default App;