feat(react) removed unused native components
This commit is contained in:
parent
ea5ce3f72f
commit
4f49cde73e
|
@ -1,71 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { TouchableOpacity } from 'react-native';
|
||||
|
||||
import { ColorSchemeRegistry } from '../../../color-scheme';
|
||||
import { Icon, IconArrowBack } from '../../../icons';
|
||||
import { connect } from '../../../redux';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link BackButton}.
|
||||
*/
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* The action to be performed when the button is pressed.
|
||||
*/
|
||||
onPress: Function,
|
||||
|
||||
/**
|
||||
* An external style object passed to the component.
|
||||
*/
|
||||
style?: Object,
|
||||
|
||||
/**
|
||||
* The color schemed style of the Header component.
|
||||
*/
|
||||
_headerStyles: Object
|
||||
};
|
||||
|
||||
/**
|
||||
* A component rendering a back button.
|
||||
*/
|
||||
class BackButton extends Component<Props> {
|
||||
/**
|
||||
* Implements React's {@link Component#render()}, renders the button.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
accessibilityLabel = { 'Back' }
|
||||
onPress = { this.props.onPress }>
|
||||
<Icon
|
||||
src = { IconArrowBack }
|
||||
style = { [
|
||||
this.props._headerStyles.headerButtonIcon,
|
||||
this.props.style
|
||||
] } />
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps part of the Redux state to the props of this component.
|
||||
*
|
||||
* @param {Object} state - The Redux state.
|
||||
* @returns {{
|
||||
* _headerStyles: Object
|
||||
* }}
|
||||
*/
|
||||
function _mapStateToProps(state) {
|
||||
return {
|
||||
_headerStyles: ColorSchemeRegistry.get(state, 'Header')
|
||||
};
|
||||
}
|
||||
|
||||
export default connect(_mapStateToProps)(BackButton);
|
|
@ -1,44 +0,0 @@
|
|||
/* @flow */
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { Text, TouchableOpacity } from 'react-native';
|
||||
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* React Elements to display within the component.
|
||||
*/
|
||||
children: React$Node | Object,
|
||||
|
||||
/**
|
||||
* Handler called when the user presses the button.
|
||||
*/
|
||||
onValueChange: Function,
|
||||
|
||||
/**
|
||||
* The component's external style.
|
||||
*/
|
||||
style: Object
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders a button.
|
||||
*/
|
||||
export default class ButtonImpl extends Component<Props> {
|
||||
/**
|
||||
* Implements React's {@link Component#render()}, renders the button.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress = { this.props.onValueChange } >
|
||||
<Text style = { this.props.style }>
|
||||
{ this.props.children }
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { Text, TouchableOpacity } from 'react-native';
|
||||
|
||||
import { ColorSchemeRegistry } from '../../../color-scheme';
|
||||
import { translate } from '../../../i18n';
|
||||
import { connect } from '../../../redux';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link ForwardButton}.
|
||||
*/
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* True if the nutton should be disabled.
|
||||
*/
|
||||
disabled: boolean;
|
||||
|
||||
/**
|
||||
* The i18n label key of the button.
|
||||
*/
|
||||
labelKey: string,
|
||||
|
||||
/**
|
||||
* The action to be performed when the button is pressed.
|
||||
*/
|
||||
onPress: Function,
|
||||
|
||||
/**
|
||||
* An external style object passed to the component.
|
||||
*/
|
||||
style?: Object,
|
||||
|
||||
/**
|
||||
* The function to be used to translate i18n labels.
|
||||
*/
|
||||
t: Function,
|
||||
|
||||
/**
|
||||
* The color schemed style of the Header component.
|
||||
*/
|
||||
_headerStyles: Object
|
||||
};
|
||||
|
||||
/**
|
||||
* A component rendering a forward/next/action button.
|
||||
*/
|
||||
class ForwardButton extends Component<Props> {
|
||||
/**
|
||||
* Implements React's {@link Component#render()}, renders the button.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
const { _headerStyles } = this.props;
|
||||
|
||||
return (
|
||||
<TouchableOpacity
|
||||
accessibilityLabel = { 'Forward' }
|
||||
disabled = { this.props.disabled }
|
||||
onPress = { this.props.onPress } >
|
||||
<Text
|
||||
style = { [
|
||||
_headerStyles.headerButtonText,
|
||||
this.props.disabled && _headerStyles.disabledButtonText,
|
||||
this.props.style
|
||||
] }>
|
||||
{ this.props.t(this.props.labelKey) }
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps part of the Redux state to the props of the component.
|
||||
*
|
||||
* @param {Object} state - The Redux state.
|
||||
* @returns {{
|
||||
* _headerStyles: Object
|
||||
* }}
|
||||
*/
|
||||
function _mapStateToProps(state) {
|
||||
return {
|
||||
_headerStyles: ColorSchemeRegistry.get(state, 'Header')
|
||||
};
|
||||
}
|
||||
|
||||
export default translate(connect(_mapStateToProps)(ForwardButton));
|
|
@ -1,73 +0,0 @@
|
|||
// @flow
|
||||
|
||||
import React, { Component } from 'react';
|
||||
import { Text, View } from 'react-native';
|
||||
|
||||
import { ColorSchemeRegistry } from '../../../color-scheme';
|
||||
import { translate } from '../../../i18n';
|
||||
import { connect } from '../../../redux';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link HeaderLabel}.
|
||||
*/
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
* The i18n key of the label to be rendered.
|
||||
*/
|
||||
labelKey: string,
|
||||
|
||||
/**
|
||||
* The i18n translate function.
|
||||
*/
|
||||
t: Function,
|
||||
|
||||
/**
|
||||
* The color schemed style of the Header component.
|
||||
*/
|
||||
_headerStyles: Object
|
||||
};
|
||||
|
||||
/**
|
||||
* A component rendering a standard label in the header.
|
||||
*/
|
||||
class HeaderLabel extends Component<Props> {
|
||||
/**
|
||||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
const { _headerStyles } = this.props;
|
||||
|
||||
return (
|
||||
<View
|
||||
pointerEvents = 'box-none'
|
||||
style = { _headerStyles.headerTextWrapper }>
|
||||
<Text
|
||||
style = { [
|
||||
_headerStyles.headerText
|
||||
] }>
|
||||
{ this.props.t(this.props.labelKey) }
|
||||
</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Maps part of the Redux state to the props of this component.
|
||||
*
|
||||
* @param {Object} state - The Redux state.
|
||||
* @returns {{
|
||||
* _headerStyles: Object
|
||||
* }}
|
||||
*/
|
||||
function _mapStateToProps(state) {
|
||||
return {
|
||||
_headerStyles: ColorSchemeRegistry.get(state, 'Header')
|
||||
};
|
||||
}
|
||||
|
||||
export default translate(connect(_mapStateToProps)(HeaderLabel));
|
|
@ -1,12 +1,8 @@
|
|||
// @flow
|
||||
|
||||
export { default as AvatarListItem } from './AvatarListItem';
|
||||
export { default as BackButton } from './BackButton';
|
||||
export { default as BaseIndicator } from './BaseIndicator';
|
||||
export { default as Button } from './Button';
|
||||
export { default as Container } from './Container';
|
||||
export { default as ForwardButton } from './ForwardButton';
|
||||
export { default as HeaderLabel } from './HeaderLabel';
|
||||
export { default as Image } from './Image';
|
||||
export { default as Link } from './Link';
|
||||
export { default as Linkify } from './Linkify';
|
||||
|
|
Loading…
Reference in New Issue