mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 07:35:25 +00:00
Export latest Android changes
This commit is contained in:
parent
daba14264c
commit
71628638f6
@ -22,28 +22,28 @@ public class UiThreadUtil {
|
|||||||
@Nullable private static Handler sMainHandler;
|
@Nullable private static Handler sMainHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return whether the current thread is the UI thread.
|
* @return {@code true} if the current thread is the UI thread.
|
||||||
*/
|
*/
|
||||||
public static boolean isOnUiThread() {
|
public static boolean isOnUiThread() {
|
||||||
return Looper.getMainLooper().getThread() == Thread.currentThread();
|
return Looper.getMainLooper().getThread() == Thread.currentThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws a {@link AssertionException} if the current thread is not the UI thread.
|
* Throws an {@link AssertionException} if the current thread is not the UI thread.
|
||||||
*/
|
*/
|
||||||
public static void assertOnUiThread() {
|
public static void assertOnUiThread() {
|
||||||
SoftAssertions.assertCondition(isOnUiThread(), "Expected to run on UI thread!");
|
SoftAssertions.assertCondition(isOnUiThread(), "Expected to run on UI thread!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Throws a {@link AssertionException} if the current thread is the UI thread.
|
* Throws an {@link AssertionException} if the current thread is the UI thread.
|
||||||
*/
|
*/
|
||||||
public static void assertNotOnUiThread() {
|
public static void assertNotOnUiThread() {
|
||||||
SoftAssertions.assertCondition(!isOnUiThread(), "Expected not to run on UI thread!");
|
SoftAssertions.assertCondition(!isOnUiThread(), "Expected not to run on UI thread!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the given Runnable on the UI thread.
|
* Runs the given {@code Runnable} on the UI thread.
|
||||||
*/
|
*/
|
||||||
public static void runOnUiThread(Runnable runnable) {
|
public static void runOnUiThread(Runnable runnable) {
|
||||||
synchronized (UiThreadUtil.class) {
|
synchronized (UiThreadUtil.class) {
|
||||||
|
@ -57,7 +57,7 @@ public class ExceptionsManagerModule extends BaseJavaModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void reportSoftException(String title, ReadableArray details) {
|
public void reportSoftException(String title, ReadableArray details, int exceptionId) {
|
||||||
FLog.e(ReactConstants.TAG, title + "\n" + stackTraceToString(details));
|
FLog.e(ReactConstants.TAG, title + "\n" + stackTraceToString(details));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,12 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private WritableMap serializeEventData() {
|
private WritableMap serializeEventData() {
|
||||||
|
WritableMap contentInset = Arguments.createMap();
|
||||||
|
contentInset.putDouble("top", 0);
|
||||||
|
contentInset.putDouble("bottom", 0);
|
||||||
|
contentInset.putDouble("left", 0);
|
||||||
|
contentInset.putDouble("right", 0);
|
||||||
|
|
||||||
WritableMap contentOffset = Arguments.createMap();
|
WritableMap contentOffset = Arguments.createMap();
|
||||||
contentOffset.putDouble("x", PixelUtil.toDIPFromPixel(mScrollX));
|
contentOffset.putDouble("x", PixelUtil.toDIPFromPixel(mScrollX));
|
||||||
contentOffset.putDouble("y", PixelUtil.toDIPFromPixel(mScrollY));
|
contentOffset.putDouble("y", PixelUtil.toDIPFromPixel(mScrollY));
|
||||||
@ -77,6 +83,7 @@ public class ScrollEvent extends Event<ScrollEvent> {
|
|||||||
layoutMeasurement.putDouble("height", PixelUtil.toDIPFromPixel(mScrollViewHeight));
|
layoutMeasurement.putDouble("height", PixelUtil.toDIPFromPixel(mScrollViewHeight));
|
||||||
|
|
||||||
WritableMap event = Arguments.createMap();
|
WritableMap event = Arguments.createMap();
|
||||||
|
event.putMap("contentInset", contentInset);
|
||||||
event.putMap("contentOffset", contentOffset);
|
event.putMap("contentOffset", contentOffset);
|
||||||
event.putMap("contentSize", contentSize);
|
event.putMap("contentSize", contentSize);
|
||||||
event.putMap("layoutMeasurement", layoutMeasurement);
|
event.putMap("layoutMeasurement", layoutMeasurement);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user