react-native-dialog-input icon indicating copy to clipboard operation
react-native-dialog-input copied to clipboard

Clicking one of the buttons when keyboard is up

Open aktiwers opened this issue 5 years ago • 5 comments

When clicking on one of the buttons while keyboard is up (only tested on android), it simply closes the keyboard. Resulting in having to click again to hit the actual button.

Any workaround for this?

aktiwers avatar Aug 24 '19 13:08 aktiwers

I'd like to know if there is a workaround for this also

mkhoussid avatar Oct 07 '19 06:10 mkhoussid

Figured it out.

Look for the ScrollView element that has the Dialogue element as its child, nested component.

Set,

    <ScrollView
      keyboardShouldPersistTaps="handled"
      {...props}>
     .  .  .  .  .  .
     <Dialogue {...props} />
     .  .  .  .  .  .

The issue is that the ScrollView is consuming the tap, passing the keyboardShouldPersistTaps prop fixes it.

mkhoussid avatar Oct 10 '19 10:10 mkhoussid

Thanks @mkhoussid I will try this later today!

aktiwers avatar Oct 10 '19 11:10 aktiwers

It works! Thank you @mkhoussid But when keyboard is up - it is quite difficult to hit the button at first try. Do you experience that? It is possible to hit it, but it seams easier to hit on 2. try (when keyboard is down).

aktiwers avatar Oct 11 '19 17:10 aktiwers

Keyboard being up or down isn't the issue. Try this:

          <TouchableOpacity
            onPress={() =>{alert("pressed!")}}
          >
            <View style={styles.myStyle}>
              // This is an example of an icon I use,
              // but you could use any other icon
              <Icon
                name="md-add"
                type="ionicon"
              />
            </View>
          </TouchableOpacity>

Let me know if that works. Or when you say "it is difficult to hit the button", you mean it's already a <Button /> element and it's hard to hit?

mkhoussid avatar Oct 11 '19 21:10 mkhoussid