score:1
I had the similar issue but I solved my problem by setting a number for the width of textInput. I am not sure if that related to this. But after I checked official docs, it says,
value
The value to show for the text input. TextInput is a controlled component, >which means the native value will be forced to match this value prop if >provided. For most uses, this works great, but in some cases this may cause >flickering - one common cause is preventing edits by keeping value the same. In >addition to simply setting the same value, either set editable={false}, or >set/update maxLength to prevent unwanted edits without flicker.
Good luck!
score:2
An elegant solution to this problem is to NOT continually update the component's state when entering text, but rather update it on submission:
import React from 'react';
import { View } from 'react-native';
const MyComponent = () => {
let textValue;
function onFormSubmitted() {
// do something with textValue, update state
}
return (
<View>
<TextInput
onChangeText={(text) => {
textValue = text;
}}
onEndEditing={onFormSubmitted}
/>
</View>
);
};
export default MyComponent;
The reason for the flickering seems to be to be related to the component's size, and continuous updating of the state may work in small components, but it is wasteful in it's nature. If you're not dependent on real-time filtering of something, it should be completely unnecessary.
Source: stackoverflow.com
Related Query
- TextInput flickering/choppy behaviour on render
- Keeping sticky positioning behaviour when sticky elements are inside a container (because of React having to render a single parent element)
- React svg / png render is flickering on new URL
- Proper way to render content without flickering ? React + Redux + TS
- Weird Reactjs state behaviour when accessing it from outside render
- ReactJS - Does render get called any time "setState" is called?
- React onClick function fires on render
- Scroll to the top of the page after render in react.js
- Render HTML string as real HTML in a React component
- Make React useEffect hook not run on initial render
- Is it possible to return empty in react render function?
- Is it possible to use if...else... statement in React render function?
- Objects are not valid as a React child. If you meant to render a collection of children, use an array instead
- How to loop and render elements in React.js without an array of objects to map?
- How to render react components by using map and join?
- How to create dynamic href in react render function?
- When should you use render and shallow in Enzyme / React tests?
- React doesn't render autocomplete off
- Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- How to render a multi-line text string in React
- Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null
- Access React Context outside of render function
- Functions are not valid as a React child. This may happen if you return a Component instead of from render
- ReactJS render string with non-breaking spaces
- Cannot render boolean value in JSX?
- Uncaught Invariant Violation: Rendered more hooks than during the previous render
- How to render an array of objects in React?
- How can I render repeating React elements?
- Rendering React components with promises inside the render method
- How do I render sibling elements without wrapping them in a parent tag?
More Query from same tag
- How to use props with styled-components in switch statement
- Render div with state only on phones
- How to get data from API and turn it into array list for Google Charts
- Refresh page after and call a function automatically in react
- Add video player to a GLB model with controls
- React global declare variables getting Flow type error
- Why does my React app not re-render or display changes on the DOM except I relaod?
- How to pass the array index value from array mapping to onClick function in React?
- Plot band not limited to xAxis, draws for the whole graph
- How add google font into react-stripe-elements
- How to update the State on a DnD Component
- Error in React Redux: Unhandled Rejection (Error): Actions must be plain objects
- React: how can you share the state between views using react-router?
- React: close other SubMenus when another SubMenu open
- How can I use react-query in a React class component?
- PHP, React, MySQL database contact form error
- × TypeError: Object(...) is not a function. Mern stack post request with fetch not working
- How to see create a page of the details of a single product from an Ecommerce
- How can I set the source of an image dynamically in React native?
- Meteor NodeJs base64 convert back to file
- scalajs-react: Idiomatic way of processing ajax response
- How to prevent focus loss from an element on an Android long press?
- ReactJS - Uncaught Error: Syntax error, unrecognized expression
- Storing component into a variable and reuse it
- Not able to setValue in useState in React Material-UI
- How to limit reactjs useContext for only some routes from react-router
- I try to implement a connection using relay and all the node's IDs are the same
- Reactjs frontend gets error when backend runs
- React-bootstrap Modal is not popping up onClick of function
- Iterate a setState with an index in React JS