Skip to content

Commit

Permalink
fix(deps): update dependency react-native-localize to v3 (#5310)
Browse files Browse the repository at this point in the history
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-localize](https://togithub.com/zoontek/react-native-localize)
| [`^2.2.6` ->
`^3.1.0`](https://renovatebot.com/diffs/npm/react-native-localize/2.2.6/3.1.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-localize/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-localize/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-localize/2.2.6/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-localize/2.2.6/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>zoontek/react-native-localize (react-native-localize)</summary>

###
[`v3.1.0`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.1.0)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.6...3.1.0)

- Add visionOS support by
[@&#8203;Saadnajmi](https://togithub.com/Saadnajmi) in
[https://github.com/zoontek/react-native-localize/pull/253](https://togithub.com/zoontek/react-native-localize/pull/253)

###
[`v3.0.6`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.6)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.5...3.0.6)

-   Update mock and testing instructions

###
[`v3.0.5`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.5)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.4...3.0.5)

-   Add Android Gradle plugin 8 compatibility
-   Fix `AndroidManifest.xml` namespace deprecation warning

###
[`v3.0.4`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.4)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.3...3.0.4)

- Remove duplicate `RNLocalizeSpec.h` import when new architecture is
enabled (fix
[#&#8203;238](https://togithub.com/zoontek/react-native-localize/issues/238))

###
[`v3.0.3`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.3)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.2...3.0.3)

- Use
[`LocaleListCompat.getDefault()`](https://developer.android.com/reference/androidx/core/os/LocaleListCompat#getDefault\(\))
to fix preferred languages list order in some rare cases (fix
[#&#8203;236](https://togithub.com/zoontek/react-native-localize/issues/236))

###
[`v3.0.2`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.2)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.1...3.0.2)

- Use gradle `namespace` conditionally in order to improve old react
native version compatibility.
*⚠️ Note that this library officially now follows the React Native
[releases support
policy](https://togithub.com/reactwg/react-native-releases#releases-support-policy).
If you have been impacted by this bug, that means you are using an
unsupported react native version and should upgrade to the latest.*

###
[`v3.0.1`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.1)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/3.0.0...3.0.1)

-   Add gradle `namespace` for react native 0.73 compatibility

###
[`v3.0.0`](https://togithub.com/zoontek/react-native-localize/releases/tag/3.0.0)

[Compare
Source](https://togithub.com/zoontek/react-native-localize/compare/2.2.6...3.0.0)

#### 3.0.0: New architecture support 🎉

This release come with a huge change underneath: Instead of constants,
the library now perform synchronous methods calls (on both old and new
architecture), which means the returned informations will always be
up-to-date (fixes
[https://github.com/zoontek/react-native-localize/issues/186](https://togithub.com/zoontek/react-native-localize/issues/186)).

This also means that remote debugging (e.g. with Chrome) is no longer
possible and that you should switch to [Flipper
🐬](https://fbflipper.com) (an acceptable trade-off as remote debugging
isn't possible with the new architecture anyway)

##### Other changes:

-   Drop support for:
    -   `react-native-windows` (temporarily)
    -   `react-native`, `react-native-macos` < 0.70
    -   `react-native-web` < 0.18
    -   Android < 5
    -   iOS and tvOS < 12.4
- Remove `addEventListener` as you can now safely rely on [`AppState`
](https://reactnative.dev/docs/appstate)and get the possible new value
when app become `active` (fixes
[https://github.com/zoontek/react-native-localize/issues/91](https://togithub.com/zoontek/react-native-localize/issues/91))
- `getCalendar` can now return all supported macOS calendars
(`buddhist`, `coptic`, `ethiopic`, `hebrew`…)
-   `findBestAvailableLanguage` has been renamed `findBestLanguageTag`
- Package default export has been removed. If you really want to import
everything, use `import * as Localize from "react-native-localize"`
instead

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMTMuMSIsInVwZGF0ZWRJblZlciI6IjM3LjMxMy4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJucG0iLCJyZW5vdmF0ZSJdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
  • Loading branch information
3 people authored Apr 30, 2024
1 parent 950fa63 commit c598cf0
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 35 deletions.
30 changes: 11 additions & 19 deletions __mocks__/react-native-localize.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import { NativeModules } from 'react-native'

NativeModules.RNLocalize = {
initialConstants: {
locales: [
{
languageCode: 'en',
countryCode: 'US',
languageTag: 'en-US',
isRTL: false,
},
],
currencies: ['MXN', 'USD'],
country: 'US',
},
}

module.exports = {
...jest.requireActual('react-native-localize'),
getNumberFormatSettings: jest.fn(() => ({
decimalSeparator: '.',
groupingSeparator: ',',
})),
getTimeZone: jest.fn(() => 'America/New_York'),
findBestAvailableLanguage: jest.fn(() => ({ languageTag: 'en-US', isRTL: true })),
findBestLanguageTag: jest.fn(() => ({ languageTag: 'en-US', isRTL: true })),
getCountry: jest.fn(() => 'US'),
getCurrencies: jest.fn(() => ['MXN', 'USD']),
getLocales: jest.fn(() => [
{
languageCode: 'en',
countryCode: 'US',
languageTag: 'en-US',
isRTL: false,
},
]),
}
4 changes: 2 additions & 2 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ PODS:
- TOCropViewController
- RNKeychain (8.1.3):
- React-Core
- RNLocalize (2.2.6):
- RNLocalize (3.1.0):
- React-Core
- RNPermissions (4.1.5):
- React-Core
Expand Down Expand Up @@ -1249,7 +1249,7 @@ SPEC CHECKSUMS:
RNGestureHandler: 69d0a928253547ef857a7be4f453220b9c472e07
RNImageCropPicker: e7ab6fb43d2fc3e84651e786ef4a080d63b0ed3d
RNKeychain: f1b48665a4646f61191eb048c4c05c58d9a7596f
RNLocalize: d4b8af4e442d4bcca54e68fc687a2129b4d71a81
RNLocalize: e8694475db034bf601e17bd3dfa8986565e769eb
RNPermissions: da2a4ded375aa8292d85ed93676e102c203d4717
RNPersonaInquiry2: 3ab52078e891a5d2fa39bf7cc9119ca27f0337fd
RNReactNativeHapticFeedback: ec56a5f81c3941206fd85625fa669ffc7b4545f9
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"react-native-keychain": "^8.1.3",
"react-native-launch-arguments": "^4.0.2",
"react-native-linear-gradient": "^2.8.3",
"react-native-localize": "^2.2.6",
"react-native-localize": "^3.1.0",
"react-native-modal": "^13.0.1",
"react-native-permissions": "^4.1.5",
"react-native-persona": "^2.2.23",
Expand Down
2 changes: 1 addition & 1 deletion src/app/AppInitGate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('AppInitGate', () => {

it('should update the language if none was set', async () => {
jest
.spyOn(RNLocalize, 'findBestAvailableLanguage')
.spyOn(RNLocalize, 'findBestLanguageTag')
.mockReturnValue({ languageTag: 'de-DE', isRTL: true })

const { getByText, store } = renderAppInitGate(null)
Expand Down
6 changes: 2 additions & 4 deletions src/app/AppInitGate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import locales from 'locales'
import React, { useEffect } from 'react'
import { useAsync } from 'react-async-hook'
import { Dimensions } from 'react-native'
import { findBestAvailableLanguage } from 'react-native-localize'
import { findBestLanguageTag } from 'react-native-localize'
import { AppEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { appMounted, appUnmounted } from 'src/app/actions'
Expand All @@ -28,9 +28,7 @@ const AppInitGate = ({ appStartedMillis, reactLoadTime, children }: Props) => {
const dispatch = useDispatch()

const language = useSelector(currentLanguageSelector)
const bestLanguage = !isE2EEnv
? findBestAvailableLanguage(Object.keys(locales))?.languageTag
: 'en-US'
const bestLanguage = !isE2EEnv ? findBestLanguageTag(Object.keys(locales))?.languageTag : 'en-US'

useEffect(() => {
return () => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/saga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ describe('appInit', () => {

it('should initialise with the best language', async () => {
jest
.spyOn(RNLocalize, 'findBestAvailableLanguage')
.spyOn(RNLocalize, 'findBestLanguageTag')
.mockReturnValue({ languageTag: 'de-DE', isRTL: true })

await expectSaga(appInit)
Expand All @@ -745,7 +745,7 @@ describe('appInit', () => {
})

it('should initialise with the app fallback language', async () => {
jest.spyOn(RNLocalize, 'findBestAvailableLanguage').mockReturnValue(undefined)
jest.spyOn(RNLocalize, 'findBestLanguageTag').mockReturnValue(undefined)

await expectSaga(appInit)
.provide([[select(currentLanguageSelector), null], ...defaultProviders])
Expand Down
4 changes: 2 additions & 2 deletions src/app/saga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AppState, Platform } from 'react-native'
import DeviceInfo from 'react-native-device-info'
import InAppReview from 'react-native-in-app-review'
import * as Keychain from 'react-native-keychain'
import { findBestAvailableLanguage } from 'react-native-localize'
import { findBestLanguageTag } from 'react-native-localize'
import { eventChannel } from 'redux-saga'
import { e164NumberSelector } from 'src/account/selectors'
import { AppEvents, InviteEvents } from 'src/analytics/Events'
Expand Down Expand Up @@ -121,7 +121,7 @@ export function* appInit() {
const allowOtaTranslations = yield* select(allowOtaTranslationsSelector)
const otaTranslationsAppVersion = yield* select(otaTranslationsAppVersionSelector)
const language = yield* select(currentLanguageSelector)
const bestLanguage = findBestAvailableLanguage(Object.keys(locales))?.languageTag
const bestLanguage = findBestLanguageTag(Object.keys(locales))?.languageTag

yield* all([
call(initializeSentry),
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15264,10 +15264,10 @@ react-native-linear-gradient@^2.8.3:
resolved "https://registry.yarnpkg.com/react-native-linear-gradient/-/react-native-linear-gradient-2.8.3.tgz#9a116649f86d74747304ee13db325e20b21e564f"
integrity sha512-KflAXZcEg54PXkLyflaSZQ3PJp4uC4whM7nT/Uot9m0e/qxFV3p6uor1983D1YOBJbJN7rrWdqIjq0T42jOJyA==

react-native-localize@^2.2.6:
version "2.2.6"
resolved "https://registry.yarnpkg.com/react-native-localize/-/react-native-localize-2.2.6.tgz#484f8c700bc629f230066e819265f80f6dd3ef58"
integrity sha512-EZETlC1ZlW/4g6xfsNCwAkAw5BDL2A6zk/08JjFR/GRGxYuKRD7iP1hHn1+h6DEu+xROjPpoNeXfMER2vkTVIQ==
react-native-localize@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/react-native-localize/-/react-native-localize-3.1.0.tgz#1b322c05af21fd3d78d44e9b747d872ab5155b10"
integrity sha512-A7Rrxl8vuAr5FAqtMFrM5ELLdmszohK6FoHL6qlgxx4HScyOnadoZksbvKHbn+zV5nE8kud2Z4kJM10cN120Zg==

react-native-modal@^13.0.1:
version "13.0.1"
Expand Down

0 comments on commit c598cf0

Please sign in to comment.