您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TestHint.android.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { Text } from 'react-native';
  4. import type { TestHintProps } 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. export default class TestHint extends Component<TestHintProps> {
  23. /**
  24. * Renders the test hint on Android.
  25. *
  26. * @returns {ReactElement}
  27. */
  28. render() {
  29. return (
  30. <Text accessibilityLabel = { this.props.id } >
  31. { this.props.value }
  32. </Text>
  33. );
  34. }
  35. }