Skip to content
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

Feat/live 3369/restart when switching lang #1274

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/ledger-live-mobile/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,8 @@ PODS:
- React-Core
- react-native-randombytes (3.6.1):
- React-Core
- react-native-restart (0.0.24):
- React-Core
- react-native-safe-area-context (4.2.5):
- RCT-Folly
- RCTRequired
Expand Down Expand Up @@ -675,6 +677,7 @@ DEPENDENCIES:
- "react-native-netinfo (from `../../../node_modules/.pnpm/@react-native-community+netinfo@6.2.1_react-native@0.68.2/node_modules/@react-native-community/netinfo`)"
- "react-native-performance (from `../../../node_modules/.pnpm/react-native-performance@2.1.0_react-native@0.68.2/node_modules/react-native-performance/ios`)"
- "react-native-randombytes (from `../../../node_modules/.pnpm/react-native-randombytes@3.6.1/node_modules/react-native-randombytes`)"
- "react-native-restart (from `../../../node_modules/.pnpm/react-native-restart@0.0.24_zqxy7fpkavjkgz5xll7ed4r6rq/node_modules/react-native-restart`)"
- "react-native-safe-area-context (from `../../../node_modules/.pnpm/react-native-safe-area-context@4.2.5_zqxy7fpkavjkgz5xll7ed4r6rq/node_modules/react-native-safe-area-context`)"
- "react-native-splash-screen (from `../../../node_modules/.pnpm/react-native-splash-screen@3.2.0_react-native@0.68.2/node_modules/react-native-splash-screen`)"
- "react-native-text-input-mask (from `../../../node_modules/.pnpm/react-native-text-input-mask@3.1.4_react-native@0.68.2/node_modules/react-native-text-input-mask`)"
Expand Down Expand Up @@ -829,6 +832,8 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/.pnpm/react-native-performance@2.1.0_react-native@0.68.2/node_modules/react-native-performance/ios"
react-native-randombytes:
:path: "../../../node_modules/.pnpm/react-native-randombytes@3.6.1/node_modules/react-native-randombytes"
react-native-restart:
:path: "../../../node_modules/.pnpm/react-native-restart@0.0.24_zqxy7fpkavjkgz5xll7ed4r6rq/node_modules/react-native-restart"
react-native-safe-area-context:
:path: "../../../node_modules/.pnpm/react-native-safe-area-context@4.2.5_zqxy7fpkavjkgz5xll7ed4r6rq/node_modules/react-native-safe-area-context"
react-native-splash-screen:
Expand Down Expand Up @@ -977,6 +982,7 @@ SPEC CHECKSUMS:
react-native-netinfo: 3d3769f0d65de15c83a9bf1346f8be71de5a24bf
react-native-performance: f4b6604a9d5a8a7407e34a82fab6c641d9a3ec12
react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846
react-native-restart: 45c8dca02491980f2958595333cbccd6877cb57e
react-native-safe-area-context: ebf8c413eb8b5f7c392a036a315eb7b46b96845f
react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865
react-native-text-input-mask: 36a546b378fadd2efe1b7484a859d34bc2c80395
Expand Down
1 change: 1 addition & 0 deletions apps/ledger-live-mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"react-native-randombytes": "^3.6.1",
"react-native-reanimated": "^2.8.0",
"react-native-redash": "^16.0.11",
"react-native-restart": "^0.0.24",
"react-native-safe-area-context": "^4.1.4",
"react-native-safe-area-view": "^1.1.1",
"react-native-screens": "^3.9.0",
Expand Down
16 changes: 6 additions & 10 deletions apps/ledger-live-mobile/src/screens/Onboarding/steps/language.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,27 @@ import {
import { StackScreenProps } from "@react-navigation/stack";
import { useDispatch } from "react-redux";
import i18next from "i18next";
import RNRestart from "react-native-restart";
import { useLocale } from "../../../context/Locale";
import { languages, supportedLocales } from "../../../languages";
import Button from "../../../components/Button";
import { ScreenName } from "../../../const";
import { setLanguage } from "../../../actions/settings";
import { useReboot } from "../../../context/Reboot";

// eslint-disable-next-line @typescript-eslint/ban-types
function OnboardingStepLanguage({ navigation }: StackScreenProps<{}>) {
const { locale: currentLocale } = useLocale();
const dispatch = useDispatch();
const reboot = useReboot();

const next = useCallback(() => {
navigation.goBack();
}, [navigation]);

const changeLanguageRTL = useCallback(
async l => {
await dispatch(setLanguage(l));
I18nManager.forceRTL(true);
reboot();
},
[I18nManager, i18next, reboot],
);
const changeLanguageRTL = useCallback(async l => {
await dispatch(setLanguage(l));
I18nManager.forceRTL(!I18nManager.isRTL);
RNRestart.Restart();
}, []);

const changeLanguage = useCallback(
async l => {
Expand Down
103 changes: 17 additions & 86 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.