Conversation
[#157929923] not completed. For the moment the badge is visible in all the tabs. Logic for badge is not implemented
Affected stories
Generated by 🚫 dangerJS |
|
@matgentili @cloudify We are using native-base as UI library and it also has a Badge component. I don't think we need to add another UI library like react-native-elements. |
|
@fpersico ok, i remove react-native-elements library and use native-base. |
| const refreshControl = ( | ||
| <RefreshControl refreshing={refreshing} onRefresh={onRefresh} /> | ||
| ); | ||
|
|
There was a problem hiding this comment.
Sorry, i think i removed the line during implementing an other const that i removed later
| @@ -1,12 +1,6 @@ | |||
| /** | |||
There was a problem hiding this comment.
why you removed the comment?
There was a problem hiding this comment.
Sorry, I didn't even notice it. Most likely I removed it while importing a library
[#157929923] not completed. Badge graphic is ok on Android, I must check it on iOS. The logic for the badge counter has not implemented yet.
Codecov Report
@@ Coverage Diff @@
## master #979 +/- ##
==========================================
- Coverage 46.5% 46.29% -0.21%
==========================================
Files 201 199 -2
Lines 4455 4378 -77
Branches 873 818 -55
==========================================
- Hits 2072 2027 -45
+ Misses 2376 2346 -30
+ Partials 7 5 -2 |
Codecov Report
@@ Coverage Diff @@
## master #979 +/- ##
=========================================
Coverage ? 45.21%
=========================================
Files ? 210
Lines ? 4837
Branches ? 948
=========================================
Hits ? 2187
Misses ? 2643
Partials ? 7 |
[#157929923] not completed. Badge graphic is ok on Android, I must check it on iOS. The logic for the badge counter has not implemented yet.
package.json
Outdated
| "@types/react": "16.8.10", | ||
| "@types/react-native": "0.57.42", | ||
| "@types/react-native-background-timer": "^2.0.0", | ||
| "@types/react-native-elements": "^0.18.0", |
There was a problem hiding this comment.
this need to be removed too
| import { MessageListItemComponent } from "./MessageListItemComponent"; | ||
|
|
||
| // tslint:disable-next-line: no-var-keyword | ||
| var messagesToRead = 0; |
There was a problem hiding this comment.
don't use vars, the tslint rule is there for a reason :)
There was a problem hiding this comment.
Ok, can i use let?
| ); | ||
|
|
||
| messagesToRead = messages.filter(obj => !obj.isRead).length; | ||
| alert(messagesToRead); |
There was a problem hiding this comment.
It was only for tests and I forgot to remove it
| @@ -1071,6 +1071,13 @@ | |||
| version "2.0.0" | |||
There was a problem hiding this comment.
since you didn't add any package, yarn.lock must not change
There was a problem hiding this comment.
@fpersico Can i remove yarn.lock ? I don't add any package
[#157929923] add-badge-messages. Modified badge layout and added method for reading the number of messages. Tested on ios and android
ts/navigation/MainNavigator.tsx
Outdated
| tabBarIcon: (options: { tintColor: string | null; focused: boolean }) => { | ||
| const { routeName } = nav.state; | ||
| const iconName: string = getIcon(routeName); | ||
| const messagesToRead = MessageListComponent.prototype.getMessagesToRead(); |
There was a problem hiding this comment.
can you explain how this works?
There was a problem hiding this comment.
I take from the component that manages the list of messages the number of unread messages and save them in a constant which is then used to update the view. Do you think that could be fine?
There was a problem hiding this comment.
I don't think it could possibly work, did you tested it?
There was a problem hiding this comment.
Yes, I have tested it on ios simulator and on android device and when I open a message the badge number is updated correctly.
|
@matgentili you should create a custom component that subscribes to the redux store to get the list of messages |
|
@matgentili any update here? |
|
@cloudify I used Redux store as you suggested, now i'm testing it and soon I commit all ;) |
[#157929923]-add-badge-message-tab. Added store redux for badge
Completed badge implementation. It works correctly on ios and android.
fix - Now the badge number is retrieved using BadgeSelector instead of passing it during navigation
…m/teamdigitale/io-app into #157929923]-add-badge-message-tab
Fix implementation badge messages. Now I don't use reducer but i get the number for badge by list of messages
Added control if badge number is greater than 99
ts/components/MessagesTabIcon.tsx
Outdated
| {messagesUnread > 0 ? ( | ||
| Platform.OS === "ios" ? ( | ||
| <Badge style={styles.badgeStyle}> | ||
| <Text style={[styles.textBadgeStyle, { top: 0 }]}> |
ts/components/MessagesTabIcon.tsx
Outdated
| /** | ||
| * Filters the list of messages and returns the number of unread messages. | ||
| */ | ||
| const getNumberMessagesUnread = ( |
There was a problem hiding this comment.
Convert this to a redux selector
ts/components/MessagesTabIcon.tsx
Outdated
|
|
||
| const mapStateToProps = (state: GlobalState) => ({ | ||
| messagesUnread: | ||
| getNumberMessagesUnread(lexicallyOrderedMessagesStateSelector(state)) < 99 |
There was a problem hiding this comment.
You are calling the function twice!
| @@ -1,12 +1,6 @@ | |||
| /** | |||
ts/navigation/MainNavigator.tsx
Outdated
| // Android shadow | ||
| elevation: variables.footerElevation | ||
| }, | ||
| textBadgeStyle: { |
|
@matgentili Please clean this PR because it contains unused stuff. |
Created selector for unread messages and improved the code
| @@ -1071,6 +1071,13 @@ | |||
| version "2.0.0" | |||
Revert yarn.lock
Fix for prettier after merge
…m/teamdigitale/io-app into #157929923]-add-badge-message-tab
Now the badge's text is centered. I moved one pixel. To be added to [#157929923] add-badge-messages #979
Now the badge's text is centered. I moved one pixel. To be added to [#157929923] add-badge-messages #979

[#157929923] not completed. For the moment the badge is visible in all the tabs. Logic for badge is not implemented