Skip to content

Commit

Permalink
fix: toNumber calls from i18n (#464)
Browse files Browse the repository at this point in the history
Co-authored-by: Samer Buna <samerbuna@users.noreply.github.com>
  • Loading branch information
samerbuna and samerbuna authored May 26, 2022
1 parent cb7049b commit d891bcd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions app/screens/earns-screen/earns-quiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { SafeAreaView } from "react-native-safe-area-context"
import Icon from "react-native-vector-icons/Ionicons"
import { CloseCross } from "../../components/close-cross"
import { Screen } from "../../components/screen"
import { toLocaleNumber, translateUnknown as translate } from "@galoymoney/client"
import { translateUnknown as translate } from "@galoymoney/client"
import { palette } from "../../theme/palette"
import { shuffle } from "../../utils/helper"
import { sleep } from "../../utils/sleep"
Expand All @@ -19,6 +19,7 @@ import type { ScreenType } from "../../types/jsx"
import { StackNavigationProp } from "@react-navigation/stack"
import type { RootStackParamList } from "../../navigation/stack-param-lists"
import { RouteProp } from "@react-navigation/native"
import I18n from "i18n-js"

const styles = EStyleSheet.create({
answersView: {
Expand Down Expand Up @@ -308,7 +309,7 @@ export const EarnQuiz: ScreenType = ({ route, navigation }: Props) => {
<Button
title={translate("EarnScreen.earnSats", {
count: amount,
formatted_number: toLocaleNumber(amount, { precision: 0 }),
formatted_number: I18n.toNumber(amount, { precision: 0 }),
})}
buttonStyle={styles.buttonStyle}
titleStyle={styles.titleStyle}
Expand Down
5 changes: 3 additions & 2 deletions app/screens/earns-screen/earns-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TouchableOpacity } from "react-native-gesture-handler"
import Carousel, { Pagination } from "react-native-snap-carousel"
import Icon from "react-native-vector-icons/Ionicons"
import { Screen } from "../../components/screen"
import { toLocaleNumber, translateUnknown as translate } from "@galoymoney/client"
import { translateUnknown as translate } from "@galoymoney/client"
import type { RootStackParamList } from "../../navigation/stack-param-lists"
import { color } from "../../theme"
import { palette } from "../../theme/palette"
Expand All @@ -21,6 +21,7 @@ import { SVGs } from "./earn-svg-factory"
import { getCardsFromSection, remainingSatsOnSection } from "./earns-utils"
import { getQuizQuestions } from "../../graphql/query"
import useMainQuery from "@app/hooks/use-main-query"
import I18n from "i18n-js"

const { width: screenWidth } = Dimensions.get("window")

Expand Down Expand Up @@ -254,7 +255,7 @@ export const EarnSection: ScreenType = ({ route, navigation }: Props) => {
item.fullfilled ? "EarnScreen.satsEarned" : "EarnScreen.earnSats",
{
count: item.value,
formatted_number: toLocaleNumber(item.value, { precision: 0 }),
formatted_number: I18n.toNumber(item.value, { precision: 0 }),
},
)}
icon={
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"bolt11": "nicolasburtey/bolt11",
"currency.js": "^2.0.2",
"graphql": "^16.3.0",
"i18n-js": "^3.9.2",
"intl": "^1.2.5",
"js-lnurl": "^0.3.0",
"jwt-decode": "^3.1.2",
Expand Down Expand Up @@ -151,8 +152,8 @@
"typescript": "^4.6.3"
},
"resolutions": {
"google-libphonenumber": "3.2.27"
},
"google-libphonenumber": "3.2.27"
},
"peerDependencies": {
"solidarity": "^2.3.1"
}
Expand Down

0 comments on commit d891bcd

Please sign in to comment.