mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
NIT: Cleanup warnings in RN Android
Summary: Easy diff that removes warnings in RN Android code related to JSResponder Reviewed By: sahrens Differential Revision: D16019255 fbshipit-source-id: dca8836be848feedbe19ce8a8356ea73ca5b7681
This commit is contained in:
committed by
Facebook Github Bot
parent
57d1f8ae15
commit
9c20f8ae4d
+1
-1
@@ -23,5 +23,5 @@ public interface OnInterceptTouchEventListener {
|
||||
* @return Return true to steal motion event from the children and have the dispatched to this
|
||||
* view, or return false to allow motion event to be delivered to children view
|
||||
*/
|
||||
public boolean onInterceptTouchEvent(ViewGroup v, MotionEvent event);
|
||||
boolean onInterceptTouchEvent(ViewGroup v, MotionEvent event);
|
||||
}
|
||||
|
||||
@@ -20,5 +20,6 @@ public interface ReactHitSlopView {
|
||||
*
|
||||
* @return A {@link Rect} representing how far to extend the touch area in each direction.
|
||||
*/
|
||||
public @Nullable Rect getHitSlopRect();
|
||||
@Nullable
|
||||
Rect getHitSlopRect();
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
*/
|
||||
package com.facebook.react.touch;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
/**
|
||||
* This interface should be implemented by all {@link ViewGroup} subviews that can be instantiating
|
||||
* by {@link NativeViewHierarchyManager}. It is used to configure onInterceptTouch event listener
|
||||
@@ -25,5 +27,5 @@ public interface ReactInterceptingViewGroup {
|
||||
* @param listener A callback that {@link ViewGroup} should delegate calls for {@link
|
||||
* ViewGroup#onInterceptTouchEvent} to
|
||||
*/
|
||||
public void setOnInterceptTouchEventListener(OnInterceptTouchEventListener listener);
|
||||
void setOnInterceptTouchEventListener(OnInterceptTouchEventListener listener);
|
||||
}
|
||||
|
||||
@@ -14,27 +14,31 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class JSStackTrace {
|
||||
|
||||
private static final String LINE_NUMBER_KEY = "lineNumber";
|
||||
private static final Pattern FILE_ID_PATTERN =
|
||||
Pattern.compile("\\b((?:seg-\\d+(?:_\\d+)?|\\d+)\\.js)");
|
||||
private static final String FILE_KEY = "file";
|
||||
private static final String COLUMN_KEY = "column";
|
||||
private static final String METHOD_NAME_KEY = "methodName";
|
||||
|
||||
public static String format(String message, ReadableArray stack) {
|
||||
StringBuilder stringBuilder = new StringBuilder(message).append(", stack:\n");
|
||||
for (int i = 0; i < stack.size(); i++) {
|
||||
ReadableMap frame = stack.getMap(i);
|
||||
stringBuilder.append(frame.getString("methodName")).append("@").append(parseFileId(frame));
|
||||
stringBuilder.append(frame.getString(METHOD_NAME_KEY)).append("@").append(parseFileId(frame));
|
||||
|
||||
if (frame.hasKey("lineNumber")
|
||||
&& !frame.isNull("lineNumber")
|
||||
&& frame.getType("lineNumber") == ReadableType.Number) {
|
||||
stringBuilder.append(frame.getInt("lineNumber"));
|
||||
if (frame.hasKey(LINE_NUMBER_KEY)
|
||||
&& !frame.isNull(LINE_NUMBER_KEY)
|
||||
&& frame.getType(LINE_NUMBER_KEY) == ReadableType.Number) {
|
||||
stringBuilder.append(frame.getInt(LINE_NUMBER_KEY));
|
||||
} else {
|
||||
stringBuilder.append(-1);
|
||||
}
|
||||
|
||||
if (frame.hasKey("column")
|
||||
&& !frame.isNull("column")
|
||||
&& frame.getType("column") == ReadableType.Number) {
|
||||
stringBuilder.append(":").append(frame.getInt("column"));
|
||||
if (frame.hasKey(COLUMN_KEY)
|
||||
&& !frame.isNull(COLUMN_KEY)
|
||||
&& frame.getType(COLUMN_KEY) == ReadableType.Number) {
|
||||
stringBuilder.append(":").append(frame.getInt(COLUMN_KEY));
|
||||
}
|
||||
|
||||
stringBuilder.append("\n");
|
||||
@@ -50,12 +54,15 @@ public class JSStackTrace {
|
||||
// stack traces with a single source map file.
|
||||
// NOTE: The ".js" suffix is kept to avoid ambiguities between "module-id:line" and "line:column".
|
||||
private static String parseFileId(ReadableMap frame) {
|
||||
if (frame.hasKey("file")
|
||||
&& !frame.isNull("file")
|
||||
&& frame.getType("file") == ReadableType.String) {
|
||||
final Matcher matcher = FILE_ID_PATTERN.matcher(frame.getString("file"));
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1) + ":";
|
||||
if (frame.hasKey(FILE_KEY)
|
||||
&& !frame.isNull(FILE_KEY)
|
||||
&& frame.getType(FILE_KEY) == ReadableType.String) {
|
||||
String file = frame.getString(FILE_KEY);
|
||||
if (file != null) {
|
||||
final Matcher matcher = FILE_ID_PATTERN.matcher(file);
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1) + ":";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
|
||||
Reference in New Issue
Block a user