Crash: null object reference on init
See original GitHub issueHey,
We’re seeing the crashes using latest beta (with RN 0.51.1). Seems to be a race condition on init, let me know if you need more info. Using .beta8
.
This code crashes:
class App extends React.Component<{}> {
render() {
return (
<CoordinatorLayout style={{flex: 1}}>
<BottomSheetBehavior
peekHeight={70}
hideable={false}
state={BottomSheetBehavior.STATE_COLLAPSED}
>
<View style={{backgroundColor: '#4389f2'}}>
<View style={{padding: 26}}>
<Text>BottomSheetBehavior!</Text>
</View>
<View style={{height: 200, backgroundColor: '#fff'}} />
</View>
</BottomSheetBehavior>
</CoordinatorLayout>
);
}
}
export default App;
This code works:
class App extends React.Component<{}> {
constructor() {
super();
this.state = {
ok: false,
}
}
componentDidMount() {
setTimeout(() => this.setState({ok: true}), 5000);
}
render() {
return (
<CoordinatorLayout style={{flex: 1}}>
{this.state.ok && (
<BottomSheetBehavior
peekHeight={70}
hideable={false}
state={BottomSheetBehavior.STATE_COLLAPSED}
>
<View style={{backgroundColor: '#4389f2'}}>
<View style={{padding: 26}}>
<Text>BottomSheetBehavior!</Text>
</View>
<View style={{height: 200, backgroundColor: '#fff'}} />
</View>
</BottomSheetBehavior>
)}
</CoordinatorLayout>
);
}
}
Stack:
Attempt to invoke virtual method 'void android.support.v4.widget.ViewDragHelper.process TouhEnvent(android.view.MotionEvent)' on a null object reference
onTouchEvent
RnBottomSheetBehavior.java:273
resetTouchBehaviors
CoordinatorLayout.java:396
onAttachedToWindow
CoordinatorLayout.java:238
dispatchAttachedToWindow
View.java:16638
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Null Object Reference: Application Crashing - Stack Overflow
I am having problems with my application as it always crash but I'm unsure of how to go about fixing it. Any help...
Read more >Crash in java.lang.NullPointerException - Bugzilla@Mozilla
Crash in java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.view.View.getContext()' on a null object reference at ...
Read more >Crash in ListView (Null object reference)
My app crashed and this is the logcat output. It appears to be an issue in the ListView item selection code. Hmm.
Read more >Null Reference Exceptions - Unity - Manual
NullReferenceException happens when your script code tries to use a variable which isn't set (referencing) and object. The error message that appears tells...
Read more >Crashes | Android Developers
As a best practice, make sure you address the null case for a nullable object, or your app could get into unexpected states....
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 Free
Top 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
Shipped at
1.0.0
I’ve successfully reproduced your problem when i compiled with 27, i applied @FlorianBergmann patch and worked.
i will make a new release soon.