Repository navigation
Update Preferences page with push-to-page design #14591
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
Changes from all commits
54f3c9a
09a2e59
6fe6acd
66eab56
67bc438
69dfd47
735f4bd
25a72d4
276b712
7260c2e
d5b5742
15f905f
3868463
8e59473
57d0c5d
4958719
fc2e470
4384921
9193e05
7ebd6ef
01b74f8
ace0711
470f896
0a9cb4b
c198c53
2b426f3
928f474
76bfe87
7131798
67d365e
0e4022e
1fc1031
14b5468
8bf1fb2
122d55e
de3fa9f
6d1c670
77f321d
256cf6b
4c940c6
b7bebb2
33f2f49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import _ from 'underscore'; | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import HeaderWithCloseButton from '../../../components/HeaderWithCloseButton'; | ||
| import ScreenWrapper from '../../../components/ScreenWrapper'; | ||
| import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize'; | ||
| import Navigation from '../../../libs/Navigation/Navigation'; | ||
| import ROUTES from '../../../ROUTES'; | ||
| import OptionsList from '../../../components/OptionsList'; | ||
| import styles from '../../../styles/styles'; | ||
| import themeColors from '../../../styles/themes/default'; | ||
| import * as Expensicons from '../../../components/Icon/Expensicons'; | ||
| import * as App from '../../../libs/actions/App'; | ||
|
|
||
| const greenCheckmark = {src: Expensicons.Checkmark, color: themeColors.success}; | ||
|
|
||
| const propTypes = { | ||
| ...withLocalizePropTypes, | ||
|
|
||
| /** The preferred language of the App */ | ||
| preferredLocale: PropTypes.string.isRequired, | ||
| }; | ||
|
|
||
| const LanguagePage = (props) => { | ||
| const localesToLanguages = _.map(props.translate('languagePage.languages'), | ||
| (language, key) => ( | ||
| { | ||
| value: key, | ||
| text: language.label, | ||
| keyForList: key, | ||
|
|
||
| // Include the green checkmark icon to indicate the currently selected value | ||
| customIcon: props.preferredLocale === key ? greenCheckmark : undefined, | ||
|
|
||
| // This property will make the currently selected value have bold text | ||
| boldStyle: props.preferredLocale === key, | ||
| } | ||
| )); | ||
|
|
||
| return ( | ||
| <ScreenWrapper includeSafeAreaPaddingBottom={false}> | ||
| <HeaderWithCloseButton | ||
| title={props.translate('languagePage.language')} | ||
| shouldShowBackButton | ||
| onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_PREFERENCES)} | ||
| onCloseButtonPress={() => Navigation.dismissModal(true)} | ||
| /> | ||
| <OptionsList | ||
| sections={[{data: localesToLanguages}]} | ||
| onSelectRow={ | ||
| (language) => { | ||
| if (language.value !== props.preferredLocale) { | ||
| App.setLocale(language.value); | ||
| } | ||
| Navigation.navigate(ROUTES.SETTINGS_PREFERENCES); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cristipaval I know you want to get this out soon, we really should move this to an action, maybe called |
||
| } | ||
| } | ||
| hideSectionHeaders | ||
| optionHoveredStyle={ | ||
| { | ||
| ...styles.hoveredComponentBG, | ||
| ...styles.mhn5, | ||
| ...styles.ph5, | ||
| } | ||
| } | ||
| shouldHaveOptionSeparator | ||
| shouldDisableRowInnerPadding | ||
| contentContainerStyles={[styles.ph5]} | ||
| /> | ||
| </ScreenWrapper> | ||
| ); | ||
| }; | ||
|
|
||
| LanguagePage.displayName = 'LanguagePage'; | ||
| LanguagePage.propTypes = propTypes; | ||
|
|
||
| export default withLocalize(LanguagePage); | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cristipaval we should put all this inside
ScrollView, right?To make it scrollable when new items are adding to this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we? Isn't
OptionListhandling the scroll if needed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cristipaval i was thinking we'll need
ScrollViewwhen items other than OptionList are added. (Images, Text etc).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We definitely might need
ScrollVieweventually, but we can add that later when / if we add those other components