Skip to content

Commit

Permalink
Conditionally use ViewPropTypes.
Browse files Browse the repository at this point in the history
  • Loading branch information
peacechen committed Aug 8, 2017
1 parent 880e5fb commit 849c0b8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,29 @@ import {
Text,
ScrollView,
TouchableOpacity,
Platform
Platform,
ViewPropTypes
} from 'react-native';

import styles from './style';
import BaseComponent from './BaseComponent';

let componentIndex = 0;
let rnVersion = Number.parseFloat(require('react-native/package.json').version);

const propTypes = {
data: PropTypes.array,
onChange: PropTypes.func,
initValue: PropTypes.string,
style: View.propTypes.style,
selectStyle: View.propTypes.style,
optionStyle: View.propTypes.style,
style: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style,
selectStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style,
optionStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style,
optionTextStyle: Text.propTypes.style,
sectionStyle: View.propTypes.style,
sectionStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style,
sectionTextStyle: Text.propTypes.style,
cancelStyle: View.propTypes.style,
cancelStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style,
cancelTextStyle: Text.propTypes.style,
overlayStyle: View.propTypes.style,
overlayStyle: rnVersion >= 0.44 ? ViewPropTypes.style : View.propTypes.style,
cancelText: PropTypes.string,
keyboardShouldPersistTaps: PropTypes.oneOfType([PropTypes.string, PropTypes.bool])
};
Expand Down

0 comments on commit 849c0b8

Please sign in to comment.