-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
49 lines (45 loc) · 1.38 KB
/
App.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
45
46
47
48
49
import React, { useState } from 'react';
import { StyleSheet } from 'react-native';
import 'react-native-gesture-handler';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import { Icon } from 'react-native-elements';
import ContactList from './components/ContactList';
import LoginScreen from './components/LoginScreen';
import ContactCard from './components/ContactCard';
const Stack = createStackNavigator();
const App = () => {
const [icon, setIcon] = useState('ios-star');
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Contacts" component={LoginScreen} />
<Stack.Screen name="ContactList" component={ContactList} />
<Stack.Screen
name="Contact Details"
component={ContactCard}
options={{
headerRight: () => (
<Icon
style={styles.iconStyles}
onPress={() => {
icon === 'ios-star'
? setIcon('ios-star-outline')
: setIcon('ios-star');
}}
type="ionicon"
name={icon}
/>
)
}}
/>
</Stack.Navigator>
</NavigationContainer>
);
};
const styles = StyleSheet.create({
iconStyles: {
padding: 10
}
});
export default App;