paweldomas adec8e6438 ref(TestHint): render only in test mode
Adds the logic to render TestHint only when the test mode is enabled
in order to be able to put independent TestHints in other places than
the TestConnectionInfo component.
2018-04-19 16:49:22 -05:00

37 lines
935 B
JavaScript

/* @flow */
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Text } from 'react-native';
import type { TestHintProps } from './AbstractTestHint';
import { _mapStateToProps } from './AbstractTestHint';
/**
* 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.
*/
class TestHint extends Component<TestHintProps> {
/**
* Renders the test hint on Android.
*
* @returns {ReactElement}
*/
render() {
if (!this.props._testModeEnabled) {
return null;
}
return (
<Text
accessibilityLabel = { this.props.value }
testID = { this.props.id } />
);
}
}
export default connect(_mapStateToProps)(TestHint);