Skip to content

Commit

Permalink
🐛 Fix possible crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed Aug 5, 2020
1 parent cd2c378 commit 7e6e155
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 28 deletions.
4 changes: 2 additions & 2 deletions app/components/content-list/content-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class ContentList extends React.Component<ContentListProps> {
private onItemSwipeOpen = (key: string, ref: React.RefObject<SwipeRow<{}>>) => {
Object.keys(this.listItemRefs).forEach((refKey: string) => {
if (refKey !== key) {
this.listItemRefs[refKey].current.closeRow()
this.listItemRefs[refKey]?.current?.closeRow()
}
})
this.listItemRefs[key] = ref
Expand All @@ -68,7 +68,7 @@ export class ContentList extends React.Component<ContentListProps> {

private onScrollBeginDrag = () => {
Object.keys(this.listItemRefs).forEach((refKey: string) => {
this.listItemRefs[refKey].current.closeRow()
this.listItemRefs[refKey]?.current?.closeRow()
})
}

Expand Down
21 changes: 12 additions & 9 deletions app/screens/statistics-screen/statistics-rewarded-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,20 @@ export class StatisticsRewardedDashbaord extends React.Component<Props> {
title = getPeriodText ? getPeriodText() : ""
}

const likeAmount = hasSelectedDayOfWeek
? days[selectedDayOfWeek].totalLikeAmount
: weeklyLikeAmount
const likeAmount =
(hasSelectedDayOfWeek
? days[selectedDayOfWeek]?.totalLikeAmount
: weeklyLikeAmount) || 0

const likeAmountFromCivicLikers = hasSelectedDayOfWeek
? days[selectedDayOfWeek].totalCivicLikeAmount
: weeklyLikeAmountFromCivicLikers
const likeAmountFromCivicLikers =
(hasSelectedDayOfWeek
? days[selectedDayOfWeek]?.totalCivicLikeAmount
: weeklyLikeAmountFromCivicLikers) || 0

const likeAmountFromCreatorFunds = hasSelectedDayOfWeek
? days[selectedDayOfWeek].totalBasicLikeAmount
: weeklyLikeAmountFromCreatorsFund
const likeAmountFromCreatorFunds =
(hasSelectedDayOfWeek
? days[selectedDayOfWeek]?.totalBasicLikeAmount
: weeklyLikeAmountFromCreatorsFund) || 0

const dataItems: StatisticsDataGridItemProps[] = [
{
Expand Down
22 changes: 13 additions & 9 deletions app/screens/statistics-screen/statistics-supported-dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,21 @@ export class StatisticsSupportedDashbaord extends React.Component<Props> {
} else {
title = getPeriodText ? getPeriodText() : ""
}
const likeAmount = hasSelectedDayOfWeek
? days[selectedDayOfWeek].totalLikeAmount
: weekLikeAmount

const worksCount = hasSelectedDayOfWeek
? days[selectedDayOfWeek].totalWorksCount
: weekWorksCount
const likeAmount =
(hasSelectedDayOfWeek
? days[selectedDayOfWeek]?.totalLikeAmount
: weekLikeAmount) || 0

const creatorsCount = hasSelectedDayOfWeek
? days[selectedDayOfWeek].totalCreatorsCount
: weekCreatorsCount
const worksCount =
(hasSelectedDayOfWeek
? days[selectedDayOfWeek]?.totalWorksCount
: weekWorksCount) || 0

const creatorsCount =
(hasSelectedDayOfWeek
? days[selectedDayOfWeek]?.totalCreatorsCount
: weekCreatorsCount) || 0

return (
<View
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"npm-run-all": "4.1.5",
"patch-package": "6.1.2",
"postinstall-prepare": "1.0.1",
"prettier": "1.18.2",
"prettier": "^1.19.1",
"react-devtools-core": "3.6.3",
"react-native-dotenv": "^0.2.0",
"react-native-svg-transformer": "^0.13.0",
Expand Down Expand Up @@ -146,19 +146,19 @@
]
},
"prettier": {
"printWidth": 100,
"printWidth": 80,
"semi": false,
"singleQuote": false,
"trailingComma": "all"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": [
"prettier",
"standard",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"plugin:react-native/all",
"standard"
"prettier"
],
"parserOptions": {
"ecmaFeatures": {
Expand Down Expand Up @@ -194,6 +194,7 @@
"comma-dangle": 0,
"no-unused-vars": 0,
"no-undef": 0,
"no-unused-expressions": 0,
"quotes": 0,
"react/no-unescaped-entities": 0,
"react-native/no-raw-text": 0,
Expand All @@ -205,6 +206,7 @@
"@typescript-eslint/no-explicit-any": 0,
"@typescript-eslint/no-object-literal-type-assertion": 0,
"@typescript-eslint/no-empty-interface": 0,
"@typescript-eslint/no-unused-expressions": 1,
"@typescript-eslint/no-var-requires": 0
}
}
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9204,10 +9204,10 @@ prepend-http@^1.0.1:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=

prettier@1.18.2:
version "1.18.2"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea"
integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==
prettier@^1.19.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==

pretty-format@^24.7.0, pretty-format@^24.9.0:
version "24.9.0"
Expand Down

0 comments on commit 7e6e155

Please sign in to comment.