secullum-react-native-ui 4.16.2-beta.10 → 4.16.2-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,7 @@ export interface DropDownProperties {
25
25
  arrowColor?: string | undefined;
26
26
  searchable?: SearchableProps;
27
27
  virtualized?: true | VirtualizedProps;
28
+ useKeyboardAvoidingView?: boolean;
28
29
  }
29
30
  export interface SearchableProps {
30
31
  placeHolder: string;
@@ -93,7 +93,7 @@ class DropDownItem extends React.PureComponent {
93
93
  } }, this.renderOpenDropDownItem()));
94
94
  }
95
95
  }
96
- const DEFAULT_VIRTUALIZED = {
96
+ const DEFAULT_VIRTUALIZED_PROPS = {
97
97
  initialNumToRender: 20,
98
98
  maxToRenderPerBatch: 30,
99
99
  windowSize: 10
@@ -299,17 +299,36 @@ class DropDown extends React.Component {
299
299
  return (React.createElement(react_native_1.FlatList, { data: filteredItems, initialNumToRender: filteredItems.length, keyExtractor: item => item.value.toString(), renderItem: renderItem }));
300
300
  }
301
301
  const virtualizedProps = typeof virtualized === 'object'
302
- ? Object.assign(Object.assign({}, DEFAULT_VIRTUALIZED), virtualized) : Object.assign({}, DEFAULT_VIRTUALIZED);
302
+ ? Object.assign(Object.assign({}, DEFAULT_VIRTUALIZED_PROPS), virtualized) : DEFAULT_VIRTUALIZED_PROPS;
303
303
  return (React.createElement(react_native_1.VirtualizedList, { getItem: (_, index) => filteredItems[index], getItemCount: () => filteredItems.length, keyExtractor: item => item.value.toString(), renderItem: renderItem, initialNumToRender: virtualizedProps.initialNumToRender, maxToRenderPerBatch: virtualizedProps.maxToRenderPerBatch, windowSize: virtualizedProps.windowSize }));
304
304
  };
305
305
  }
306
306
  render() {
307
307
  const { modalOpen, searchText } = this.state;
308
- const { label, items, value, emptyMessage, style, disabledStyle, disabled, labelStyle, inputStyle, nativeID, onPress, icon, searchable } = this.props;
308
+ const { label, items, value, emptyMessage, style, disabledStyle, disabled, labelStyle, inputStyle, nativeID, onPress, icon, searchable, useKeyboardAvoidingView } = this.props;
309
309
  const selectedItem = items.find(x => x.value === value);
310
310
  const styles = this.getStyles();
311
311
  const theme = (0, theme_1.getTheme)();
312
312
  const filteredItems = searchable ? this.filterItems() : items;
313
+ const conteudoModal = (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: react_native_1.Keyboard.dismiss },
314
+ React.createElement(react_native_1.View, { style: [
315
+ styles.modalContainer,
316
+ react_native_1.Platform.OS === 'web' && {
317
+ marginVertical: '10px',
318
+ marginHorizontal: 'auto',
319
+ width: '90%',
320
+ maxWidth: 450,
321
+ maxHeight: 300,
322
+ justifyContent: 'center'
323
+ }
324
+ ] },
325
+ this.shouldDisplaySearchField() && (React.createElement(react_native_1.View, { style: styles.searchContainer },
326
+ React.createElement(react_native_1.View, { style: styles.inputWrapper },
327
+ React.createElement(react_native_1.TextInput, { nativeID: nativeID + '-text-search', style: styles.searchInput, value: searchText, placeholder: searchable && searchable.placeHolder, onChangeText: text => this.setState({ searchText: text }) }),
328
+ React.createElement(FontAwesome_1.default, { name: "search", size: 16, color: "gray", style: styles.searchIcon })))),
329
+ filteredItems.length > 0 ? (this.renderItemsList(filteredItems)) : (React.createElement(react_native_1.View, { style: styles.emptyMessageContainer },
330
+ React.createElement(FontAwesome_1.default, { name: "warning", color: theme.warningColor, size: 24 }),
331
+ React.createElement(react_native_1.Text, { style: styles.modalItem }, emptyMessage))))));
313
332
  return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => __awaiter(this, void 0, void 0, function* () {
314
333
  if (onPress) {
315
334
  const result = yield onPress();
@@ -326,26 +345,7 @@ class DropDown extends React.Component {
326
345
  ] },
327
346
  icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.iconOnLine })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
328
347
  this.renderClosedDropDown(selectedItem, inputStyle),
329
- React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay },
330
- React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: react_native_1.Keyboard.dismiss },
331
- React.createElement(react_native_1.View, { style: [
332
- styles.modalContainer,
333
- react_native_1.Platform.OS === 'web' && {
334
- marginVertical: '10px',
335
- marginHorizontal: 'auto',
336
- width: '90%',
337
- maxWidth: 450,
338
- maxHeight: 300,
339
- justifyContent: 'center'
340
- }
341
- ] },
342
- this.shouldDisplaySearchField() && (React.createElement(react_native_1.View, { style: styles.searchContainer },
343
- React.createElement(react_native_1.View, { style: styles.inputWrapper },
344
- React.createElement(react_native_1.TextInput, { nativeID: nativeID + '-text-search', style: styles.searchInput, value: searchText, placeholder: searchable && searchable.placeHolder, onChangeText: text => this.setState({ searchText: text }) }),
345
- React.createElement(FontAwesome_1.default, { name: "search", size: 16, color: "gray", style: styles.searchIcon })))),
346
- filteredItems.length > 0 ? (this.renderItemsList(filteredItems)) : (React.createElement(react_native_1.View, { style: styles.emptyMessageContainer },
347
- React.createElement(FontAwesome_1.default, { name: "warning", color: theme.warningColor, size: 24 }),
348
- React.createElement(react_native_1.Text, { style: styles.modalItem }, emptyMessage)))))))));
348
+ React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay }, useKeyboardAvoidingView ? (React.createElement(react_native_1.KeyboardAvoidingView, { behavior: react_native_1.Platform.OS === 'ios' ? 'padding' : 'height' }, conteudoModal)) : (conteudoModal)))));
349
349
  }
350
350
  }
351
351
  exports.DropDown = DropDown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "secullum-react-native-ui",
3
- "version": "4.16.2-beta.10",
3
+ "version": "4.16.2-beta.13",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "files": [