Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
Assertions.assertNotNull(mDoubleTapReloadRecognizer)
.didDoubleTapR(keyCode, mActivity.getCurrentFocus());
if (didDoubleTapR) {
getReactNativeHost().getReactInstanceManager().getDevSupportManager().handleReloadJS();
getReactNativeHost().getReactInstanceManager().getDevSupportManager().reloadExpoApp();
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ private enum ErrorType {
private static final String EXOPACKAGE_LOCATION_FORMAT =
"/data/local/tmp/exopackage/%s//secondary-dex";

public static final String EMOJI_HUNDRED_POINTS_SYMBOL = " \uD83D\uDCAF";
public static final String EMOJI_FACE_WITH_NO_GOOD_GESTURE = " \uD83D\uDE45";
public static String EMOJI_HUNDRED_POINTS_SYMBOL = " 💯";
public static String EMOJI_FACE_WITH_NO_GOOD_GESTURE = " 🙅";

private final List<ExceptionLogger> mExceptionLoggers = new ArrayList<>();

Expand Down Expand Up @@ -424,6 +424,26 @@ public void run() {
});
}

private int getExponentActivityId() {
return -1;
}

@Override
public void reloadExpoApp() {
try {
Class.forName("host.exp.exponent.ReactNativeStaticHelpers").getMethod("reloadFromManifest", int.class).invoke(null, getExponentActivityId());
} catch (Exception expoHandleErrorException) {
expoHandleErrorException.printStackTrace();

// reloadExpoApp replaces handleReloadJS in some places
// where in Expo we would like to reload from manifest.
// If so, if anything goes wrong here, we can fall back
// to plain JS reload.
handleReloadJS();
}
}


@Override
public void showDevOptionsDialog() {
if (mDevOptionsDialog != null || !mIsDevSupportEnabled || ActivityManager.isUserAMonkey()) {
Expand All @@ -445,7 +465,10 @@ public void onOptionSelected() {
.show();
mDevSettings.setHotModuleReplacementEnabled(false);
}
handleReloadJS();

// NOTE(brentvatne): rather than reload just JS we need to reload the entire project from manifest
// handleReloadJS();
reloadExpoApp();
}
});
options.put(
Expand All @@ -463,7 +486,7 @@ public void onOptionSelected() {
handleReloadJS();
}
});
if (mDevSettings.isNuclideJSDebugEnabled()) {
expo_transformer_remove: if (mDevSettings.isNuclideJSDebugEnabled()) {
options.put(
mApplicationContext.getString(R.string.reactandroid_catalyst_debug_nuclide),
new DevOptionHandler() {
Expand All @@ -473,7 +496,8 @@ public void onOptionSelected() {
}
});
}
options.put(
// NOTE(brentvatne): This option does not make sense for Expo
expo_transformer_remove: options.put(
mApplicationContext.getString(R.string.reactandroid_catalyst_change_bundle_location),
new DevOptionHandler() {
@Override
Expand Down Expand Up @@ -537,7 +561,7 @@ public void onOptionSelected() {
mCurrentContext.getJSModule(HMRClient.class).disable();
}
}
if (nextEnabled && !mDevSettings.isJSDevModeEnabled()) {
expo_transformer_remove: if (nextEnabled && !mDevSettings.isJSDevModeEnabled()) {
Toast.makeText(
mApplicationContext,
mApplicationContext.getString(R.string.reactandroid_catalyst_hot_reloading_auto_enable),
Expand All @@ -549,7 +573,7 @@ public void onOptionSelected() {
}
});

options.put(
expo_transformer_remove: options.put(
mIsSamplingProfilerEnabled
? mApplicationContext.getString(R.string.reactandroid_catalyst_sample_profiler_disable)
: mApplicationContext.getString(R.string.reactandroid_catalyst_sample_profiler_enable),
Expand Down Expand Up @@ -579,7 +603,7 @@ public void onOptionSelected() {
mDevSettings.setFpsDebugEnabled(!mDevSettings.isFpsDebugEnabled());
}
});
options.put(
expo_transformer_remove: options.put(
mApplicationContext.getString(R.string.reactandroid_catalyst_settings),
new DevOptionHandler() {
@Override
Expand Down Expand Up @@ -838,6 +862,7 @@ public void onInternalSettingsChanged() {
reloadSettings();
}

// NOTE(brentvatne): this is confusingly called the first time the app loads!
@Override
public void handleReloadJS() {

Expand Down Expand Up @@ -1180,6 +1205,7 @@ public void run() {
});
}

// NOTE(brentvatne): this is confusingly called the first time the app loads!
private void reload() {
UiThreadUtil.assertOnUiThread();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ public void reloadSettings() {}
@Override
public void handleReloadJS() {}


@Override
public void reloadExpoApp() {}

@Override
public void reloadJSFromServer(String bundleURL) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ protected RedBoxDialog(
new View.OnClickListener() {
@Override
public void onClick(View v) {
mDevSupportManager.handleReloadJS();
mDevSupportManager.reloadExpoApp();
}
});
mDismissButton = (Button) findViewById(R.id.rn_redbox_dismiss_button);
Expand Down Expand Up @@ -303,7 +303,7 @@ public boolean onKeyUp(int keyCode, KeyEvent event) {
return true;
}
if (mDoubleTapReloadRecognizer.didDoubleTapR(keyCode, getCurrentFocus())) {
mDevSupportManager.handleReloadJS();
mDevSupportManager.reloadExpoApp();
}
return super.onKeyUp(keyCode, event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public interface DevSupportManager extends NativeModuleCallExceptionHandler {

void handleReloadJS();

void reloadExpoApp();

void reloadJSFromServer(final String bundleURL);

void isPackagerRunning(PackagerStatusCallback callback);
Expand Down