Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MM-34585 Use removeClippedSubviews from Lists to improve scroll perf #5199

Merged
merged 5 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,14 @@ workflows:
- test
filters:
branches:
only: /^build-pr-.*/
only: /^(build|android)-pr-.*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this PR be reverted at some point? If so, consider having these changes in a separate PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to keep this, that way if a PR fails for a particular platform we can just build the platform that we need

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yea, I meant that this specific change can be in a separate PR if you foresee the FPS changes being reverted in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe ;)

- build-ios-pr:
context: mattermost-mobile-ios-pr
requires:
- test
filters:
branches:
only: /^build-pr-.*/
only: /^(build|ios)-pr-.*/

- build-android-unsigned:
context: mattermost-mobile-unsigned
Expand Down
56 changes: 56 additions & 0 deletions android/app/src/main/java/com/mattermost/rnbeta/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
package com.mattermost.rnbeta;

import android.content.Context;
import android.os.Bundle;
import androidx.annotation.Nullable;

import android.view.Display;
import android.view.KeyEvent;
import android.content.res.Configuration;
import android.view.Window;
import android.view.WindowManager;

import com.reactnativenavigation.NavigationActivity;
import com.github.emilioicai.hwkeyboardevent.HWKeyboardEventModule;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Optional;

public class MainActivity extends NavigationActivity {
private boolean HWKeyboardConnected = false;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setFrameRate();
setContentView(R.layout.launch_screen);
setHWKeyboardConnected();
}
Expand Down Expand Up @@ -47,4 +58,49 @@ public boolean dispatchKeyEvent(KeyEvent event) {
private void setHWKeyboardConnected() {
HWKeyboardConnected = getResources().getConfiguration().keyboard == Configuration.KEYBOARD_QWERTY;
}

protected void setFrameRate() {
ArrayList<HashMap<String, Object>> supported = getSupportedModes();
boolean seen = false;
HashMap<String, Object> best = null;
for (HashMap<String, Object> stringObjectHashMap : supported) {
Float refreshRate = (Float)stringObjectHashMap.getOrDefault("refreshRate", 0f);
if (!seen || Math.round(refreshRate) == 60) {
seen = true;
best = stringObjectHashMap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just break out of the for loop after setting best.

}
}

if (best != null && best.get("id") != null) {
final Window window = this.getWindow();
final WindowManager.LayoutParams params = window.getAttributes();
params.preferredDisplayModeId =(int)best.get("id");
window.setAttributes(params);
}
}

protected ArrayList<HashMap<String, Object>> getSupportedModes() {
final ArrayList<HashMap<String, Object>> ret = new ArrayList<>();
final WindowManager windowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
final Display display = windowManager.getDefaultDisplay();
final Display.Mode[] modes = display.getSupportedModes();
if (modes == null) {
return ret;
}

final Window window = this.getWindow();
final WindowManager.LayoutParams params = window.getAttributes();
final int selectedMode = params.preferredDisplayModeId;

for (final Display.Mode mode : modes) {
final HashMap<String, Object> item = new HashMap<>();
item.put("id", mode.getModeId());
item.put("width", mode.getPhysicalWidth());
migbot marked this conversation as resolved.
Show resolved Hide resolved
item.put("height", mode.getPhysicalHeight());
item.put("refreshRate", mode.getRefreshRate());
item.put("selected", mode.getModeId() == selectedMode);
ret.add(item);
}
return ret;
}
}
27 changes: 21 additions & 6 deletions app/utils/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,31 @@ export function openGalleryAtIndex(index, files) {
push: {
waitForRender: true,
sharedElementTransitions,
...Platform.select({ios: {
content: contentPush,
}}),
},
pop: {
content: contentPop,
},
},
};

if (Object.keys(contentPush).length) {
migbot marked this conversation as resolved.
Show resolved Hide resolved
options.animations.push = {
...options.animations.push,
...Platform.select({
android: contentPush,
ios: {
content: contentPush,
},
}),
};
}

if (Object.keys(contentPop).length) {
options.animations.pop = Platform.select({
android: contentPop,
ios: {
content: contentPop,
},
});
}

goToScreen(screen, '', passProps, options);
});
}
Expand Down
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,12 @@ PODS:
- React-Core
- ReactNativeKeyboardTrackingView (5.7.0):
- React
- ReactNativeNavigation (7.8.1):
- ReactNativeNavigation (7.11.1):
- React-Core
- React-RCTImage
- React-RCTText
- ReactNativeNavigation/Core (= 7.8.1)
- ReactNativeNavigation/Core (7.8.1):
- ReactNativeNavigation/Core (= 7.11.1)
- ReactNativeNavigation/Core (7.11.1):
- React-Core
- React-RCTImage
- React-RCTText
Expand Down Expand Up @@ -675,7 +675,7 @@ SPEC CHECKSUMS:
ReactCommon: 73d79c7039f473b76db6ff7c6b159c478acbbb3b
ReactNativeExceptionHandler: f1638ffd507ef1b1794af25884fa0eb30dd5c551
ReactNativeKeyboardTrackingView: 02137fac3b2ebd330d74fa54ead48b14750a2306
ReactNativeNavigation: 9bef98654981540f3c05e471f0314345a148a571
ReactNativeNavigation: 8c03497238c798322b60cf37d2ee0fa9335a0880
rn-fetch-blob: 17961aec08caae68bb8fc0e5b40f93b3acfa6932
RNCAsyncStorage: cb9a623793918c6699586281f0b51cbc38f046f9
RNCClipboard: 5e299c6df8e0c98f3d7416b86ae563d3a9f768a3
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"react-native-local-auth": "1.6.0",
"react-native-localize": "2.0.1",
"react-native-mmkv-storage": "0.4.3",
"react-native-navigation": "7.8.1",
"react-native-navigation": "7.11.1",
"react-native-notifications": "3.4.2",
"react-native-passcode-status": "1.1.2",
"react-native-permissions": "3.0.0",
Expand Down