diff --git a/__tests__/screens/ProfileInfoScreen.test.js b/__tests__/screens/ProfileInfoScreen.test.js index 781dada..36c8cf4 100644 --- a/__tests__/screens/ProfileInfoScreen.test.js +++ b/__tests__/screens/ProfileInfoScreen.test.js @@ -38,8 +38,8 @@ describe('Testing ProfileInfoScreen', () => { }; const wrapper = shallow(); - const foundPresident = wrapper.findWhere(c => c.key() === 'is_president'); - const foundConselour = wrapper.findWhere(c => c.key() === 'is_counselor'); + const foundPresident = wrapper.findWhere(c => c.text() === 'Presidente'); + const foundConselour = wrapper.findWhere(c => c.text() === 'Conselheiro'); expect(foundPresident.length).toBe(1); expect(foundConselour.length).toBe(0); @@ -57,8 +57,8 @@ describe('Testing ProfileInfoScreen', () => { }; const wrapper = shallow(); - const foundPresident = wrapper.findWhere(c => c.key() === 'is_president'); - const foundConselour = wrapper.findWhere(c => c.key() === 'is_counselor'); + const foundPresident = wrapper.findWhere(c => c.text() === 'Presidente'); + const foundConselour = wrapper.findWhere(c => c.text() === 'Conselheiro'); expect(foundPresident.length).toBe(0); expect(foundConselour.length).toBe(1); diff --git a/src/Styles/ProfileStyles.js b/src/Styles/ProfileStyles.js index 7b69192..a331a1c 100644 --- a/src/Styles/ProfileStyles.js +++ b/src/Styles/ProfileStyles.js @@ -50,4 +50,4 @@ const styles = StyleSheet.create({ }, }); -export default styles; +export default styles; \ No newline at end of file diff --git a/src/components/Button.js b/src/components/Button.js index 96907c2..97003ec 100644 --- a/src/components/Button.js +++ b/src/components/Button.js @@ -6,8 +6,7 @@ import styles from '../Styles/GeneralStyles'; class Button extends React.Component { defineStyle() { - if (this.props.style === undefined) { - this.props.style.text = styles.buttonText; + if (!this.props.style) { if (this.props.enabled) { return ( styles.bigButton @@ -22,6 +21,13 @@ class Button extends React.Component { ); } + defineTextStyle() { + if (!this.props.style) { + return styles.buttonText; + } + return this.props.style.text; + } + render() { return ( @@ -31,7 +37,7 @@ class Button extends React.Component { disabled={!this.props.enabled} onPress={() => this.props.onPress()} > - {this.props.text} + {this.props.text} ); @@ -45,7 +51,11 @@ Button.propTypes = { text: string.isRequired, enabled: bool.isRequired, onPress: func.isRequired, - style: element.isRequired, + style: element, +}; + +Button.defaultProps = { + style: undefined, }; export default Button; diff --git a/src/components/ScheduleCard.js b/src/components/ScheduleCard.js index fbbe9a2..7785c52 100644 --- a/src/components/ScheduleCard.js +++ b/src/components/ScheduleCard.js @@ -61,7 +61,11 @@ ScheduleCard.propTypes = { value: PropTypes.string.isRequired, })).isRequired, keyProp: PropTypes.string.isRequired, - children: PropTypes.element.isRequired, + children: PropTypes.element, +}; + +ScheduleCard.defaultProps = { + children: undefined, }; export default ScheduleCard; diff --git a/src/screens/ProfileInfoScreen.js b/src/screens/ProfileInfoScreen.js index 3925cc8..80b32ad 100644 --- a/src/screens/ProfileInfoScreen.js +++ b/src/screens/ProfileInfoScreen.js @@ -6,8 +6,8 @@ import { MaterialIcons } from '@expo/vector-icons'; import Header from '../components/Header'; import Button from '../components/Button'; import { backHandlerPopToMain } from '../NavigationFunctions'; -import { PROFILE_FIELDS } from '../constants/profileInformations'; -import { styles } from '../Styles/ProfileStyles'; +import PROFILE_FIELDS from '../constants/profileInformations'; +import styles from '../Styles/ProfileStyles'; export default class ProfileInfoScreen extends React.Component { diff --git a/src/screens/scheduleMeeting/ScheduleMeeting.js b/src/screens/scheduleMeeting/ScheduleMeeting.js index 7be55d8..ea26f14 100644 --- a/src/screens/scheduleMeeting/ScheduleMeeting.js +++ b/src/screens/scheduleMeeting/ScheduleMeeting.js @@ -567,7 +567,7 @@ ScheduleMeeting.propTypes = { phone: string.isRequired, }).isRequired, meetingListOfInvitees: shape({ - nuvemCode: number.isRequired, - confirmed: bool.isRequired, + nuvemCode: number, + confirmed: bool, }).isRequired, };