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

Seamless Multiline autogrow textinput support in react native web #2770

Open
1 task done
vishnuc opened this issue Mar 26, 2025 · 0 comments
Open
1 task done

Seamless Multiline autogrow textinput support in react native web #2770

vishnuc opened this issue Mar 26, 2025 · 0 comments
Labels
enhancement Requires extension or creation of new React Native API

Comments

@vishnuc
Copy link

vishnuc commented Mar 26, 2025

Is there an existing request?

  • I have searched for this request

Describe the feature request

I have below component , which is initially 48px height and when i type multiple lines it goes upto 200px , in native devices like ios and android.. But this autogrow is not working web , same code.Can we do something about it. please watch the video - https://www.youtube.com/watch?v=tLq2z6MhBqE

const GrowingTextInput = ({
  style,
  containerStyle,
  placeholder = "Type here...",
  value,
  onChangeText,
}: Props) => {
  const [inputValue, setInputValue] = useState(value || "");
  const [inputHeight, setInputHeight] = useState(styles.input.minHeight);

  const handleChangeText = (text: string) => {
    setInputValue(text);
    onChangeText?.(text);
  };

  return (
    <View style={[styles.container, containerStyle]}>
      <TextInput
        multiline={true}
        style={{
          color: "white",
          flex: 1,
          alignSelf: "flex-end",
          minHeight: 48,
          maxHeight: 300,
          verticalAlign: "bottom",
        }}
        placeholder="Type Your Message"
      />
    </View>
  );
};

[](url)

const styles = StyleSheet.create({
  container: {
    borderWidth: 1,
    borderColor: "lightgrey",
    flexDirection: "row",
    backgroundColor: "transparent",
  },
  input: {
    minHeight: 40,
    maxHeight: 500,
    flex: 1,
    paddingHorizontal: 12,
    backgroundColor: "#F0F0F0",
    borderStyle: "solid",
    borderWidth: 1,
    borderColor: "lightgrey",
    borderRadius: 25,
    fontSize: 16,
    padding: 10,
  },
});

export default GrowingTextInput;

@vishnuc vishnuc added the enhancement Requires extension or creation of new React Native API label Mar 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requires extension or creation of new React Native API
Projects
None yet
Development

No branches or pull requests

1 participant