Quantcast
Channel: blur by tapping outside of it, doesn't work in react native - Stack Overflow
Viewing all articles
Browse latest Browse all 2

blur by tapping outside of it, doesn't work in react native

$
0
0

I have <TextInput/> and I would like to get to blur it and toggle the keyboard when tapping outside the <TextInput/> I have tried this solution but without any luck.

import React, { Component } from 'react'; import { AppRegistry, Dimensions, StyleSheet, Text, TouchableHighlight, View, Image, TextInput, ScrollView, Keyboard, TouchableWithoutFeedback } from 'react-native'; import { Button } from 'react-native-elements'; class CounterextendsComponent {

  render() {
    return (
      <View
        style={styles.container}
        onPress={this.focusOff}
      >
        <TouchableWithoutFeedback onPress={Keyboard.dismiss} accessible={false}>
          <View>
            <TextInput
              ref="numberInput"
              id={this.props.id}
              style={styles.title}
              keyboardType='numeric'
              maxLength={2}
              value={this.state.keys.toString()}
              onChange={(event) => this.updateKeysWithInputHandler(event.nativeEvent.text)}
            />
          </View>
        </TouchableWithoutFeedback>
      </View>
    );
  }
}

Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images