-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure appLaunched event is emitted only when app is resumed
Under certain conditions, app launched event was emitted when the Android Activity isn't in resumed state. In this case, setting root isn't possible since ReactContext doesn't have an instance of the Activity (it can even be destroyed). This PR ensures the event is emitted only when the Activity is resumed and root can be set.
- Loading branch information
Showing
10 changed files
with
253 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...roid/app/src/main/java/com/reactnativenavigation/react/LifecycleEventListenerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.reactnativenavigation.react; | ||
|
||
import com.facebook.react.bridge.LifecycleEventListener; | ||
|
||
public class LifecycleEventListenerAdapter implements LifecycleEventListener { | ||
@Override | ||
public void onHostResume() { | ||
|
||
} | ||
|
||
@Override | ||
public void onHostPause() { | ||
|
||
} | ||
|
||
@Override | ||
public void onHostDestroy() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 20 additions & 10 deletions
30
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationPackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,40 @@ | ||
package com.reactnativenavigation.react; | ||
|
||
import android.support.annotation.NonNull; | ||
|
||
import com.facebook.react.ReactNativeHost; | ||
import com.facebook.react.ReactPackage; | ||
import com.facebook.react.bridge.NativeModule; | ||
import com.facebook.react.bridge.ReactApplicationContext; | ||
import com.facebook.react.uimanager.ViewManager; | ||
import com.reactnativenavigation.parse.LayoutFactory; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
public class NavigationPackage implements ReactPackage { | ||
|
||
private ReactNativeHost reactNativeHost; | ||
private ReactNativeHost reactNativeHost; | ||
|
||
@SuppressWarnings("WeakerAccess") | ||
@SuppressWarnings("WeakerAccess") | ||
public NavigationPackage(final ReactNativeHost reactNativeHost) { | ||
this.reactNativeHost = reactNativeHost; | ||
} | ||
this.reactNativeHost = reactNativeHost; | ||
} | ||
|
||
@Override | ||
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) { | ||
return Collections.singletonList(new NavigationModule(reactContext, reactNativeHost.getReactInstanceManager())); | ||
} | ||
@NonNull | ||
@Override | ||
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) { | ||
return Collections.singletonList(new NavigationModule( | ||
reactContext, | ||
reactNativeHost.getReactInstanceManager(), | ||
new LayoutFactory(reactNativeHost.getReactInstanceManager()) | ||
) | ||
); | ||
} | ||
|
||
@Override | ||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
@NonNull | ||
@Override | ||
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) { | ||
return Collections.singletonList(new ElementViewManager()); | ||
} | ||
} |
Oops, something went wrong.