Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

GoogleSignInButton.native.js 1.8KB

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