Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Commit a5922d5

Browse files
dominicricopeacechen
authored andcommitted
Update for RN 0.58+ (peacechen#99)
* Update Modal propTypes due to deprecation in RN 0.58+
1 parent 3c651de commit a5922d5

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const propTypes = {
3030
visible: PropTypes.bool,
3131
closeOnChange: PropTypes.bool,
3232
initValue: PropTypes.string,
33-
animationType: Modal.propTypes.animationType,
33+
animationType: PropTypes.oneOf(['none', 'slide', 'fade']),
3434
style: ViewPropTypes.style,
3535
selectStyle: ViewPropTypes.style,
3636
selectTextStyle: Text.propTypes.style,
@@ -49,7 +49,15 @@ const propTypes = {
4949
overlayStyle: ViewPropTypes.style,
5050
cancelText: PropTypes.string,
5151
disabled: PropTypes.bool,
52-
supportedOrientations: Modal.propTypes.supportedOrientations,
52+
supportedOrientations: PropTypes.arrayOf(
53+
PropTypes.oneOf([
54+
'portrait',
55+
'portrait-upside-down',
56+
'landscape',
57+
'landscape-left',
58+
'landscape-right',
59+
]),
60+
),
5361
keyboardShouldPersistTaps: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
5462
backdropPressToClose: PropTypes.bool,
5563
openButtonContainerAccessible: PropTypes.bool,
@@ -141,7 +149,7 @@ export default class ModalSelector extends React.Component {
141149
}
142150

143151
onChange = (item) => {
144-
if (Platform.OS === 'android' || !Modal.propTypes.onDismiss) {
152+
if (Platform.OS === 'android' || (Modal.propTypes !== undefined && !Modal.propTypes.onDismiss)) { // don't know if this will work for previous version, please check!
145153
// RN >= 0.50 on iOS comes with the onDismiss prop for Modal which solves RN issue #10471
146154
this.props.onChange(item);
147155
}

0 commit comments

Comments
 (0)