diff options
| author | Shravya Ramesh <shravs1208@gmail.com> | 2021-05-14 16:42:56 -0700 |
|---|---|---|
| committer | Shravya Ramesh <shravs1208@gmail.com> | 2021-05-14 16:42:56 -0700 |
| commit | e5e6328a1189ebb3f78e6eee4213e0b0519f716a (patch) | |
| tree | 10062d8e91a5bade91811ab25e1d3967c51aa42e /src/screens/profile/InviteFriendsScreen.tsx | |
| parent | 25b32b82d056ab4e70c937282b73fb7d4c900552 (diff) | |
moved user from contacts code to legacy
Diffstat (limited to 'src/screens/profile/InviteFriendsScreen.tsx')
| -rw-r--r-- | src/screens/profile/InviteFriendsScreen.tsx | 90 |
1 files changed, 3 insertions, 87 deletions
diff --git a/src/screens/profile/InviteFriendsScreen.tsx b/src/screens/profile/InviteFriendsScreen.tsx index 87b00aaf..b3653d39 100644 --- a/src/screens/profile/InviteFriendsScreen.tsx +++ b/src/screens/profile/InviteFriendsScreen.tsx @@ -10,23 +10,19 @@ import { StyleSheet, Text, TextInput, - TouchableOpacity, TouchableWithoutFeedback, View, } from 'react-native'; import {checkPermission} from 'react-native-contacts'; import Animated from 'react-native-reanimated'; import Icon from 'react-native-vector-icons/Feather'; -import {useDispatch, useStore} from 'react-redux'; -import {ProfilePreview, TabsGradient} from '../../components'; +import {TabsGradient} from '../../components'; import {InviteFriendTile} from '../../components/friends'; -import {TAGG_LIGHT_BLUE} from '../../constants'; import {MainStackParams} from '../../routes'; import {usersFromContactsService} from '../../services/UserFriendsService'; import {ProfilePreviewType} from '../../types'; import { extractContacts, - handleAddFriend, HeaderHeight, isIPhoneX, normalize, @@ -57,15 +53,12 @@ interface InviteFriendsScreenProps { route: InviteFriendsScreenRouteProp; } -const InviteFriendsScreen: React.FC<InviteFriendsScreenProps> = ({route}) => { - const {screenType} = route.params; - const dispatch = useDispatch(); - const state = useStore().getState(); +const InviteFriendsScreen: React.FC<InviteFriendsScreenProps> = ({}) => { const [usersFromContacts, setUsersFromContacts] = useState< ProfilePreviewType[] >([]); const [nonUsersFromContacts, setNonUsersFromContacts] = useState<[]>([]); - const [pendingUsers, setPendingUsers] = useState<[]>([]); + const [pendingUsers] = useState<[]>([]); const [results, setResults] = useState<SearchResultType>({ usersFromContacts: usersFromContacts, nonUsersFromContacts: nonUsersFromContacts, @@ -131,48 +124,6 @@ const InviteFriendsScreen: React.FC<InviteFriendsScreenProps> = ({route}) => { search(); }, [query]); - const UsersFromContacts = () => ( - <> - <FlatList - showsVerticalScrollIndicator={false} - scrollEnabled={false} - data={results.usersFromContacts} - keyExtractor={(item) => item.username} - renderItem={({item}) => ( - <View key={item.id} style={styles.ppContainer}> - <View style={styles.friend}> - <ProfilePreview - {...{profilePreview: item}} - previewType={'Friend'} - screenType={screenType} - /> - </View> - <TouchableOpacity - style={styles.addFriendButton} - onPress={() => { - handleAddFriend(screenType, item, dispatch, state).then( - (success) => { - if (success) { - let users = usersFromContacts; - const filteredUsers = users.filter( - (user) => user.username !== item.username, - ); - setResults({ - ...results, - usersFromContacts: filteredUsers, - }); - } - }, - ); - }}> - <Text style={styles.addFriendButtonTitle}>Add Friend</Text> - </TouchableOpacity> - </View> - )} - /> - </> - ); - const PendingList = useMemo( () => ( <FlatList @@ -315,16 +266,6 @@ const styles = StyleSheet.create({ marginBottom: '3%', marginHorizontal: 10, }, - ppContainer: { - alignSelf: 'center', - flexDirection: 'row', - justifyContent: 'space-between', - width: '100%', - height: normalize(42), - alignItems: 'center', - marginBottom: '5%', - marginHorizontal: 10, - }, inputContainer: { flexGrow: 1, flexDirection: 'row', @@ -354,31 +295,6 @@ const styles = StyleSheet.create({ color: '#818181', fontWeight: '500', }, - friend: { - alignSelf: 'center', - height: '100%', - }, - addFriendButton: { - alignSelf: 'center', - justifyContent: 'center', - alignItems: 'center', - width: 82, - height: 25, - borderColor: TAGG_LIGHT_BLUE, - borderWidth: 2, - borderRadius: 2, - padding: 0, - backgroundColor: TAGG_LIGHT_BLUE, - }, - addFriendButtonTitle: { - color: 'white', - padding: 0, - fontSize: normalize(11), - fontWeight: '700', - lineHeight: normalize(13.13), - letterSpacing: normalize(0.6), - paddingHorizontal: '3.8%', - }, }); export default InviteFriendsScreen; |
