mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-30 22:12:42 +08:00
Set Event timestamp internally
Summary: This is pure cleanup so that we can make sure that all events are living in the same time space (currently nano seconds). Reviewed By: foghina Differential Revision: D3593884 fbshipit-source-id: 71b084362008f1c93c21880630acf11f5c058355
This commit is contained in:
committed by
Facebook Github Bot 7
parent
faabeadebf
commit
da063e3d55
@@ -26,10 +26,9 @@ public class ReactContentSizeChangedEvent extends Event<ReactTextChangedEvent> {
|
||||
|
||||
public ReactContentSizeChangedEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
int contentSizeWidth,
|
||||
int contentSizeHeight) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mContentWidth = contentSizeWidth;
|
||||
mContentHeight = contentSizeHeight;
|
||||
}
|
||||
|
||||
@@ -29,12 +29,11 @@ public class ReactTextChangedEvent extends Event<ReactTextChangedEvent> {
|
||||
|
||||
public ReactTextChangedEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text,
|
||||
int contentSizeWidth,
|
||||
int contentSizeHeight,
|
||||
int eventCount) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
mContentWidth = contentSizeWidth;
|
||||
mContentHeight = contentSizeHeight;
|
||||
|
||||
@@ -21,10 +21,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
private static final String EVENT_NAME = "topBlur";
|
||||
|
||||
public ReactTextInputBlurEvent(
|
||||
int viewId,
|
||||
long timestampMs) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactTextInputBlurEvent(int viewId) {
|
||||
super(viewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,9 +26,8 @@ class ReactTextInputEndEditingEvent extends Event<ReactTextInputEndEditingEvent>
|
||||
|
||||
public ReactTextInputEndEditingEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,11 @@ public class ReactTextInputEvent extends Event<ReactTextInputEvent> {
|
||||
|
||||
public ReactTextInputEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text,
|
||||
String previousText,
|
||||
int rangeStart,
|
||||
int rangeEnd) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
mPreviousText = previousText;
|
||||
mRangeStart = rangeStart;
|
||||
|
||||
@@ -21,10 +21,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
private static final String EVENT_NAME = "topFocus";
|
||||
|
||||
public ReactTextInputFocusEvent(
|
||||
int viewId,
|
||||
long timestampMs) {
|
||||
super(viewId, timestampMs);
|
||||
public ReactTextInputFocusEvent(int viewId) {
|
||||
super(viewId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -33,7 +33,6 @@ import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
|
||||
import com.facebook.react.bridge.ReactContext;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.common.MapBuilder;
|
||||
import com.facebook.react.common.SystemClock;
|
||||
import com.facebook.react.uimanager.BaseViewManager;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
import com.facebook.react.uimanager.PixelUtil;
|
||||
@@ -578,7 +577,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ReactTextChangedEvent(
|
||||
mEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
s.toString(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight),
|
||||
@@ -587,7 +585,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEvent(
|
||||
mEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
newText,
|
||||
oldText,
|
||||
start,
|
||||
@@ -612,18 +609,15 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
if (hasFocus) {
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputFocusEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime()));
|
||||
editText.getId()));
|
||||
} else {
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputBlurEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime()));
|
||||
editText.getId()));
|
||||
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputEndEditingEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
editText.getText().toString()));
|
||||
}
|
||||
}
|
||||
@@ -641,7 +635,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
eventDispatcher.dispatchEvent(
|
||||
new ReactTextInputSubmitEditingEvent(
|
||||
editText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
editText.getText().toString()));
|
||||
}
|
||||
if (actionId == EditorInfo.IME_ACTION_NEXT ||
|
||||
@@ -688,7 +681,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ReactContentSizeChangedEvent(
|
||||
mEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
(int) PixelUtil.toDIPFromPixel(contentWidth),
|
||||
(int) PixelUtil.toDIPFromPixel(contentHeight)));
|
||||
}
|
||||
@@ -717,7 +709,6 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ReactTextInputSelectionEvent(
|
||||
mReactEditText.getId(),
|
||||
SystemClock.nanoTime(),
|
||||
start,
|
||||
end
|
||||
)
|
||||
|
||||
@@ -27,10 +27,9 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
public ReactTextInputSelectionEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
int selectionStart,
|
||||
int selectionEnd) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mSelectionStart = selectionStart;
|
||||
mSelectionEnd = selectionEnd;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,8 @@ import com.facebook.react.uimanager.events.RCTEventEmitter;
|
||||
|
||||
public ReactTextInputSubmitEditingEvent(
|
||||
int viewId,
|
||||
long timestampMs,
|
||||
String text) {
|
||||
super(viewId, timestampMs);
|
||||
super(viewId);
|
||||
mText = text;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user