TypeError: null is not an object (evaluating '_ref.props')
See original GitHub issueEnvironment
iOS 14.3
React-Native: 62.2.0
react-native-community/viewpager: ^5.0.11
Description
I am rendering a simple ViewPager component that is throwing this error on the iOS simulator.
TypeError: null is not an object (evaluating '_ref.props')
Reproducible Demo
const RenderViewPage = () => {
let pager = React.createRef();
let activeSlide = 0;
return (
<ViewPager
requestAnimationFrame={() => pager.current?.setPage(activeSlide)}
ref={pager}
onPageSelected={(e) => setActiveSlide(e.nativeEvent.position)}
orientation="vertical"
style={{
height: Metrics.screenHeight,
width: Metrics.screenWidth
}}
initialPage={0}>
<View></View>
</ViewPager>
)
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
ref prop is not passed, TypeError: null is not an object ...
The ref is not inside of props . When using ref as a prop, the FunctionComponents should be created with forwardRef() which takes...
Read more >How to Fix TypeError: Null is Not an Object in JavaScript
The JavaScript error TypeError: null is not an object occurs when a property is accessed or a method is called on a null...
Read more >TypeError: null is not an object - Laracasts
Currently I get an error of "TypeError: null is not an object (evaluating 'this.booking.id')" .
Read more >null is not an object (evaluating 'inputRef.current.focus')-React ...
Coding example for the question ref prop is not passed, TypeError: null is not an object (evaluating 'inputRef.current.focus')-React Native.
Read more >I get this typeerror:null is not an object(evaluating scene.props)
I get this typeerror:null is not an object(evaluating scene.props) · Move data fetching code or side effects to componentDidUpdate. · If you're ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, Solution you can find here: https://github.com/callstack/react-native-viewpager/tree/master/example
try adding if(!child){ return} in utils.tsx file of this library in node_modules