-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#157929923] add-badge-messages #979
Merged
Merged
Changes from 14 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4fa82d7
[#157929923] add-badge-messages
matgentili 2c986b9
[#157929923]-add-badge-messages
matgentili 1f775c1
[#157929923]-add-badge-messages
matgentili 4f7653e
[#157929923] add-badge-messages
matgentili cc4db3a
[#157929923]-add-badge-message-tab
matgentili 740cf3d
[#157929923]-add-badge-message-tab
matgentili 3c3eee9
Merge branch 'master' into #157929923]-add-badge-message-tab
matgentili c6076fa
[#157929923]-add-badge-message-tab
matgentili d6c5379
Merge branch '#157929923]-add-badge-message-tab' of https://github.co…
matgentili c1c8ff7
[#157929923] add badge message tab
matgentili 1e29f4f
[#157929923] add badge message tab
matgentili b5163eb
Merge branch 'master' into #157929923]-add-badge-message-tab
matgentili 1715e8d
[#157929923] Add badge messages
matgentili 99c794d
Merge branch 'master' into #157929923]-add-badge-message-tab
matgentili 571cefb
[#157929923] Add badge messages tab
matgentili 0e75fd4
Merge branch 'master' into #157929923]-add-badge-message-tab
matgentili 31e64be
[#157929923] Add badge messages tab
matgentili cb0706a
Merge branch '#157929923]-add-badge-message-tab' of https://github.co…
matgentili c6c1a47
Merge branch 'master' into #157929923]-add-badge-message-tab
matgentili 15f204f
Merge branch 'master' into #157929923]-add-badge-message-tab
francescopersico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { Badge, View } from "native-base"; | ||
import React from "react"; | ||
import { Platform, StyleSheet, Text } from "react-native"; | ||
import { connect } from "react-redux"; | ||
import { messagesUnreadSelector } from "../store/reducers/entities/messages"; | ||
import { GlobalState } from "../store/reducers/types"; | ||
import variables from "../theme/variables"; | ||
import IconFont from "./ui/IconFont"; | ||
|
||
type OwnProps = { | ||
color?: string; | ||
}; | ||
const MAX_BADGE_VALUE = 99; | ||
const styles = StyleSheet.create({ | ||
textBadgeStyle: { | ||
fontSize: 10, | ||
fontFamily: "Titillium Web", | ||
fontWeight: "bold", | ||
color: "white", | ||
flex: 1, | ||
position: "absolute", | ||
height: 19, | ||
width: 19, | ||
textAlign: "center", | ||
paddingRight: 3, | ||
top: Platform.OS === "ios" ? 0 : undefined | ||
}, | ||
badgeStyle: { | ||
backgroundColor: variables.brandPrimary, | ||
borderColor: "white", | ||
borderWidth: 2, | ||
position: "absolute", | ||
elevation: 0.1, | ||
shadowColor: "white", | ||
height: 19, | ||
width: 19, | ||
left: 12, | ||
bottom: 10 | ||
} | ||
}); | ||
|
||
type Props = OwnProps & ReturnType<typeof mapStateToProps>; | ||
|
||
/** | ||
* Message icon add badge. | ||
*/ | ||
class MessagesTabIcon extends React.PureComponent<Props> { | ||
public render() { | ||
const { color, badgeValue } = this.props; | ||
return ( | ||
<View> | ||
<IconFont | ||
name={"io-messaggi"} | ||
size={variables.iconSize3} | ||
color={color} | ||
/> | ||
{badgeValue > 0 ? ( | ||
<Badge style={styles.badgeStyle}> | ||
<Text style={[styles.textBadgeStyle]}>{badgeValue}</Text> | ||
</Badge> | ||
) : null} | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
function mapStateToProps(state: GlobalState) { | ||
const messagesUnread = messagesUnreadSelector(state); | ||
return { | ||
badgeValue: | ||
messagesUnread < MAX_BADGE_VALUE ? messagesUnread : MAX_BADGE_VALUE | ||
}; | ||
} | ||
|
||
export default connect(mapStateToProps)(MessagesTabIcon); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1071,6 +1071,13 @@ | |
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/@types/react-native-background-timer/-/react-native-background-timer-2.0.0.tgz#c44c57f8fbca9d9d5521fdd72a8f55232b79381e" | ||
|
||
"@types/react-native-elements@^0.18.0": | ||
version "0.18.0" | ||
resolved "https://registry.yarnpkg.com/@types/react-native-elements/-/react-native-elements-0.18.0.tgz#81cf92d75a5d9ed73599761da37bd2b05b107a91" | ||
integrity sha512-Tt0aq6HlN31Wexica9MwTwxnt46fLyx6yzMFJWPx2hqACrvBZfFTlwCoWMRa6ArR/kX3XJbAe6vKEBuZ08Zvtw== | ||
dependencies: | ||
react-native-elements "*" | ||
|
||
"@types/react-native-i18n@^2.0.0": | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/@types/react-native-i18n/-/react-native-i18n-2.0.0.tgz#2df92b3392d813b39530bd126aad429eedc9c3de" | ||
|
@@ -2634,6 +2641,14 @@ color@^3.0.0: | |
color-convert "^1.9.1" | ||
color-string "^1.5.2" | ||
|
||
color@^3.1.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/color/-/color-3.1.0.tgz#d8e9fb096732875774c84bf922815df0308d0ffc" | ||
integrity sha512-CwyopLkuRYO5ei2EpzpIh6LqJMt6Mt+jZhO5VI5f/wJLZriXQE32/SSqzmrh+QB+AZT81Cj8yv+7zwToW8ahZg== | ||
dependencies: | ||
color-convert "^1.9.1" | ||
color-string "^1.5.2" | ||
|
||
color@~1.0.3: | ||
version "1.0.3" | ||
resolved "https://registry.yarnpkg.com/color/-/color-1.0.3.tgz#e48e832d85f14ef694fb468811c2d5cfe729b55d" | ||
|
@@ -2997,6 +3012,11 @@ deep-is@~0.1.3: | |
version "0.1.3" | ||
resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" | ||
|
||
deepmerge@^3.1.0: | ||
version "3.2.0" | ||
resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.2.0.tgz#58ef463a57c08d376547f8869fdc5bcee957f44e" | ||
integrity sha512-6+LuZGU7QCNUnAJyX8cIrlzoEgggTM6B7mm+znKOX4t5ltluT9KLjN6g61ECMS0LTsLW7yDpNoxhix5FZcrIow== | ||
|
||
default-require-extensions@^2.0.0: | ||
version "2.0.0" | ||
resolved "https://registry.yarnpkg.com/default-require-extensions/-/default-require-extensions-2.0.0.tgz#f5f8fbb18a7d6d50b21f641f649ebb522cfe24f7" | ||
|
@@ -4200,6 +4220,13 @@ hoist-non-react-statics@^3.0.1: | |
dependencies: | ||
react-is "^16.3.2" | ||
|
||
hoist-non-react-statics@^3.1.0: | ||
version "3.3.0" | ||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b" | ||
integrity sha512-0XsbTXxgiaCDYDIWFcwkmerZPSwywfUqYmwT4jzewKTQSWoE6FCMoUVOeBJWK3E/CrWbxRG3m5GzY4lnIwGRBA== | ||
dependencies: | ||
react-is "^16.7.0" | ||
|
||
hoist-non-react-statics@^3.2.1: | ||
version "3.2.1" | ||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.2.1.tgz#c09c0555c84b38a7ede6912b61efddafd6e75e1e" | ||
|
@@ -6692,6 +6719,11 @@ ono@^4.0.3, ono@^4.0.5: | |
dependencies: | ||
format-util "^1.0.3" | ||
|
||
opencollective-postinstall@^2.0.0: | ||
version "2.0.2" | ||
resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" | ||
integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw== | ||
|
||
opn@^3.0.2: | ||
version "3.0.3" | ||
resolved "https://registry.yarnpkg.com/opn/-/opn-3.0.3.tgz#b6d99e7399f78d65c3baaffef1fb288e9b85243a" | ||
|
@@ -7286,7 +7318,7 @@ react-is@^16.6.3: | |
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.7.0.tgz#c1bd21c64f1f1364c6f70695ec02d69392f41bfa" | ||
integrity sha512-Z0VRQdF4NPDoI0tsXVMLkJLiwEBa+RP66g0xDHxgxysxSoCUccSten4RTF/UFvZF1dZvZ9Zu1sx+MDXwcOR34g== | ||
|
||
react-is@^16.8.3, react-is@^16.8.4: | ||
react-is@^16.7.0, react-is@^16.8.3, react-is@^16.8.4: | ||
version "16.8.6" | ||
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" | ||
integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== | ||
|
@@ -7343,6 +7375,19 @@ [email protected]: | |
dependencies: | ||
lodash "4.17.11" | ||
|
||
react-native-elements@*: | ||
version "1.1.0" | ||
resolved "https://registry.yarnpkg.com/react-native-elements/-/react-native-elements-1.1.0.tgz#f99bcda4459a886f3ab4591c684c099d37aedf2b" | ||
integrity sha512-n1eOL0kUdlH01zX7bn1p7qhYXn7kquqxYQ0oWlxoAck9t5Db/KeK5ViOsAk8seYSvAG6Pe7OxgzRFnMfFhng0Q== | ||
dependencies: | ||
color "^3.1.0" | ||
deepmerge "^3.1.0" | ||
hoist-non-react-statics "^3.1.0" | ||
opencollective-postinstall "^2.0.0" | ||
prop-types "^15.5.8" | ||
react-native-ratings "^6.3.0" | ||
react-native-status-bar-height "^2.2.0" | ||
|
||
[email protected]: | ||
version "2.10.0" | ||
resolved "https://registry.yarnpkg.com/react-native-exception-handler/-/react-native-exception-handler-2.10.0.tgz#0d828a4f2c7c4469a2929fa46d20535def726903" | ||
|
@@ -7433,6 +7478,14 @@ react-native-qrcode-scanner@^1.1.0: | |
prop-types "^15.5.10" | ||
react-native-permissions "^1.1.1" | ||
|
||
react-native-ratings@^6.3.0: | ||
version "6.3.1" | ||
resolved "https://registry.yarnpkg.com/react-native-ratings/-/react-native-ratings-6.3.1.tgz#4e4bd87f376423dc62c933f570fc1932c78adaa4" | ||
integrity sha512-+WEtk4wPvnoN5YbfWcmyM4LpKOlvkrFlpQe0KrqeWBAOkN6OXOZYBtiCh97dCIb8Ovpm7goOEcTf3T1MGCi2LA== | ||
dependencies: | ||
lodash "^4.17.4" | ||
prop-types "^15.5.10" | ||
|
||
react-native-safe-area-view@^0.12.0: | ||
version "0.12.0" | ||
resolved "https://registry.yarnpkg.com/react-native-safe-area-view/-/react-native-safe-area-view-0.12.0.tgz#5c312f087300ecf82e8541c3eac25d560e147f22" | ||
|
@@ -7455,6 +7508,11 @@ react-native-splash-screen@^3.2.0: | |
resolved "https://registry.yarnpkg.com/react-native-splash-screen/-/react-native-splash-screen-3.2.0.tgz#d47ec8557b1ba988ee3ea98d01463081b60fff45" | ||
integrity sha512-Ls9qiNZzW/OLFoI25wfjjAcrf2DZ975hn2vr6U9gyuxi2nooVbzQeFoQS5vQcbCt9QX5NY8ASEEAtlLdIa6KVg== | ||
|
||
react-native-status-bar-height@^2.2.0: | ||
version "2.3.1" | ||
resolved "https://registry.yarnpkg.com/react-native-status-bar-height/-/react-native-status-bar-height-2.3.1.tgz#b92ce9112c2367290847ac11284d9d84a6330169" | ||
integrity sha512-m9nGKYfFn6ljF1abafzF5cFaD9JCzXwj7kNE9CuF+g0TgtItH70eY2uHaCV9moENTftqd5XIS3Cx0mf4WfistA== | ||
|
||
react-native-svg@^6.5.3: | ||
version "6.5.3" | ||
resolved "https://registry.yarnpkg.com/react-native-svg/-/react-native-svg-6.5.3.tgz#44004c4cdc4a289acb613d718eda6f80e0c5a026" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you didn't add any package,
yarn.lock
must not changeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@matgentili please check this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fpersico Can i remove yarn.lock ? I don't add any package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just revert the changes.