Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3389163
D7558.id25511.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7558.id25511.diff
View Options
diff --git a/native/navigation/invite-link-modal.react.js b/native/navigation/invite-link-modal.react.js
--- a/native/navigation/invite-link-modal.react.js
+++ b/native/navigation/invite-link-modal.react.js
@@ -2,12 +2,13 @@
import invariant from 'invariant';
import * as React from 'react';
-import { View, Text } from 'react-native';
+import { View, Text, ActivityIndicator } from 'react-native';
import {
joinThread,
joinThreadActionTypes,
} from 'lib/actions/thread-actions.js';
+import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js';
import type { InviteLinkVerificationResponse } from 'lib/types/link-types.js';
import {
useDispatchActionPromise,
@@ -99,16 +100,28 @@
const joinCommunity = React.useCallback(() => {
dispatchActionPromise(joinThreadActionTypes, createJoinCommunityAction());
}, [createJoinCommunityAction, dispatchActionPromise]);
+ const joinThreadLoadingStatus = useSelector(joinThreadLoadingStatusSelector);
const buttons = React.useMemo(() => {
if (invitationDetails.status === 'valid') {
+ const joinButtonContent =
+ joinThreadLoadingStatus === 'loading' ? (
+ <ActivityIndicator
+ size="small"
+ color="white"
+ style={styles.activityIndicatorStyle}
+ />
+ ) : (
+ <Text style={styles.buttonText}>Accept Invite</Text>
+ );
return (
<>
<Button
style={[styles.button, styles.buttonPrimary, styles.gap]}
onPress={joinCommunity}
+ disabled={joinThreadLoadingStatus === 'loading'}
>
- <Text style={styles.buttonText}>Accept Invite</Text>
+ {joinButtonContent}
</Button>
<Button
style={[styles.button, styles.buttonSecondary]}
@@ -130,7 +143,9 @@
}, [
invitationDetails.status,
joinCommunity,
+ joinThreadLoadingStatus,
props.navigation.goBack,
+ styles.activityIndicatorStyle,
styles.button,
styles.buttonPrimary,
styles.buttonSecondary,
@@ -147,6 +162,10 @@
);
}
+const joinThreadLoadingStatusSelector = createLoadingStatusSelector(
+ joinThreadActionTypes,
+);
+
const unboundStyles = {
modal: {
backgroundColor: 'modalForeground',
@@ -211,6 +230,9 @@
fontWeight: '500',
lineHeight: 24,
},
+ activityIndicatorStyle: {
+ paddingVertical: 2,
+ },
};
export default InviteLinkModal;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 30, 5:49 PM (19 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2601834
Default Alt Text
D7558.id25511.diff (2 KB)
Attached To
Mode
D7558: [native] Handle loading state when joining a community
Attached
Detach File
Event Timeline
Log In to Comment