Lint rule react prop types addition

This commit is contained in:
Maria Zadnepryanets
2020-03-11 20:19:45 +00:00
committed by Sofiya Tepikin
parent 8444d466db
commit 47379d7a1e
26 changed files with 292 additions and 184 deletions
+21 -12
View File
@@ -1,22 +1,31 @@
import React from 'react'
import PropTypes from 'prop-types'
import { TouchableOpacity } from 'react-native'
import AppText from './app-text'
import styles from '../styles'
export default function Button(props) {
export default function Button({
backgroundColor,
children,
onPress,
style,
testID
}) {
return (
<TouchableOpacity
onPress={props.onPress}
style={[
styles.button,
props.style,
{backgroundColor: props.backgroundColor}
]}
testID={props.testID}
onPress={onPress}
style={[styles.button, style, { backgroundColor }]}
testID={testID}
>
<AppText style={styles.homeButtonText}>
{props.children}
</AppText>
<AppText style={styles.homeButtonText}>{children}</AppText>
</TouchableOpacity>
)
}
}
Button.propTypes = {
backgroundColor: PropTypes.string,
children: PropTypes.node,
onPress: PropTypes.func,
style: PropTypes.object,
testID: PropTypes.string
}