Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

TestHint.android.tsx 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { Component } from 'react';
  2. import { Text } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { TestHintProps, _mapStateToProps } from './AbstractTestHint';
  5. /**
  6. * The Android version of <code>TestHint</code>. It will put the identifier,
  7. * as the 'accessibilityLabel'.
  8. *
  9. * FIXME The 'testID' attribute (which is used on iOS) does not work with
  10. * the react-native as expected, because is mapped to component's tag instead of
  11. * any attribute visible to the UI automation. Because of that it can not be
  12. * used to find the element.
  13. * On the other hand it's not possible to use 'accessibilityLabel' on the iOS
  14. * for the id purpose, because it will merge the value with any text content or
  15. * 'accessibilityLabel' values of it's children. So as a workaround a TestHint
  16. * class was introduced in 'jitsi-meet-torture' which will accept generic 'id'
  17. * attribute and then do the search 'under the hood' either by the accessibility
  18. * label or the id, depending on the participant's platform. On the client side
  19. * the TestHint class is to be the abstraction layer which masks the problem by
  20. * exposing id and value properties.
  21. */
  22. class TestHint extends Component<TestHintProps> {
  23. /**
  24. * Renders the test hint on Android.
  25. *
  26. * @returns {ReactElement}
  27. */
  28. render() {
  29. if (!this.props._testModeEnabled) {
  30. return null;
  31. }
  32. return (
  33. <Text
  34. accessibilityLabel = { this.props.id }
  35. onPress = { this.props.onPress } >
  36. { this.props.value }
  37. </Text>
  38. );
  39. }
  40. }
  41. export default connect(_mapStateToProps)(TestHint);