Commit cdbe7e3391223e0d84d2a314d394364c98e31bbd
ux: bug fix: crash when selecting popup menu option
Andre Staltz committed on 11/19/2019, 3:05:23 PMParent: 7defdf9c55f160e73c26a31ce60dc12565b108b2
Files changed
patches/react-native-popup-menu+0.15.6.patch | added |
patches/react-native-popup-menu+0.15.6.patch | ||
---|---|---|
@@ -1,0 +1,43 @@ | ||
1 | +diff --git a/node_modules/react-native-popup-menu/build/rnpm.js b/node_modules/react-native-popup-menu/build/rnpm.js | |
2 | +index 5f161b1..3543135 100644 | |
3 | +--- a/node_modules/react-native-popup-menu/build/rnpm.js | |
4 | ++++ b/node_modules/react-native-popup-menu/build/rnpm.js | |
5 | +@@ -2753,7 +2753,7 @@ | |
6 | + value: function _onSelect() { | |
7 | + var value = this.props.value; | |
8 | + | |
9 | +- var onSelect = this.props.onSelect || this._getMenusOnSelect(); | |
10 | ++ var onSelect = this.props.onSelect || this._getMenusOnSelect() || (() => {}); | |
11 | + | |
12 | + var shouldClose = onSelect(value) !== false; | |
13 | + debug('select option', value, shouldClose); | |
14 | +@@ -2766,7 +2766,7 @@ | |
15 | + key: "_getMenusOnSelect", | |
16 | + value: function _getMenusOnSelect() { | |
17 | + var menu = this.props.ctx.menuActions._getOpenedMenu(); | |
18 | +- | |
19 | ++ if (!menu) return; | |
20 | + return menu.instance.props.onSelect; | |
21 | + } | |
22 | + }, { | |
23 | +diff --git a/node_modules/react-native-popup-menu/src/MenuOption.js b/node_modules/react-native-popup-menu/src/MenuOption.js | |
24 | +index 4ecf228..00f2fc2 100644 | |
25 | +--- a/node_modules/react-native-popup-menu/src/MenuOption.js | |
26 | ++++ b/node_modules/react-native-popup-menu/src/MenuOption.js | |
27 | +@@ -10,7 +10,7 @@ export class MenuOption extends Component { | |
28 | + | |
29 | + _onSelect() { | |
30 | + const { value } = this.props; | |
31 | +- const onSelect = this.props.onSelect || this._getMenusOnSelect() | |
32 | ++ const onSelect = this.props.onSelect || this._getMenusOnSelect() || (() => {}) | |
33 | + const shouldClose = onSelect(value) !== false; | |
34 | + debug('select option', value, shouldClose); | |
35 | + if (shouldClose) { | |
36 | +@@ -20,6 +20,7 @@ export class MenuOption extends Component { | |
37 | + | |
38 | + _getMenusOnSelect() { | |
39 | + const menu = this.props.ctx.menuActions._getOpenedMenu(); | |
40 | ++ if (!menu) return; | |
41 | + return menu.instance.props.onSelect; | |
42 | + } | |
43 | + |
Built with git-ssb-web