Skip to content

Commit 8784182

Browse files
authored
feat: added trigger to run loading on mount for Loading example (#303)
* Auto Load example on mount * Disable button when loading in progress
1 parent 41f83f6 commit 8784182

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

examples/shared/src/screens/Loading.screen.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,22 @@ export const LoadingScreen = () => {
1515
}, 1500);
1616
};
1717

18+
// onMount set isLoading to true
19+
React.useEffect(() => {
20+
setIsLoading(true);
21+
setTimeout(() => {
22+
setIsLoading(false);
23+
}, 1500);
24+
}, []);
25+
1826
return (
1927
<View style={styles.container}>
2028
<Loading isLoading={isLoading} />
21-
<CTAPressable title="Trigger Loading" onPress={triggerLoading} />
29+
<CTAPressable
30+
title="Trigger Loading"
31+
onPress={triggerLoading}
32+
disabled={isLoading}
33+
/>
2234
</View>
2335
);
2436
};

0 commit comments

Comments
 (0)