aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorankit-thanekar007 <ankit.thanekar007@gmail.com>2021-03-15 11:32:21 -0700
committerankit-thanekar007 <ankit.thanekar007@gmail.com>2021-03-15 11:33:28 -0700
commitab3455b8836d4d37752946d743c4e2a13b9a47a8 (patch)
tree13c22d7d62169f5d564c4a3103216084aa390706 /src
parentc55cf9fec6b252b9ef953122950a79b7bf8abe94 (diff)
TMA 643 Footer added
Diffstat (limited to 'src')
-rw-r--r--src/screens/main/NotificationsScreen.tsx50
1 files changed, 47 insertions, 3 deletions
diff --git a/src/screens/main/NotificationsScreen.tsx b/src/screens/main/NotificationsScreen.tsx
index c92abdbd..568c8c73 100644
--- a/src/screens/main/NotificationsScreen.tsx
+++ b/src/screens/main/NotificationsScreen.tsx
@@ -53,6 +53,10 @@ const NotificationsScreen: React.FC = () => {
data: NotificationType[];
}[]
>([]);
+
+ const [moreFooterEnabled, setMoreFooterEnabled] = useState(false);
+ const [requestLimit, setrequestLimit] = useState(4);
+
const dispatch = useDispatch();
const refreshNotifications = () => {
@@ -143,6 +147,7 @@ const NotificationsScreen: React.FC = () => {
}
}
}
+
setSectionedNotifications(
todays.length === 0 &&
yesterdays.length === 0 &&
@@ -169,10 +174,38 @@ const NotificationsScreen: React.FC = () => {
const renderSectionHeader = ({section: {title, data}}) =>
data.length !== 0 && (
<View style={styles.sectionHeaderContainer}>
- <Text style={styles.sectionHeader}>{title}</Text>
+ <Text
+ style={[
+ styles.sectionFont,
+ styles.sectionHeader,
+ styles.sectionLocation,
+ styles.sectionHeader,
+ ]}>
+ {title}
+ </Text>
</View>
);
+ const renderSectionFooter = ({section: {title, data}}) => {
+ if (title === 'Friend Request' && data.length < requestLimit) {
+ return (
+ <View style={styles.sectionHeaderContainer}>
+ <Text
+ style={[
+ styles.sectionFont,
+ styles.sectionFooter,
+ styles.sectionLocation,
+ styles.sectionHeader,
+ ]}>
+ {title}
+ </Text>
+ </View>
+ );
+ }
+
+ return null;
+ };
+
const SPPromptNotification: ReactElement = showSPNotifyPopUp ? (
<TaggPrompt
messageHeader={'New Suggested People Page!'}
@@ -207,9 +240,10 @@ const NotificationsScreen: React.FC = () => {
<SectionList
contentContainerStyle={styles.container}
sections={sectionedNotifications}
- keyExtractor={(item, index) => index.toString()}
+ keyExtractor={(_item, index) => index.toString()}
renderItem={renderNotification}
renderSectionHeader={renderSectionHeader}
+ renderSectionFooter={renderSectionFooter}
ListHeaderComponent={SPPromptNotification}
refreshControl={
<RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
@@ -251,15 +285,25 @@ const styles = StyleSheet.create({
width: '100%',
backgroundColor: 'white',
},
- sectionHeader: {
+
+ sectionLocation: {
marginLeft: '8%',
marginTop: '5%',
marginBottom: '2%',
+ },
+
+ sectionFont: {
fontWeight: '600',
fontSize: normalize(12),
lineHeight: normalize(14),
+ },
+
+ sectionHeader: {
color: '#828282',
},
+ sectionFooter: {
+ color: '#698DD3',
+ },
emptyViewContainer: {
flex: 1,
justifyContent: 'center',