Skip to content

Instantly share code, notes, and snippets.

@dsternlicht
Created November 13, 2017 08:10
Show Gist options
  • Select an option

  • Save dsternlicht/87ea9df7be7a9ebff66443f5692897ce to your computer and use it in GitHub Desktop.

Select an option

Save dsternlicht/87ea9df7be7a9ebff66443f5692897ce to your computer and use it in GitHub Desktop.
Login screen with localization
import React, { Component } from 'react';
import {
View,
Text,
Button
} from 'react-native';
import { strings } from '../locales/i18n';
class LoginScreen extends Component {
constructor(props) {
super(props);
this.state = {
username: 'Daniel'
};
}
render() {
return (
<View>
<Text>{strings('login.welcome', { name: this.state.username })}</Text>
<Button title={strings('login.login_button')}></Button>
<Button title={strings('login.singup_button')}></Button>
</View>
);
}
}
export default LoginScreen;
@fendorio
Copy link
Copy Markdown

There is a bug here on line 24, 'login.singup_button', should be 'login.signup_button', just came from the post on Medium.

This
<Button title={strings('login.singup_button')}></Button>

Should be
<Button title={strings('login.signup_button')}></Button>

Link to Medium article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment