diff --git a/.all-contributorsrc b/.all-contributorsrc
index f9f42879b..d9632a344 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -693,6 +693,15 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "Arjun-sna",
+ "name": "Arjun",
+ "avatar_url": "https://avatars3.githubusercontent.com/u/9337254?v=4",
+ "profile": "https://github.com/Arjun-sna",
+ "contributions": [
+ "code"
+ ]
}
]
}
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index e20ec1b5f..6cbbe8c43 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -17,5 +17,5 @@ Thank you to all the people who have already contributed to GitPoint!
| [
Dyesse YUMBA](https://github.com/dyesseyumba)
[🔧](#tool-dyesseyumba "Tools") | [
Bink](https://binkpitch.me/)
[💻](https://github.com/gitpoint/git-point/commits?author=binkpitch "Code") | [
khvilaboa](https://github.com/khvilaboa)
[🌍](#translation-khvilaboa "Translation") | [
James Glover](http://jamesmglover.com)
[💻](https://github.com/gitpoint/git-point/commits?author=jglover "Code") [⚠️](https://github.com/gitpoint/git-point/commits?author=jglover "Tests") | [
Jose Luis Naranjo](https://co.linkedin.com/in/josenaranjo/en)
[💻](https://github.com/gitpoint/git-point/commits?author=josenaranjo "Code") | [
Tobias Lohse](http://MrLoh.se)
[💻](https://github.com/gitpoint/git-point/commits?author=MrLoh "Code") |
| [
Serhii Baraniuk](https://www.facebook.com/serhii.baraniuk)
[⚠️](https://github.com/gitpoint/git-point/commits?author=kenitive "Tests") | [
Ben Snider](http://www.bensnider.com/)
[⚠️](https://github.com/gitpoint/git-point/commits?author=stupergenius "Tests") | [
Simon Hoyos](https://www.linkedin.com/in/simonhoyos/)
[💻](https://github.com/gitpoint/git-point/commits?author=shmesa22 "Code") [🎨](#design-shmesa22 "Design") | [
Damien Leroy](https://github.com/ShiiFu)
[🌍](#translation-ShiiFu "Translation") | [
botbotbot](http://dev.im-bot.com)
[⚠️](https://github.com/gitpoint/git-point/commits?author=ibotdotout "Tests") | [
Dmytro Kytsmen](https://github.com/Kietzmann)
[🌍](#translation-Kietzmann "Translation") |
| [
TheCodeTalker](https://thecodetalker.github.io/)
[💻](https://github.com/gitpoint/git-point/commits?author=TheCodeTalker "Code") | [
Leonardo](https://github.com/LeoCp)
[💻](https://github.com/gitpoint/git-point/commits?author=LeoCp "Code") | [
Stephen](https://github.com/coderste)
[📖](https://github.com/gitpoint/git-point/commits?author=coderste "Documentation") | [
Zahra Traboulsi](http://www.zahra.tech)
[💻](https://github.com/gitpoint/git-point/commits?author=ZahraTee "Code") [⚠️](https://github.com/gitpoint/git-point/commits?author=ZahraTee "Tests") | [
Joseba Carral](http://codevs.es)
[🌍](#translation-jcarral "Translation") | [
CTownsdin](https://github.com/CTownsdin)
[💻](https://github.com/gitpoint/git-point/commits?author=CTownsdin "Code") |
-| [
Apostolis Economou](https://github.com/apoeco)
[💻](https://github.com/gitpoint/git-point/commits?author=apoeco "Code") |
+| [
Apostolis Economou](https://github.com/apoeco)
[💻](https://github.com/gitpoint/git-point/commits?author=apoeco "Code") | [
Arjun](https://github.com/Arjun-sna)
[💻](https://github.com/gitpoint/git-point/commits?author=Arjun-sna "Code") |
diff --git a/routes.js b/routes.js
index 1d1fde161..7444a93c5 100644
--- a/routes.js
+++ b/routes.js
@@ -21,6 +21,7 @@ import {
EventsScreen,
PrivacyPolicyScreen,
UserOptionsScreen,
+ LanguageSettingsScreen,
} from 'auth';
// User
@@ -200,6 +201,12 @@ const sharedRoutes = {
title: navigation.state.params.title,
}),
},
+ LanguageSettings: {
+ screen: LanguageSettingsScreen,
+ navigationOptions: ({ navigation }) => ({
+ title: navigation.state.params.title,
+ }),
+ },
};
const HomeStackNavigator = StackNavigator(
diff --git a/src/auth/screens/index.js b/src/auth/screens/index.js
index a398ffb53..6bcda043e 100644
--- a/src/auth/screens/index.js
+++ b/src/auth/screens/index.js
@@ -5,3 +5,4 @@ export * from './auth-profile.screen';
export * from './events.screen';
export * from './privacy-policy.screen';
export * from './user-options.screen';
+export * from './language-setting.screen';
diff --git a/src/auth/screens/language-setting.screen.js b/src/auth/screens/language-setting.screen.js
new file mode 100644
index 000000000..db570d8a1
--- /dev/null
+++ b/src/auth/screens/language-setting.screen.js
@@ -0,0 +1,113 @@
+/* eslint-disable no-shadow */
+import React, { Component } from 'react';
+import { FlatList } from 'react-native';
+import styled from 'styled-components/native';
+import { connect } from 'react-redux';
+import { ListItem } from 'react-native-elements';
+import { colors, fonts } from 'config';
+import { changeLocale } from 'auth';
+import { bindActionCreators } from 'redux';
+import { emojifyText, translate } from 'utils';
+import { NavigationActions } from 'react-navigation';
+import { ViewContainer } from 'components';
+import languages from './language-settings';
+
+const ListTitle = styled.Text`
+ color: ${colors.black};
+ ${fonts.fontPrimary};
+`;
+
+const Language = styled.View`
+ flex-direction: row;
+`;
+
+const Flag = styled.Text`
+ padding-right: 7;
+ color: ${colors.black}; // random any color for the correct display emoji
+`;
+
+const StyledListItem = styled(ListItem).attrs({
+ containerStyle: {
+ borderBottomColor: colors.greyLight,
+ borderBottomWidth: 1,
+ height: 50,
+ justifyContent: 'center',
+ },
+ titleStyle: props => ({
+ color: props.signOut ? colors.red : colors.black,
+ ...fonts.fontPrimary,
+ }),
+ underlayColor: colors.greyLight,
+ hideChevron: props => props.hideChevron,
+})``;
+
+class LanguageSettings extends Component {
+ props: {
+ locale: string,
+ changeLocale: () => void,
+ };
+
+ componentWillReceiveProps(nextState) {
+ if (nextState.locale !== this.props.locale) {
+ const navigationParams = NavigationActions.setParams({
+ params: {
+ title: translate('auth.userOptions.language', nextState.locale),
+ },
+ key: nextState.navigation.state.key,
+ });
+
+ nextState.navigation.dispatch(navigationParams);
+ }
+ }
+
+ renderListItem = ({ item }) => {
+ const { locale, changeLocale } = this.props;
+
+ return (
+
+ {emojifyText(item.emojiCode)}
+ {item.name}
+
+ }
+ hideChevron={locale !== item.code}
+ rightIcon={{ name: 'check' }}
+ onPress={() => changeLocale(item.code)}
+ />
+ );
+ };
+
+ render() {
+ const { locale } = this.props;
+
+ return (
+
+ index}
+ extraData={locale}
+ />
+
+ );
+ }
+}
+
+const mapStateToProps = state => ({
+ locale: state.auth.locale,
+ user: state.auth.user,
+});
+
+const mapDispatchToProps = dispatch =>
+ bindActionCreators(
+ {
+ changeLocale,
+ },
+ dispatch
+ );
+
+export const LanguageSettingsScreen = connect(
+ mapStateToProps,
+ mapDispatchToProps
+)(LanguageSettings);
diff --git a/src/auth/screens/user-options.screen.js b/src/auth/screens/user-options.screen.js
index e51246037..2b2545b0c 100644
--- a/src/auth/screens/user-options.screen.js
+++ b/src/auth/screens/user-options.screen.js
@@ -3,23 +3,17 @@ import React, { Component } from 'react';
import styled from 'styled-components/native';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-import { ScrollView, FlatList } from 'react-native';
+import { ScrollView } from 'react-native';
import { ListItem } from 'react-native-elements';
import { NavigationActions } from 'react-navigation';
import CookieManager from 'react-native-cookies';
import { ViewContainer, SectionList } from 'components';
import { colors, fonts, normalize } from 'config';
-import {
- resetNavigationTo,
- openURLInView,
- translate,
- emojifyText,
-} from 'utils';
+import { resetNavigationTo, openURLInView, translate } from 'utils';
import { version } from 'package.json';
import codePush from 'react-native-code-push';
-import { signOut, changeLocale } from 'auth';
-import languages from './language-settings';
+import { signOut } from 'auth';
const mapStateToProps = state => ({
locale: state.auth.locale,
@@ -30,16 +24,10 @@ const mapDispatchToProps = dispatch =>
bindActionCreators(
{
signOut,
- changeLocale,
},
dispatch
);
-const ListTitle = styled.Text`
- color: ${colors.black};
- ${fonts.fontPrimary};
-`;
-
const Update = styled.TouchableOpacity`
flex: 1;
align-items: center;
@@ -55,15 +43,6 @@ const UpdateTextSub = UpdateText.extend`
font-size: ${normalize(11)};
`;
-const Language = styled.View`
- flex-direction: row;
-`;
-
-const Flag = styled.Text`
- padding-right: 7;
- color: ${colors.black}; // random any color for the correct display emoji
-`;
-
const StyledListItem = styled(ListItem).attrs({
containerStyle: {
borderBottomColor: colors.greyLight,
@@ -88,7 +67,6 @@ const updateText = locale => ({
class UserOptions extends Component {
props: {
locale: string,
- changeLocale: () => void,
signOut: () => void,
navigation: Object,
user: Object,
@@ -152,35 +130,20 @@ class UserOptions extends Component {
}
render() {
- const { locale, changeLocale, navigation } = this.props;
+ const { locale, navigation } = this.props;
return (
-
- {
- return (
-
- {emojifyText(item.emojiCode)}
- {item.name}
-
- }
- hideChevron={locale !== item.code}
- rightIcon={{ name: 'check' }}
- onPress={() => changeLocale(item.code)}
- />
- );
- }}
- keyExtractor={(item, index) => index}
- extraData={locale}
- />
-
-
+
+ navigation.navigate('LanguageSettings', {
+ title: translate('auth.userOptions.language', locale),
+ locale,
+ })}
+ />
openURLInView(this.props.user.html_url)}