From 2a9cd0fd69c3c5a6f825a14826f926af7f51635d Mon Sep 17 00:00:00 2001 From: noumantahir Date: Sat, 25 Dec 2021 14:00:10 +0500 Subject: [PATCH 01/16] replacing editor instead of navigating to next screen to avoid accident duplication --- .../drafts/container/draftsContainer.js | 3 +++ src/screens/drafts/screen/draftsScreen.js | 3 ++- .../editor/container/editorContainer.tsx | 21 ++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/screens/drafts/container/draftsContainer.js b/src/screens/drafts/container/draftsContainer.js index 297697ff4..a75587712 100644 --- a/src/screens/drafts/container/draftsContainer.js +++ b/src/screens/drafts/container/draftsContainer.js @@ -28,6 +28,8 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch }) => { const [schedules, setSchedules] = useState([]); const [isLoading, setIsLoading] = useState(false); + const [initialTabIndex] = useState(navigation.state?.params?.showSchedules ? 1 : 0); + useEffect(() => { _getDrafts(); _getSchedules(); @@ -145,6 +147,7 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch }) => { removeDraft={_removeDraft} moveScheduleToDraft={_moveScheduleToDraft} removeSchedule={_removeSchedule} + initialTabIndex={initialTabIndex} /> ); }; diff --git a/src/screens/drafts/screen/draftsScreen.js b/src/screens/drafts/screen/draftsScreen.js index 1b11284a9..0b4c7293e 100644 --- a/src/screens/drafts/screen/draftsScreen.js +++ b/src/screens/drafts/screen/draftsScreen.js @@ -15,7 +15,6 @@ import { BasicHeader, TabBar, DraftListItem, PostCardPlaceHolder } from '../../. import globalStyles from '../../../globalStyles'; import styles from './draftStyles'; import { OptionsModal } from '../../../components/atoms'; -import { jsonStringify } from '../../../utils/jsonUtils'; const DraftsScreen = ({ currentAccount, @@ -27,6 +26,7 @@ const DraftsScreen = ({ drafts, schedules, moveScheduleToDraft, + initialTabIndex, }) => { const [selectedId, setSelectedId] = useState(null); const ActionSheetRef = useRef(null); @@ -123,6 +123,7 @@ const DraftsScreen = ({ ( { @@ -1058,10 +1059,10 @@ class EditorContainer extends Component { ); setTimeout(() => { - navigation.navigate({ - routeName: ROUTES.SCREENS.DRAFTS, - key: currentAccount.name, - }); + navigation.replace(ROUTES.SCREENS.DRAFTS, + { + showSchedules:true + }) }, 3000); }) .catch((error) => { From 912cae60ad3656d92d597eaa5aeee56d29e60e7e Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Thu, 30 Dec 2021 18:21:58 +0500 Subject: [PATCH 02/16] added support for RTL and LTR switch --- ios/Podfile.lock | 6 +++--- package.json | 3 ++- .../settings/container/settingsContainer.js | 12 ++++++------ src/utils/I18nUtils.js | 16 ++++++++++++++++ yarn.lock | 13 +++++++++---- 5 files changed, 36 insertions(+), 14 deletions(-) create mode 100644 src/utils/I18nUtils.js diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 105aee031..0cda6bfb0 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -325,8 +325,8 @@ PODS: - React-Core - react-native-receive-sharing-intent (1.0.4): - React - - react-native-restart (0.0.17): - - React + - react-native-restart (0.0.23): + - React-Core - react-native-safe-area-context (3.1.9): - React-Core - react-native-splash-screen (3.2.0): @@ -731,7 +731,7 @@ SPEC CHECKSUMS: react-native-netinfo: 30fb89fa913c342be82a887b56e96be6d71201dd react-native-randombytes: 421f1c7d48c0af8dbcd471b0324393ebf8fe7846 react-native-receive-sharing-intent: feba0a332a07977549a85aa58b496eb44368366a - react-native-restart: d19a0f8d053d065fe64cd2baebb6487111c77149 + react-native-restart: aaad36f3ed7031daac3565f4a79d67e4f3884a50 react-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94 react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 react-native-udp: ff9d13e523f2b58e6bc5d4d32321ac60671b5dc9 diff --git a/package.json b/package.json index 823bc674b..559197fb0 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "react-native-reanimated": "^1", "react-native-receive-sharing-intent": "ecency/react-native-receive-sharing-intent", "react-native-render-html": "^6.0.5", - "react-native-restart": "0.0.17", + "react-native-restart": "^0.0.23", "react-native-safe-area-context": "^3.1.9", "react-native-screens": "^2.9.0", "react-native-scrollable-tab-view": "ecency/react-native-scrollable-tab-view", @@ -141,6 +141,7 @@ "redux-thunk": "^2.3.0", "rn-fetch-blob": "^0.12.0", "rn-placeholder": "^1.3.2", + "rtl-detect": "^1.0.4", "speakingurl": "^14.0.1", "stacktrace-parser": "0.1.4", "stream-browserify": "^1.0.0", diff --git a/src/screens/settings/container/settingsContainer.js b/src/screens/settings/container/settingsContainer.js index b9a615c36..b656c705c 100644 --- a/src/screens/settings/container/settingsContainer.js +++ b/src/screens/settings/container/settingsContainer.js @@ -6,7 +6,7 @@ import VersionNumber from 'react-native-version-number'; import Config from 'react-native-config'; import { injectIntl } from 'react-intl'; import messaging from '@react-native-firebase/messaging'; - +import { languageRestart } from '../../../utils/I18nUtils'; // Realm import { getExistUser, @@ -91,17 +91,17 @@ class SettingsContainer extends Component { } // Component Functions - _handleDropdownSelected = (action, actionType) => { - const { dispatch } = this.props; - + _handleDropdownSelected = async (action, actionType) => { + const { dispatch, selectedLanguage } = this.props; switch (actionType) { case 'currency': this._currencyChange(action); break; case 'language': - dispatch(setLanguage(LANGUAGE_VALUE[action])); - setLanguage2DB(LANGUAGE_VALUE[action]); + await dispatch(setLanguage(LANGUAGE_VALUE[action])); + await setLanguage2DB(LANGUAGE_VALUE[action]); + await languageRestart(selectedLanguage, LANGUAGE_VALUE[action]); //restart the app and flip change layout according to lang direction break; case 'api': diff --git a/src/utils/I18nUtils.js b/src/utils/I18nUtils.js new file mode 100644 index 000000000..eff301178 --- /dev/null +++ b/src/utils/I18nUtils.js @@ -0,0 +1,16 @@ +import { NativeModules } from 'react-native'; +import RNRestart from 'react-native-restart'; +import rtlDetect from 'rtl-detect'; + +export const languageRestart = async (prevLang, lang) => { + if (prevLang != lang) { + // if selected lang is RTL, switch the layout + if (rtlDetect.isRtlLang(lang)) { + await NativeModules.I18nManager.forceRTL(true); + } else { + await NativeModules.I18nManager.forceRTL(false); + } + // restart the app to take changes in UI + RNRestart.Restart(); + } +}; diff --git a/yarn.lock b/yarn.lock index 98b80f697..e1c0d3a1a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8937,10 +8937,10 @@ react-native-render-html@^6.0.5: stringify-entities "^3.1.0" urijs "^1.19.6" -react-native-restart@0.0.17: - version "0.0.17" - resolved "https://registry.yarnpkg.com/react-native-restart/-/react-native-restart-0.0.17.tgz#c1f38e019d1a2114248d496698e7951e9435ba91" - integrity sha512-UwFPDssMFoyDbF2aLARIHWt5g/o0TtxCXK9WIY+0iNpkgG9qWd+n80XBwXioNCdgy39ZQ5yfJBJRwtMLDgABag== +react-native-restart@^0.0.23: + version "0.0.23" + resolved "https://registry.yarnpkg.com/react-native-restart/-/react-native-restart-0.0.23.tgz#9b53062ebc692f469d0662c06879cb4d34c62520" + integrity sha512-BTs3YNl0MFyTgYgq6oQOspVV7+8Umm2QeuHWJ8xfRsjdHIUBoKF/Bxe1IMGAO5vHPcNwN+lHE6Mf58Tu4HS9/w== react-native-safe-area-context@^3.1.9: version "3.1.9" @@ -9636,6 +9636,11 @@ rsvp@^4.8.4: resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== +rtl-detect@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/rtl-detect/-/rtl-detect-1.0.4.tgz#40ae0ea7302a150b96bc75af7d749607392ecac6" + integrity sha512-EBR4I2VDSSYr7PkBmFy04uhycIpDKp+21p/jARYXlCSjQksTBQcJ0HFUPOO79EPPH5JS6VAhiIQbycf0O3JAxQ== + run-async@^2.2.0: version "2.4.1" resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" From 994546f32c5c27a4a9e1f0d46897bef86d69d865 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Fri, 31 Dec 2021 10:39:00 +0500 Subject: [PATCH 03/16] added restart alert when changing language --- src/utils/I18nUtils.js | 16 ---------------- src/utils/I18nUtils.ts | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 16 deletions(-) delete mode 100644 src/utils/I18nUtils.js create mode 100644 src/utils/I18nUtils.ts diff --git a/src/utils/I18nUtils.js b/src/utils/I18nUtils.js deleted file mode 100644 index eff301178..000000000 --- a/src/utils/I18nUtils.js +++ /dev/null @@ -1,16 +0,0 @@ -import { NativeModules } from 'react-native'; -import RNRestart from 'react-native-restart'; -import rtlDetect from 'rtl-detect'; - -export const languageRestart = async (prevLang, lang) => { - if (prevLang != lang) { - // if selected lang is RTL, switch the layout - if (rtlDetect.isRtlLang(lang)) { - await NativeModules.I18nManager.forceRTL(true); - } else { - await NativeModules.I18nManager.forceRTL(false); - } - // restart the app to take changes in UI - RNRestart.Restart(); - } -}; diff --git a/src/utils/I18nUtils.ts b/src/utils/I18nUtils.ts new file mode 100644 index 000000000..dbbddc6a9 --- /dev/null +++ b/src/utils/I18nUtils.ts @@ -0,0 +1,27 @@ +import { Alert, NativeModules } from 'react-native'; +import RNRestart from 'react-native-restart'; +import rtlDetect from 'rtl-detect'; + +export const languageRestart = async (prevLang, lang) => { + if (prevLang != lang) { + // if selected lang is RTL, switch the layout + if (rtlDetect.isRtlLang(lang)) { + await NativeModules.I18nManager.forceRTL(true); + } else { + await NativeModules.I18nManager.forceRTL(false); + } + + Alert.alert( + 'Restart Ecency?', + 'Press Ok to restart the ecency for changes to take immediate effect. Press Cancel for not restarting it. ', + [ + { + text: 'Cancel', + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', + }, + { text: 'OK', onPress: () => RNRestart.Restart() }, + ], + ); + } +}; From 20a7836a020d3cbc9c5024464fb39e0a768e1f05 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Fri, 31 Dec 2021 11:46:46 +0500 Subject: [PATCH 04/16] added Ui fix for RTL in draft screen --- src/components/basicHeader/view/basicHeaderStyles.js | 7 +++++++ src/components/basicHeader/view/basicHeaderView.js | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/basicHeader/view/basicHeaderStyles.js b/src/components/basicHeader/view/basicHeaderStyles.js index 04938f660..a2ea49919 100644 --- a/src/components/basicHeader/view/basicHeaderStyles.js +++ b/src/components/basicHeader/view/basicHeaderStyles.js @@ -1,4 +1,5 @@ import EStyleSheet from 'react-native-extended-stylesheet'; +import { NativeModules } from 'react-native'; export default EStyleSheet.create({ container: { @@ -15,6 +16,11 @@ export default EStyleSheet.create({ backIcon: { fontSize: 24, color: '$iconColor', + transform: [{ scaleX: NativeModules.I18nManager.isRTL ? -1 : 1 }], + }, + gearIcon: { + fontSize: 24, + color: '$iconColor', }, saveIcon: { fontSize: 20, @@ -45,6 +51,7 @@ export default EStyleSheet.create({ }, iconButton: { marginRight: 24, + marginLeft: NativeModules.I18nManager.isRTL ? 24 : 0, justifyContent: 'center', alignSelf: 'center', }, diff --git a/src/components/basicHeader/view/basicHeaderView.js b/src/components/basicHeader/view/basicHeaderView.js index a0482b012..a618653d3 100644 --- a/src/components/basicHeader/view/basicHeaderView.js +++ b/src/components/basicHeader/view/basicHeaderView.js @@ -175,7 +175,7 @@ const BasicHeaderView = ({ {isHasIcons && !isReply && ( Date: Sat, 1 Jan 2022 09:24:14 +0500 Subject: [PATCH 05/16] right aligned editor text field in RTL --- src/components/textInput/view/textInputView.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/textInput/view/textInputView.js b/src/components/textInput/view/textInputView.js index 1c699e329..2242fb663 100644 --- a/src/components/textInput/view/textInputView.js +++ b/src/components/textInput/view/textInputView.js @@ -1,5 +1,5 @@ import React from 'react'; -import { TextInput } from 'react-native'; +import { TextInput, NativeModules } from 'react-native'; import { ThemeContainer } from '../../../containers'; @@ -12,6 +12,7 @@ const TextInputView = ({ innerRef, height, style, ...props }) => ( From 79539637755f2133239ab47f43ff49fcb3b7e6ea Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sun, 2 Jan 2022 13:30:06 +0500 Subject: [PATCH 06/16] formatted alert with intl --- src/config/locales/en-US.json | 4 +- .../settings/container/settingsContainer.js | 4 +- src/utils/I18nUtils.ts | 44 ++++++++++++------- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 1f64dc700..d512dcee9 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -433,7 +433,9 @@ "update_available_body":"Using latest version of Ecency gives you the best experience", "update": "Update Now", "remind_later": "Remind Later", - "failed_to_open": "Failed to open a link" + "failed_to_open": "Failed to open a link", + "restart_ecency": "Restart Ecency?", + "restart_ecency_desc": "Press Confirm to restart the ecency for changes to take immediate effect. Press Cancel for not restarting it. " }, "post": { "reblog_alert": "Are you sure, you want to reblog?", diff --git a/src/screens/settings/container/settingsContainer.js b/src/screens/settings/container/settingsContainer.js index b656c705c..ce9dee774 100644 --- a/src/screens/settings/container/settingsContainer.js +++ b/src/screens/settings/container/settingsContainer.js @@ -92,7 +92,7 @@ class SettingsContainer extends Component { // Component Functions _handleDropdownSelected = async (action, actionType) => { - const { dispatch, selectedLanguage } = this.props; + const { dispatch, selectedLanguage, intl } = this.props; switch (actionType) { case 'currency': this._currencyChange(action); @@ -101,7 +101,7 @@ class SettingsContainer extends Component { case 'language': await dispatch(setLanguage(LANGUAGE_VALUE[action])); await setLanguage2DB(LANGUAGE_VALUE[action]); - await languageRestart(selectedLanguage, LANGUAGE_VALUE[action]); //restart the app and flip change layout according to lang direction + await languageRestart(selectedLanguage, LANGUAGE_VALUE[action], intl); //restart the app and flip change layout according to lang direction break; case 'api': diff --git a/src/utils/I18nUtils.ts b/src/utils/I18nUtils.ts index dbbddc6a9..09181d4d3 100644 --- a/src/utils/I18nUtils.ts +++ b/src/utils/I18nUtils.ts @@ -2,26 +2,40 @@ import { Alert, NativeModules } from 'react-native'; import RNRestart from 'react-native-restart'; import rtlDetect from 'rtl-detect'; -export const languageRestart = async (prevLang, lang) => { +export const languageRestart = (prevLang, lang, intl) => { if (prevLang != lang) { // if selected lang is RTL, switch the layout if (rtlDetect.isRtlLang(lang)) { - await NativeModules.I18nManager.forceRTL(true); + NativeModules.I18nManager.forceRTL(true); } else { - await NativeModules.I18nManager.forceRTL(false); + NativeModules.I18nManager.forceRTL(false); } - Alert.alert( - 'Restart Ecency?', - 'Press Ok to restart the ecency for changes to take immediate effect. Press Cancel for not restarting it. ', - [ - { - text: 'Cancel', - onPress: () => console.log('Cancel Pressed'), - style: 'cancel', - }, - { text: 'OK', onPress: () => RNRestart.Restart() }, - ], - ); + // if any prevLang or curr Lang is of different layout, alert user and restart + if (rtlDetect.isRtlLang(prevLang) !== rtlDetect.isRtlLang(lang)) { + Alert.alert( + intl.formatMessage({ + id: 'alert.restart_ecency', + }), + intl.formatMessage({ + id: 'alert.restart_ecency_desc', + }), + [ + { + text: intl.formatMessage({ + id: 'alert.cancel', + }), + onPress: () => console.log('Cancel Pressed'), + style: 'cancel', + }, + { + text: intl.formatMessage({ + id: 'alert.confirm', + }), + onPress: () => RNRestart.Restart(), + }, + ], + ); + } } }; From 07a81c2f49ce899f0b525a848071d12c1aad7a26 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Tue, 4 Jan 2022 12:06:33 +0500 Subject: [PATCH 07/16] updated restart message --- src/config/locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index d512dcee9..407996f12 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -435,7 +435,7 @@ "remind_later": "Remind Later", "failed_to_open": "Failed to open a link", "restart_ecency": "Restart Ecency?", - "restart_ecency_desc": "Press Confirm to restart the ecency for changes to take immediate effect. Press Cancel for not restarting it. " + "restart_ecency_desc": "Applying changes will require a restart." }, "post": { "reblog_alert": "Are you sure, you want to reblog?", From 0c865b4ab949c4080b6620e00de7b34fa397f509 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 4 Jan 2022 21:50:32 +0500 Subject: [PATCH 08/16] rtl issues fixed in feeds screen header component --- ios/Podfile.lock | 2 +- src/components/header/view/headerStyles.ts | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a160089bc..c052bc551 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -772,4 +772,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9c48318ea254e2c78005a7a0c2d8bfc14ddd783d -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/src/components/header/view/headerStyles.ts b/src/components/header/view/headerStyles.ts index 75359ead4..f8e55f880 100644 --- a/src/components/header/view/headerStyles.ts +++ b/src/components/header/view/headerStyles.ts @@ -1,5 +1,5 @@ import EStyleSheet from 'react-native-extended-stylesheet'; -import { Platform } from 'react-native'; +import { Platform, NativeModules } from 'react-native'; export default EStyleSheet.create({ container: { @@ -29,15 +29,17 @@ export default EStyleSheet.create({ avatarDefault: { borderTopRightRadius: 68 / 2, borderBottomRightRadius: 68 / 2, + overflow:'hidden' }, titleWrapper: { flexDirection: 'column', justifyContent: 'center', + alignItems: 'flex-start', marginHorizontal: 8, - flex:2 + flex:2, }, titleWrapperReverse: { - alignItems:'flex-end' + alignItems:'flex-end', }, title: { fontSize: 14, From 2a9ae1397727d4aa3c8bee9c6bc17bcad72c939d Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 4 Jan 2022 22:07:50 +0500 Subject: [PATCH 09/16] fixed upvote popover alignment issues in rtl layout --- src/components/upvote/view/upvoteStyles.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/upvote/view/upvoteStyles.js b/src/components/upvote/view/upvoteStyles.js index 58a258552..ddc5ad62f 100644 --- a/src/components/upvote/view/upvoteStyles.js +++ b/src/components/upvote/view/upvoteStyles.js @@ -86,10 +86,12 @@ export default EStyleSheet.create({ detailsText: { color: '$primaryDarkGray', fontSize: 12, + textAlign: 'right', }, popoverItemContent: { flexDirection: 'row', marginTop: 4, + justifyContent: 'space-between', }, popoverContent: { marginTop: 4, @@ -100,5 +102,6 @@ export default EStyleSheet.create({ color: '$primaryDarkGray', fontSize: 12, fontWeight: 'bold', + textAlign: 'left', }, }); From f2175c47f0a2579a5b992ca2ff158a7cdc922573 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 4 Jan 2022 22:46:04 +0500 Subject: [PATCH 10/16] fixed alignment in post crad dropdown in RTL --- src/components/dropdownButton/view/dropdownButtonStyles.js | 1 + src/components/dropdownButton/view/dropdownButtonView.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/dropdownButton/view/dropdownButtonStyles.js b/src/components/dropdownButton/view/dropdownButtonStyles.js index 9cb02920a..4de9a3e5b 100644 --- a/src/components/dropdownButton/view/dropdownButtonStyles.js +++ b/src/components/dropdownButton/view/dropdownButtonStyles.js @@ -80,5 +80,6 @@ export default EStyleSheet.create({ rowText: { fontSize: 10, color: '$primaryDarkGray', + textAlign: 'left', }, }); diff --git a/src/components/dropdownButton/view/dropdownButtonView.tsx b/src/components/dropdownButton/view/dropdownButtonView.tsx index c8c37724e..bcab9f215 100644 --- a/src/components/dropdownButton/view/dropdownButtonView.tsx +++ b/src/components/dropdownButton/view/dropdownButtonView.tsx @@ -42,7 +42,11 @@ const renderDropdownRow = ( ); - +const adjustDropdownFrame = (style:any) => { + style.left = 'auto' + style.right = 10 + return style +} const DropdownButtonView = ({ childIconWrapperStyle, children, @@ -90,6 +94,7 @@ const DropdownButtonView = ({ dropdownRowWrapper, ) } + adjustFrame={(style: any) => adjustDropdownFrame(style) } > {isHasChildIcon && !isLoading ? ( From 82e795c9f86b20579def6c9034d62b3cd5646ae2 Mon Sep 17 00:00:00 2001 From: feruz Date: Tue, 4 Jan 2022 23:25:50 +0200 Subject: [PATCH 11/16] update render-helper body --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7a7fda773..904b46505 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "dependencies": { "@babel/runtime": "^7.5.5", "@bugsnag/react-native": "^7.11.0", - "@ecency/render-helper": "^2.2.8", + "@ecency/render-helper": "^2.2.9", "@esteemapp/dhive": "0.15.0", "@esteemapp/react-native-autocomplete-input": "^4.2.1", "@esteemapp/react-native-multi-slider": "^1.1.0", diff --git a/yarn.lock b/yarn.lock index 7bc94163a..0d62a6470 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1031,10 +1031,10 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@ecency/render-helper@^2.2.8": - version "2.2.8" - resolved "https://registry.yarnpkg.com/@ecency/render-helper/-/render-helper-2.2.8.tgz#1c6e8b2e467f64097bf692a26f2a3103bc1e32f7" - integrity sha512-RPsM6Pbhb3Yfh2h1XiHj17fPM0doZTut3Wppf8iVGzwqdiaZ1NYI+mmYn5lG2lK8WcBAez0vHZeoHqBxdNGMWg== +"@ecency/render-helper@^2.2.9": + version "2.2.9" + resolved "https://registry.yarnpkg.com/@ecency/render-helper/-/render-helper-2.2.9.tgz#067a4f3d3c27bcb814648c692a4dfb868035436b" + integrity sha512-Oiz2N7qbwRAuS7dtbSRmCr7Yp2wUyEmBNtEun1byYoE+1g4k7dxJLsigs9ErrJzZ/yFQVcLEB1YrfjZczl/vfQ== dependencies: he "^1.2.0" lolight "^1.4.0" From 598499914cde19ab6a2a3c4fb7942c80f1965360 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 5 Jan 2022 19:14:51 +0500 Subject: [PATCH 12/16] fixed alignment issues in reblog screen --- ios/Podfile.lock | 2 +- src/components/basicHeader/view/basicHeaderStyles.js | 3 ++- .../basicUIElements/view/userListItem/userListItemStyles.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a160089bc..c052bc551 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -772,4 +772,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 9c48318ea254e2c78005a7a0c2d8bfc14ddd783d -COCOAPODS: 1.10.1 +COCOAPODS: 1.11.2 diff --git a/src/components/basicHeader/view/basicHeaderStyles.js b/src/components/basicHeader/view/basicHeaderStyles.js index a2ea49919..1d8740937 100644 --- a/src/components/basicHeader/view/basicHeaderStyles.js +++ b/src/components/basicHeader/view/basicHeaderStyles.js @@ -72,11 +72,12 @@ export default EStyleSheet.create({ }, title: { color: '$iconColor', - alignSelf: 'center', + // alignSelf: 'center', fontSize: 16, marginLeft: 16, flexGrow: 1, fontWeight: '500', + textAlign: 'left', }, textInput: { color: '$iconColor', diff --git a/src/components/basicUIElements/view/userListItem/userListItemStyles.js b/src/components/basicUIElements/view/userListItem/userListItemStyles.js index 2a4c2a358..31c69f89d 100644 --- a/src/components/basicUIElements/view/userListItem/userListItemStyles.js +++ b/src/components/basicUIElements/view/userListItem/userListItemStyles.js @@ -8,6 +8,7 @@ export default EStyleSheet.create({ }, userDescription: { flexDirection: 'column', + alignItems: 'flex-start', flexGrow: 1, marginLeft: 8, }, @@ -26,7 +27,6 @@ export default EStyleSheet.create({ color: '$primaryDarkGray', fontSize: 14, fontWeight: 'bold', - maxWidth: '$deviceWidth - 100', fontFamily: '$primaryFont', }, reputation: { From e7305e28c3c2dfbf9c389dba91a499870798e3ff Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 5 Jan 2022 19:41:41 +0500 Subject: [PATCH 13/16] fixed alignment issues in side menu --- src/components/sideMenu/view/sideMenuStyles.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/sideMenu/view/sideMenuStyles.js b/src/components/sideMenu/view/sideMenuStyles.js index a9b832daf..5f63e06c0 100644 --- a/src/components/sideMenu/view/sideMenuStyles.js +++ b/src/components/sideMenu/view/sideMenuStyles.js @@ -36,6 +36,7 @@ export default EStyleSheet.create({ userInfoWrapper: { alignSelf: 'center', marginLeft: 15, + marginRight: 8, width: 120, }, username: { @@ -63,10 +64,10 @@ export default EStyleSheet.create({ listItemText: { color: '$primaryDarkGray', marginLeft: 12, - alignSelf: 'center', fontWeight: '500', fontSize: 14, flex: 1, + textAlign: 'left', }, buttonText: { fontSize: 18, From e1916fb702d616be040f362c1ac2ae3d969050d9 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 5 Jan 2022 20:15:43 +0500 Subject: [PATCH 14/16] fixed alignment issues in settings screen --- src/components/basicHeader/view/basicHeaderStyles.js | 1 + src/components/settingsItem/view/settingsItemStyles.js | 1 + src/components/toggleSwitch/view/toggleSwitchView.js | 4 ++-- src/screens/settings/screen/settingsStyles.js | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/basicHeader/view/basicHeaderStyles.js b/src/components/basicHeader/view/basicHeaderStyles.js index a2ea49919..2bd43c371 100644 --- a/src/components/basicHeader/view/basicHeaderStyles.js +++ b/src/components/basicHeader/view/basicHeaderStyles.js @@ -77,6 +77,7 @@ export default EStyleSheet.create({ marginLeft: 16, flexGrow: 1, fontWeight: '500', + textAlign: 'left', }, textInput: { color: '$iconColor', diff --git a/src/components/settingsItem/view/settingsItemStyles.js b/src/components/settingsItem/view/settingsItemStyles.js index 10684674a..4a39b95c8 100644 --- a/src/components/settingsItem/view/settingsItemStyles.js +++ b/src/components/settingsItem/view/settingsItemStyles.js @@ -12,6 +12,7 @@ export default EStyleSheet.create({ fontSize: 14, fontWeight: 'bold', flexGrow: 1, + textAlign: 'left', }, dropdownText: { fontSize: 14, diff --git a/src/components/toggleSwitch/view/toggleSwitchView.js b/src/components/toggleSwitch/view/toggleSwitchView.js index 1c4158b62..b403ee359 100644 --- a/src/components/toggleSwitch/view/toggleSwitchView.js +++ b/src/components/toggleSwitch/view/toggleSwitchView.js @@ -1,5 +1,5 @@ import React, { PureComponent } from 'react'; -import { View, TouchableOpacity, Animated } from 'react-native'; +import { View, TouchableOpacity, Animated, NativeModules } from 'react-native'; // Constants @@ -85,7 +85,7 @@ class ToggleSwitchView extends PureComponent { _triggerAnimation = () => { const { width, translateX, isOn, duration } = this.state; - const toValue = isOn ? width - translateX : 0; + const toValue = isOn ? width - (NativeModules.I18nManager.isRTL ? 100 : translateX) : 0; //in rtl layout, set the translate value to 100 Animated.timing(this.offsetX, { toValue, diff --git a/src/screens/settings/screen/settingsStyles.js b/src/screens/settings/screen/settingsStyles.js index 050d7d2f7..ec03ccc50 100644 --- a/src/screens/settings/screen/settingsStyles.js +++ b/src/screens/settings/screen/settingsStyles.js @@ -12,6 +12,7 @@ export default EStyleSheet.create({ }, cardTitle: { color: '$primaryBlue', + textAlign: 'left', }, paddingBottom: { paddingBottom: 20, From 8ab12e379e450befa3da63e6733a8d717159d60f Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 5 Jan 2022 20:34:18 +0500 Subject: [PATCH 15/16] reversed user info and avatar in RTL layout --- src/components/sideMenu/view/sideMenuStyles.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/sideMenu/view/sideMenuStyles.js b/src/components/sideMenu/view/sideMenuStyles.js index 5f63e06c0..eb5498bf0 100644 --- a/src/components/sideMenu/view/sideMenuStyles.js +++ b/src/components/sideMenu/view/sideMenuStyles.js @@ -1,4 +1,5 @@ import EStyleSheet from 'react-native-extended-stylesheet'; +import { NativeModules } from 'react-native'; import scalePx from '../../../utils/scalePx'; export default EStyleSheet.create({ @@ -18,14 +19,16 @@ export default EStyleSheet.create({ headerContentWrapper: { alignItems: 'center', height: 70, - flexDirection: 'row', + flexDirection: NativeModules.I18nManager.isRTL ? 'row-reverse' : 'row', alignSelf: 'center', + flex: 1, }, contentView: { flex: 4, }, userAvatar: { - marginLeft: 32, + marginLeft: NativeModules.I18nManager.isRTL ? 15 : 32, + marginRight: NativeModules.I18nManager.isRTL ? 15 : 0, }, otherUserAvatar: { borderWidth: 0.1, @@ -36,7 +39,6 @@ export default EStyleSheet.create({ userInfoWrapper: { alignSelf: 'center', marginLeft: 15, - marginRight: 8, width: 120, }, username: { From 8265573987b973eba096268f9f48d221d272753e Mon Sep 17 00:00:00 2001 From: noumantahir Date: Thu, 6 Jan 2022 11:53:33 +0500 Subject: [PATCH 16/16] Introduced short method for checking RTL --- src/components/sideMenu/view/sideMenuStyles.js | 8 ++++---- src/utils/I18nUtils.ts | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/sideMenu/view/sideMenuStyles.js b/src/components/sideMenu/view/sideMenuStyles.js index eb5498bf0..fd7931f91 100644 --- a/src/components/sideMenu/view/sideMenuStyles.js +++ b/src/components/sideMenu/view/sideMenuStyles.js @@ -1,5 +1,5 @@ import EStyleSheet from 'react-native-extended-stylesheet'; -import { NativeModules } from 'react-native'; +import { isRTL } from '../../../utils/I18nUtils'; import scalePx from '../../../utils/scalePx'; export default EStyleSheet.create({ @@ -19,7 +19,7 @@ export default EStyleSheet.create({ headerContentWrapper: { alignItems: 'center', height: 70, - flexDirection: NativeModules.I18nManager.isRTL ? 'row-reverse' : 'row', + flexDirection: isRTL() ? 'row-reverse' : 'row', alignSelf: 'center', flex: 1, }, @@ -27,8 +27,8 @@ export default EStyleSheet.create({ flex: 4, }, userAvatar: { - marginLeft: NativeModules.I18nManager.isRTL ? 15 : 32, - marginRight: NativeModules.I18nManager.isRTL ? 15 : 0, + marginLeft: isRTL() ? 15 : 32, + marginRight: isRTL() ? 15 : 0, }, otherUserAvatar: { borderWidth: 0.1, diff --git a/src/utils/I18nUtils.ts b/src/utils/I18nUtils.ts index 09181d4d3..2a6b5b8b9 100644 --- a/src/utils/I18nUtils.ts +++ b/src/utils/I18nUtils.ts @@ -2,6 +2,8 @@ import { Alert, NativeModules } from 'react-native'; import RNRestart from 'react-native-restart'; import rtlDetect from 'rtl-detect'; +export const isRTL = () => NativeModules.I18nManager.isRTL; + export const languageRestart = (prevLang, lang, intl) => { if (prevLang != lang) { // if selected lang is RTL, switch the layout