Skip to content

Commit d8dd271

Browse files
author
Luke Brandon Farrell
authored
Merge pull request #11 from leonardoballand/patch-2
Patch 2
2 parents 742b875 + d43823f commit d8dd271

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ The `<VirtualKeyboard />` uses two arrays to allow you to set keys and define cu
6868
| keyTextStyle | object | Yes | See VirtualKeyboard.js | Style applied to the text inside each key. |
6969
| keyImageStyle | object | Yes | See VirtualKeyboard.js | Style applied to image in a key. If an image is passed. |
7070
| messageStyle | object | Yes | See VirtualKeyboard.js | Style applied to popup error. Can set the background colour here. |
71-
| messageTextStyle| object | Yes | See VirtualKeyboard.js | Style applied to the text inside the popup error.
71+
| messageTextStyle| object | Yes | See VirtualKeyboard.js | Style applied to the text inside the popup error.
72+
| messageTestID| string | Yes | "MessageContainer" | TestID belonging to the view component of the popup error.
73+
| messageTextTestID| string | Yes | "Message" | TestID belonging to the text component inside the popup error.
7274

7375
## Contributing
7476

VirtualKeyboard.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,19 @@ class VirtualKeyboard extends Component {
116116
const {
117117
// Style Props
118118
messageStyle,
119-
messageTextStyle
119+
messageTextStyle,
120+
// TestID Props
121+
messageTestID,
122+
messageTextTestID,
120123
} = this.props;
121124

122125
// State
123126
const { message } = this.state;
124127

125128
if (message) {
126129
return (
127-
<View style={[messageDefaultStyle, messageStyle]}>
128-
<Text style={[messageTextDefaultStyle, messageTextStyle]}>{message}</Text>
130+
<View testID={`VirtualKeyboard-${messageTestID}`} style={[messageDefaultStyle, messageStyle]}>
131+
<Text testID={`VirtualKeyboard-${messageTextTestID}`} style={[messageTextDefaultStyle, messageTextStyle]}>{message}</Text>
129132
</View>
130133
);
131134
}
@@ -218,6 +221,7 @@ class VirtualKeyboard extends Component {
218221
} else {
219222
return (
220223
<View
224+
testID={`VirtualKeyboard-${entity}-disabled`}
221225
key={column}
222226
style={[
223227
keyContainerStyle,
@@ -315,7 +319,10 @@ VirtualKeyboard.propTypes = {
315319
keyTextStyle: ViewPropTypes.style,
316320
keyImageStyle: ViewPropTypes.style,
317321
messageStyle: ViewPropTypes.style,
318-
messageTextStyle: ViewPropTypes.style
322+
messageTextStyle: ViewPropTypes.style,
323+
// TestID props
324+
messageTestID: PropTypes.string,
325+
messageTextTestID: PropTypes.string,
319326
};
320327

321328
VirtualKeyboard.defaultProps = {
@@ -326,6 +333,8 @@ VirtualKeyboard.defaultProps = {
326333
keyboardMessageDisplayTime: 3000,
327334
onPressFunction: 'onPressIn',
328335
vibration: false,
336+
messageTestID: 'MessageContainer',
337+
messageTextTestID: 'Message',
329338
};
330339

331340
const styles = StyleSheet.create({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-screen-keyboard",
3-
"version": "1.2.0",
3+
"version": "1.2.3",
44
"description": "On-screen keyboard with customisable keys and tactile / UI feedback 📱",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)