Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Switch view of content depending on click React-Native

$
0
0

I am new in react native.

My question is pretty simple: On click on user the content of modal will change, if user is user.type === type.Renter I need to show first View, else If user.type === type.Consultant I need to show second view which is commented.Thank you all :)

interface IModalProps {    onPressClose: () => void;    user: IUser | null;    onPressNavigate: () => void;}export const UserInfoModal = (props: IModalProps) => {    const { onPressClose, user, onPressNavigate } = props;    const { width, height } = useWindowDimensions();    const landscape = width > height;    return (<Modal animationType='slide' visible={!!user} transparent={true}><View style={[styles.mainContainer, globalStyles.Shadow, { width: isTablet() ? '70%' : '80%' }]}><WZCircleButton onPress={onPressClose} style={styles.closeButton} iconUri={require('@assets/icons/close-button.png')} /><View><WZText style={styles.headerTitle}>{user?.displayName}</WZText><WZText style={styles.title}>{Strings.ChatScreen.SchoolStreet}</WZText><WZUserAvatar style={styles.userAvatar} size={150} user={user} /><WZText style={styles.subTitle}>{Strings.ChatScreen.ProfileText}</WZText><WZButton onPress={onPressNavigate} text='Start Chat' style={styles.buttonStartChat} /></View></View>            {/* <View style={[styles.mainContainer, globalStyles.Shadow, { width: isTablet() ? '70%' : '80%' }]}><WZText style={styles.headerTitleConsultant}>{Strings.ChatScreen.SearchByResidentByFirstName}</WZText><View><WZText>{Strings.ChatScreen.Email}</WZText><WZText>{Strings.ChatScreen.EmailInfo}</WZText><WZButton style={styles.buttonStartChat} text={Strings.ChatScreen.EmailButton}></WZButton></View><View><WZText>{Strings.ChatScreen.WalkInHours}</WZText><WZText>{Strings.ChatScreen.WalkInHoursInfo}</WZText></View></View> */}</Modal>    );};

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>