From f068fda899fb22c483f6091a94fd9d2a099d55d5 Mon Sep 17 00:00:00 2001 From: landon Date: Mon, 3 Dec 2018 14:26:22 +0900 Subject: [PATCH] Add feature of handling something before calling onPress func --- src/components/dropdown/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/dropdown/index.js b/src/components/dropdown/index.js index b1e65a1f..f21bf365 100644 --- a/src/components/dropdown/index.js +++ b/src/components/dropdown/index.js @@ -76,6 +76,8 @@ export default class Dropdown extends PureComponent { ], useNativeDriver: false, + + preprocessFunc: () => null }; static propTypes = { @@ -153,6 +155,8 @@ export default class Dropdown extends PureComponent { supportedOrientations: PropTypes.arrayOf(PropTypes.string), useNativeDriver: PropTypes.bool, + + preprocessFunc: PropTypes.func }; constructor(props) { @@ -214,8 +218,17 @@ export default class Dropdown extends PureComponent { animationDuration, absoluteRTLLayout, useNativeDriver, + preprocessFunc } = this.props; + if ( + preprocessFunc && + typeof preprocessFunc === "function" && + !disabled + ) { + preprocessFunc(); + } + if (disabled) { return; }