Lint rule react prop types addition
This commit is contained in:
committed by
Sofiya Tepikin
parent
8444d466db
commit
47379d7a1e
@@ -1,34 +1,38 @@
|
||||
import React, { Component } from 'react'
|
||||
import {
|
||||
View,
|
||||
TouchableOpacity,
|
||||
} from 'react-native'
|
||||
import styles from '../../styles'
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import { View, TouchableOpacity } from 'react-native'
|
||||
|
||||
import AppText from '../app-text'
|
||||
|
||||
export default class SelectBoxGroup extends Component {
|
||||
render() {
|
||||
return (
|
||||
<View style={styles.selectBoxSection}>
|
||||
{Object.keys(this.props.labels).map(key => {
|
||||
const style = [styles.selectBox]
|
||||
const textStyle = []
|
||||
if (this.props.optionsState[key]) {
|
||||
style.push(styles.selectBoxActive)
|
||||
textStyle.push(styles.selectBoxTextActive)
|
||||
}
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={() => this.props.onSelect(key)}
|
||||
key={key}
|
||||
>
|
||||
<View style={style}>
|
||||
<AppText style={textStyle}>{this.props.labels[key]}</AppText>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
}
|
||||
import styles from '../../styles'
|
||||
|
||||
export default function SelectBoxGroup({ labels, onSelect, optionsState }) {
|
||||
return (
|
||||
<View style={styles.selectBoxSection}>
|
||||
{Object.keys(labels).map(key => {
|
||||
const style = [styles.selectBox]
|
||||
const textStyle = []
|
||||
if (optionsState[key]) {
|
||||
style.push(styles.selectBoxActive)
|
||||
textStyle.push(styles.selectBoxTextActive)
|
||||
}
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={() => onSelect(key)}
|
||||
key={key}
|
||||
>
|
||||
<View style={style}>
|
||||
<AppText style={textStyle}>{labels[key]}</AppText>
|
||||
</View>
|
||||
</TouchableOpacity>
|
||||
)
|
||||
})}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
SelectBoxGroup.propTypes = {
|
||||
labels: PropTypes.object.isRequired,
|
||||
onSelect: PropTypes.func.isRequired,
|
||||
optionsState: PropTypes.object.isRequired
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user