Relative Content

Tag Archive for javascriptreactjsreact-native

Unable to add text into TextInput using React JS

I recently started working with react.js and wanted to build a simple form. For some reason, I am unable to enter text into my text input. I have already tried troubleshooting with print statements and checking for errors but the terminal is not giving me print statements or errors. Any help would be appreciated.

My textInput keeps refreshing when I type into it

I have a TextInput in my React native project. I use an onCHangeText={(text)=>handleChange(‘postText’, text)} function to update the formData that I had set as a State Object at the beginning of the function. The result I get is whenever I type, the app restarts and refreshes, deleting former content and only writing the latest character to the text field. Worse, it hides the keypad altogether.

My textInput keeps refreshing when I type into it

I have a TextInput in my React native project. I use an onCHangeText={(text)=>handleChange(‘postText’, text)} function to update the formData that I had set as a State Object at the beginning of the function. The result I get is whenever I type, the app restarts and refreshes, deleting former content and only writing the latest character to the text field. Worse, it hides the keypad altogether.

My textInput keeps refreshing when I type into it

I have a TextInput in my React native project. I use an onCHangeText={(text)=>handleChange(‘postText’, text)} function to update the formData that I had set as a State Object at the beginning of the function. The result I get is whenever I type, the app restarts and refreshes, deleting former content and only writing the latest character to the text field. Worse, it hides the keypad altogether.

How to add “…” in the middle when text more than 2 line in ReactJS

I want to display when text <=2 lines, then display 2 lines without “…”.
However, if the text is > 2 lines, then add “…” in the middle.
In my code, i can add “…” in the middle, but when the text is less than or equal to 2 lines it still displays “…”. I want is that when text <= 2 lines it still displays full text, and if text > 2 then displays “…” in the middle.
this is my code: