()
| 7 | import styles from './User.styles'; |
| 8 | |
| 9 | export const User = () => { |
| 10 | const { logout, isLoggedIn } = useIterableApp(); |
| 11 | const [loggedInAs, setLoggedInAs] = useState<string>(''); |
| 12 | |
| 13 | useEffect(() => { |
| 14 | if (isLoggedIn) { |
| 15 | Iterable.getEmail().then((email) => setLoggedInAs(email || '')); |
| 16 | } else { |
| 17 | setLoggedInAs(''); |
| 18 | } |
| 19 | }, [isLoggedIn]); |
| 20 | |
| 21 | return ( |
| 22 | <SafeAreaView style={styles.container}> |
| 23 | <Text style={styles.appName}>Welcome Iterator</Text> |
| 24 | <Text style={styles.text}>Logged in as {loggedInAs}</Text> |
| 25 | <TouchableOpacity style={styles.button} onPress={logout}> |
| 26 | <Text style={styles.buttonText}>Logout</Text> |
| 27 | </TouchableOpacity> |
| 28 | </SafeAreaView> |
| 29 | ); |
| 30 | }; |
| 31 | |
| 32 | export default User; |
nothing calls this directly
no test coverage detected
searching dependent graphs…