ソースを参照

android onAppear

Daniel Zlotin 8 年 前
コミット
ce47fb3d90
共有1 個のファイルを変更した4 個の追加1 個の削除を含む
  1. 4
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java

+ 4
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java ファイルの表示

14
 	private final String id;
14
 	private final String id;
15
 	private View view;
15
 	private View view;
16
 	private StackController parentStackController;
16
 	private StackController parentStackController;
17
+	private boolean appeared = false;
17
 
18
 
18
 	public ViewController(Activity activity, String id) {
19
 	public ViewController(Activity activity, String id) {
19
 		this.activity = activity;
20
 		this.activity = activity;
67
 
68
 
68
 	@Override
69
 	@Override
69
 	public void onGlobalLayout() {
70
 	public void onGlobalLayout() {
70
-		if (getView().isShown())
71
+		if (!appeared && getView().isShown()) {
72
+			appeared = true;
71
 			onAppear();
73
 			onAppear();
74
+		}
72
 	}
75
 	}
73
 }
76
 }