MCPcopy Create free account
hub / github.com/Iterable/react-native-sdk / User

Function User

example/src/components/User/User.tsx:9–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7import styles from './User.styles';
8
9export 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
32export default User;

Callers

nothing calls this directly

Calls 2

useIterableAppFunction · 0.90
getEmailMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…