2018-03-07 15:23:04 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
2018-04-18 18:06:04 +00:00
|
|
|
import { connect } from 'react-redux';
|
2018-03-07 15:23:04 +00:00
|
|
|
import { Text } from 'react-native';
|
|
|
|
|
|
|
|
import type { TestHintProps } from './AbstractTestHint';
|
2018-04-18 18:06:04 +00:00
|
|
|
import { _mapStateToProps } from './AbstractTestHint';
|
2018-03-07 15:23:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the iOS version of the TestHint.
|
|
|
|
*
|
|
|
|
* Be sure to check the description in TestHint.android and AbstractTestHint
|
|
|
|
* files to understand what a test hint is and why different iOS and Android
|
|
|
|
* components are necessary.
|
|
|
|
*/
|
2018-04-18 18:06:04 +00:00
|
|
|
class TestHint extends Component<TestHintProps> {
|
2018-03-07 15:23:04 +00:00
|
|
|
/**
|
|
|
|
* Renders the test hint on Android.
|
|
|
|
*
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2018-04-18 18:06:04 +00:00
|
|
|
if (!this.props._testModeEnabled) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2018-03-07 15:23:04 +00:00
|
|
|
return (
|
|
|
|
<Text
|
|
|
|
accessibilityLabel = { this.props.value }
|
2018-04-18 18:15:01 +00:00
|
|
|
onPress = { this.props.onPress }
|
2018-03-07 15:23:04 +00:00
|
|
|
testID = { this.props.id } />
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2018-04-18 18:06:04 +00:00
|
|
|
|
|
|
|
export default connect(_mapStateToProps)(TestHint);
|