react-native-navigation icon indicating copy to clipboard operation
react-native-navigation copied to clipboard

Attempt to invoke virtual method 'void com.reactnativenavigation.viewcontrollers.ViewController.onViewWillAppear()' on a null object reference

Open equesteo opened this issue 8 years ago • 12 comments

Issue Description

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.reactnativenavigation.viewcontrollers.ViewController.onViewWillAppear()' on a null object reference

Steps to Reproduce / Code Snippets / Screenshots

Switch between screens:

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.reactnativenavigation.viewcontrollers.ViewController.onViewWillAppear()' on a null object reference
    at com.reactnativenavigation.viewcontrollers.stack.StackController.pop(StackController.java:203)
    at com.reactnativenavigation.viewcontrollers.stack.StackController.onNavigationButtonPressed(StackController.java:318)
    at com.reactnativenavigation.viewcontrollers.stack.StackController.bridge$lambda$0$StackController(StackController.java)
    at com.reactnativenavigation.viewcontrollers.stack.StackController$$Lambda$0.onPress
    at com.reactnativenavigation.viewcontrollers.TitleBarButtonController.lambda$null$0$TitleBarButtonController(TitleBarButtonController.java:102)
    at com.reactnativenavigation.viewcontrollers.TitleBarButtonController$$Lambda$3.onClick
    at android.view.View.performClick(View.java:5637)
    at android.view.View$PerformClick.run(View.java:22433)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6186)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

Environment

  • React Native Navigation version: 2.0.2544
  • React Native version: 55.4
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Device, 7.1.2, Release

equesteo avatar Sep 18 '18 01:09 equesteo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest version and report back. Thank you for your contributions.

stale[bot] avatar Nov 02 '18 01:11 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Nov 26 '18 17:11 stale[bot]

save issues

a396901990 avatar Jan 09 '19 11:01 a396901990

same issue here image

mu-dawood avatar Feb 12 '19 18:02 mu-dawood

Also having this issue

  • React Native Navigation version: 2.1.3
  • React Native version: 57.5
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): All android devices, both debug and release

Rigellute avatar Feb 22 '19 10:02 Rigellute

I can also reproduce this in 2.12.0.

In my case this is reproduceable by simply doing the same push -> push -> pop -> pop 3-4 times

Rigellute avatar Feb 22 '19 11:02 Rigellute

same here

leolusoli avatar Mar 12 '19 11:03 leolusoli

In my case I was defining a route id, so whenever a route with the same id is pushed several times into the stack caused me to get such an error when doing pop. Not defining the route id fixed it for me.

shuuha avatar Mar 24 '19 09:03 shuuha

In my case I was defining a route id, so whenever a route with the same id is pushed several times into the stack caused me to get such an error when doing pop. Not defining the route id fixed it for me.

Can you explain what do you mean by route id?

erezbiez avatar Apr 29 '19 21:04 erezbiez

Still an issue

Dantalion avatar May 13 '19 14:05 Dantalion

It seems that trying to pop a screen that got pushed multiple times is indeed the issue @shuuha. In my case it was enough to pop the screen once every time before re pushing it.

Dantalion avatar May 13 '19 15:05 Dantalion

In my case I was defining a route id, so whenever a route with the same id is pushed several times into the stack caused me to get such an error when doing pop. Not defining the route id fixed it for me.

Can you explain what do you mean by route id?

Navigation.push(componentId, { component: { // id: SOME_SCREEN, <-- this is the route id shuuha is talking abt name: SOME_SCREEN } });


it fixed for me too..

NihaalAftab avatar May 24 '19 05:05 NihaalAftab