Skip to content

Commit

Permalink
Merge pull request #1304 from openmsupply/#1298-dismiss-keyboard
Browse files Browse the repository at this point in the history
#1298 Keyboard dismissing
  • Loading branch information
josh-griffin authored Sep 23, 2019
2 parents 5d30318 + e901995 commit e5a79c2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/widgets/DataTablePageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,27 @@

import React from 'react';
import PropTypes from 'prop-types';
import { View } from 'react-native';
import { View, Keyboard, TouchableWithoutFeedback } from 'react-native';

import { newPageStyles } from '../globalStyles';

const { newPageContentContainer, newContainer } = newPageStyles;

const dismiss = () => Keyboard.dismiss();
/**
* Simple container for a standard data table page.
* Simple template container for a standard data table page.
* Handles placement of content and wraps the page with a
* Touchable, dismissing the keyboard when an event propogates
* to this level.
*/
export const DataTablePageView = props => {
const { children } = props;
return (
<View style={newPageContentContainer}>
<View style={newContainer}>{children}</View>
</View>
<TouchableWithoutFeedback onPress={dismiss}>
<View style={newPageContentContainer}>
<View style={newContainer}>{children}</View>
</View>
</TouchableWithoutFeedback>
);
};

Expand Down

0 comments on commit e5a79c2

Please sign in to comment.