Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyboardAvoidingView (behaviour = height) - wrong size when switching keyboards #35764

Closed
dranitski opened this issue Jan 2, 2023 · 12 comments
Closed
Labels
API: Keyboard Component: KeyboardAvoidingView Component: Switch Needs: Triage 🔍 Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@dranitski
Copy link

dranitski commented Jan 2, 2023

Description

Demonstration:
191499509-b41280a0-2969-4fe6-8796-c5695b999f27

Problem:
When switching keyboards (ABC, emoji, gif, etc) on IOS and Android in behaviour: height mode the size of component is incorrect.

Version

0.70.5

Output of npx react-native info

info Fetching system and libraries information...
System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 18.64 GB / 31.20 GB
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.12.1 - /usr/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.2.0 - /usr/bin/npm
    Watchman: Not Found
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.5 => 0.70.5 
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

please look at code provided. Focus on TextInput and then switch keyboards (ABC, emoji, gif, etc)

Snack, code example, screenshot, or link to a repository

Repro:

import { StatusBar } from "expo-status-bar";
import React from "react";
import {
  KeyboardAvoidingView,
  StyleSheet,
  Text,
  TextInput,
  View,
} from "react-native";

export default function App() {
  return (
    <KeyboardAvoidingView style={styles.container} behavior="height">
      <Text>Open up App.js to start working on your app!</Text>
      <StatusBar style="auto" />
      <TextInput style={{ backgroundColor: "red", width: "100%" }} />
    </KeyboardAvoidingView>
  );
}

const styles = StyleSheet.create({
  container: {
    padding: 32,
    flex: 1,
    backgroundColor: "#fff",
    alignItems: "center",
    justifyContent: "space-between",
  },
});
@dranitski
Copy link
Author

Linked issues and PRs:
#35213
#34749

@pfulop
Copy link
Contributor

pfulop commented Jan 6, 2023

Interesting. We're running 0.70.6 and don't see the issue. Mind checking in npm modules if my fix is present?

@dranitski
Copy link
Author

@pfulop just updated my expo app to 0.70.6 and still can reproduce the issue.

I looked at react-native repo - in 0.70.6 your fix is not present at all!

Just compare:

@pfulop
Copy link
Contributor

pfulop commented Jan 6, 2023

@dranitski Now I see. I see it locally because the patch I made for our project is still being applied during installation.

But indeed, it's in Main but not in the latest release. I guess this is a better question for maintainers.

@dranitski
Copy link
Author

@pfulop maybe they will faster react on PR then Issue? Do you have a minute to re-create your PR?

@pfulop
Copy link
Contributor

pfulop commented Jan 6, 2023

@dranitski The change is present in the main. So the PR would be empty.

@dranitski
Copy link
Author

@pfulop thanks, now I see it. Thanks for your time. I dont know what else can we do to escalate the issue. Will just wait 🫖

@dranitski
Copy link
Author

@novirusallowed
Copy link

Same issue here and it's getting very annoying.
Every time I switch the keyboard to symbols/emoji or any other and then switch back to letters, the height gets completely miscalculated.

Is there any quick fix for this?

@camilossantos2809
Copy link

I usually use android:windowSoftInputMode="adjustResize" in AndroidManifest.xml and behavior={Platform.OS === "ios" ? "padding" : undefined} in KeyboardAvoidingView.
Does this help your situation?

Copy link

github-actions bot commented Nov 9, 2023

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 9, 2023
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Keyboard Component: KeyboardAvoidingView Component: Switch Needs: Triage 🔍 Platform: Linux Building on Linux. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

5 participants