Comments (4)
I don't believe this error should exist. The TextInput component itself provides the ref property. I've encountered this warning in many mature libraries, which makes me doubt its necessity. Do you have any suggestions for eliminating this warning in the example I provided? @cortinico
from react-native.
Newer Version of React Native is Available! | |
---|---|
ℹ️ | You are on a supported minor version, but it looks like there's a newer patch available - 0.74.2. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
from react-native.
ERROR Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
The error message is pretty self-explanatory. What is not clear about it?
from react-native.
It should be written like this
import { TextInput } from 'react-native'
import { useRef } from 'react'
import { View } from 'react-native'
export default function Component() {
const textRef = useRef<TextInput>(null)
return (
<View>
<TextInput ref={textRef} />
</View>
)
}
from react-native.
Related Issues (20)
- Crash on scrolling inside <Animated.Scrollview ../> : java.lang.NoSuchMethodError: No virtual method reversed() HOT 1
- [A11y][iOS] - VoiceOver reads first letter separately from other text in multiline textInput on legacy architecture
- Image component returns different data between iOS and Android in onLoad prop HOT 1
- [0.75.0-rc.2]: npm error when running npx react-native@next init HOT 8
- `KeyboardAvoidingView` infinitely updates on Android HOT 1
- Unable to parse @ReactMethod annotations from native module HOT 2
- `TextInput.onKeyPress`: `nativeEvent.key` is an empty string when a non-ASCII character is entered HOT 3
- RN 0.74 Using React Native FlatList with Socket Data Poblem HOT 2
- [Android] Build From Source failing on 0.75.0-rc.2 HOT 3
- Problem with the screen being cut up and down HOT 2
- Could not find generated setter for class com.facebook.react.views HOT 2
- Memory Leak with latest React Native Integrated App on v0.74.2 HOT 6
- autolinkLibrariesFromCommand fails if a library does not contain an android specific config
- ScrollView sticky header does not show on scroll up with props stickyHeaderOnScroll and contentInset
- React Native 0.74.2 yarn lifecycle method is not called after running 'yarn install' HOT 1
- [Android] SectionList stickySectionHeadersEnabled not working correctly in New Architecture when using Animated
- [Bridgeless][IOS] `bridge` is `nil` on Swift when NewArch is enabled
- [0.75.x] react-native init broken with --template HOT 3
- Touchable focus events not triggering with keyboard (needed for accessibility)
- Add support for textAlign:start/end
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native.