You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GoogleSignInButton.native.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @flow
  2. import React from 'react';
  3. import { Image, Text, TouchableOpacity } from 'react-native';
  4. import { translate } from '../../base/i18n';
  5. import AbstractGoogleSignInButton from './AbstractGoogleSignInButton';
  6. import styles from './styles';
  7. /**
  8. * The Google Brand image for Sign In.
  9. *
  10. * NOTE: iOS doesn't handle the react-native-google-signin button component
  11. * well due to our CocoaPods build process (the lib is not intended to be used
  12. * this way), hence the custom button implementation.
  13. */
  14. const GOOGLE_BRAND_IMAGE
  15. = require('../../../../images/btn_google_signin_dark_normal.png');
  16. /**
  17. * A React Component showing a button to sign in with Google.
  18. *
  19. * @extends Component
  20. */
  21. class GoogleSignInButton extends AbstractGoogleSignInButton {
  22. /**
  23. * Implements React's {@link Component#render()}.
  24. *
  25. * @inheritdoc
  26. * @returns {ReactElement}
  27. */
  28. render() {
  29. const { onClick, signedIn, t } = this.props;
  30. if (signedIn) {
  31. return (
  32. <TouchableOpacity
  33. onPress = { onClick }
  34. style = { styles.signOutButton } >
  35. <Text style = { styles.signOutButtonText }>
  36. { t('liveStreaming.signOut') }
  37. </Text>
  38. </TouchableOpacity>
  39. );
  40. }
  41. return (
  42. <TouchableOpacity
  43. onPress = { onClick }
  44. style = { styles.signInButton } >
  45. <Image
  46. resizeMode = { 'contain' }
  47. source = { GOOGLE_BRAND_IMAGE }
  48. style = { styles.signInImage } />
  49. </TouchableOpacity>
  50. );
  51. }
  52. }
  53. export default translate(GoogleSignInButton);