Skip to content

Commit

Permalink
feat(component): add prop-types validation non-validated components. C…
Browse files Browse the repository at this point in the history
…loses #93

* feat(rkText): add prop-types validation

* feat(rkAvoidKeyboard): add prop-types validation
  • Loading branch information
Artur Yorsh authored and malashkevich committed Sep 20, 2018
1 parent 586b4f2 commit ea193cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/avoidKeyboard/rkAvoidKeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
Animated,
Platform,
Keyboard,
ViewPropTypes,
} from 'react-native';
import { RkComponent } from '../rkComponent';

Expand All @@ -24,6 +25,9 @@ import { RkComponent } from '../rkComponent';
* ```
*/
export class RkAvoidKeyboard extends RkComponent {
static propTypes = {
...ViewPropTypes,
};
componentName = 'RkAvoidKeyboard';
typeMapping = {
container: {},
Expand Down
12 changes: 10 additions & 2 deletions src/components/text/rkText.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,28 @@ import { RkComponent } from '../rkComponent';
*/

export class RkText extends RkComponent {
static propTypes = {
rkType: RkComponent.propTypes.rkType,
...Text.propTypes,
};
static defaultProps = {
rkType: RkComponent.defaultProps.rkType,
};
componentName = 'RkText';
typeMapping = {
text: {},
};

render() {
const {
rkType,
style,
children,
...textProps
} = this.props;
const styles = this.defineStyles();
const styles = this.defineStyles(rkType);
return (
<Text style={[styles.text, style]} {...textProps}>{children}</Text>
<Text rkType={rkType} style={[styles.text, style]} {...textProps}>{children}</Text>
);
}
}

0 comments on commit ea193cb

Please sign in to comment.