Skip to content

sync from internal #5

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

Merged
merged 1 commit into from
Mar 6, 2019
Merged
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
67 changes: 67 additions & 0 deletions CHANGELOG.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,73 @@
{
"name": "@microsoft/react-native",
"entries": [
{
"version": "0.3.9",
"tag": "@microsoft/react-native_v0.3.9",
"date": "Tue, 05 Mar 2019 20:54:55 GMT",
"comments": {
"patch": [
{
"comment": "Auto sync from tenantreactnativewin",
"author": "Tudor Mihai <tudorm@microsoft.com>",
"commit": "1aab97d280d884c4eeb97005870bd591dd3a0725"
}
]
}
},
{
"version": "0.3.8",
"tag": "@microsoft/react-native_v0.3.8",
"date": "Tue, 05 Mar 2019 07:11:25 GMT",
"comments": {
"patch": [
{
"comment": "Synchronized github.com/Microsoft/react-native/.ado to ISS/sdx-platform/src/react-native/.ado",
"author": "Tom Underhill <tomun@microsoft.com>",
"commit": "28ada9228417ac4fad240874de07329dbada73c7"
}
]
}
},
{
"version": "0.3.7",
"tag": "@microsoft/react-native_v0.3.7",
"date": "Tue, 05 Mar 2019 02:31:33 GMT",
"comments": {
"patch": [
{
"comment": "Introduce CalendarView for UWP only (no Android, no JS, no Apple updates)",
"author": "Sasha Gil <alexgil@microsoft.com>",
"commit": "c200088828a6b8318fe74cd56694c4051acdb7d9"
},
{
"comment": "Auto sync from tenantreactnativewin",
"author": "Tudor Mihai <tudorm@microsoft.com>",
"commit": "a835f0ac9a307d84dee1e706d917ac358a307887"
},
{
"comment": "Android ScrollView fix for pagingEnabled",
"author": "Christopher Hogan <chrishog@microsoft.com>",
"commit": "d5491cb2e5893cd4111845ff53a18b7a04d6dd53"
},
{
"comment": "added code review feedback",
"author": "Kshitij Jain <ksjain@microsoft.com>",
"commit": "a0bee9866186b7d9c1690c3aef715499ed21584a"
},
{
"comment": "Catching jsi::JSError and throwing JavaJSException which will be handle by DevSupportManager to show RedBox",
"author": "Rohit Jain (MOD) <rojain@microsoft.com>",
"commit": "30e8d48b4d4bbe3fcbc4609eee3773bf39fcb49d"
},
{
"comment": "JSICore (react-free) libraries",
"author": "Tudor Mihai <tudorm@microsoft.com>",
"commit": "7692fb3852df570233ec890e21861ac0e804880b"
}
]
}
},
{
"version": "0.3.5",
"tag": "@microsoft/react-native_v0.3.5",
Expand Down
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# Change Log - @microsoft/react-native

This log was last generated on Tue, 26 Feb 2019 20:40:41 GMT and should not be manually modified.
This log was last generated on Tue, 05 Mar 2019 20:54:55 GMT and should not be manually modified.

## 0.3.9
Tue, 05 Mar 2019 20:54:55 GMT

### Patches

- Auto sync from tenantreactnativewin

## 0.3.8
Tue, 05 Mar 2019 07:11:25 GMT

### Patches

- Synchronized github.com/Microsoft/react-native/.ado to ISS/sdx-platform/src/react-native/.ado

## 0.3.7
Tue, 05 Mar 2019 02:31:33 GMT

### Patches

- Introduce CalendarView for UWP only (no Android, no JS, no Apple updates)
- Auto sync from tenantreactnativewin
- Android ScrollView fix for pagingEnabled
- added code review feedback
- Catching jsi::JSError and throwing JavaJSException which will be handle by DevSupportManager to show RedBox
- JSICore (react-free) libraries

## 0.3.5
Tue, 26 Feb 2019 20:40:41 GMT
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ if(WIN32 AND NOT WINRT)
endif(WIN32 AND NOT WINRT)

add_subdirectory(folly)
add_subdirectory(ReactCommon)

if(NOT ANDROID)
add_subdirectory(ReactCommon)
endif(NOT ANDROID)

if(IOS OR APPLE OR ANDROID)
add_subdirectory(glog)
Expand Down
2 changes: 1 addition & 1 deletion Folly/folly/detail/sources.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
LIBLETNAME = FollyDetail

LIBLET_DEF_USEGENERATED = 0
!include $(OPENSOURCE_REACTNATIVE)\OfficeISS\ReactCommon\make.inc

SOURCES_SHARED = \
Expand Down
4 changes: 0 additions & 4 deletions Libraries/Components/View/ViewPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,9 +613,6 @@ module.exports = {
onFocusChange: PropTypes.func, // TODO(android ISS)

/**
<<<<<<< HEAD
* Enables Drag'n'Drop Support for certain types of dragged types
=======
* Fired when an element is focused
*
* @platform macos
Expand All @@ -633,7 +630,6 @@ module.exports = {

/**
* Enables Dran'n'Drop Support for certain types of dragged types
>>>>>>> origin/master
*
* Possible values for `draggedTypes` are:
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public void requestChildFocus(View child, View focused) {
if (focused != null && !mPagingEnabled) {
scrollToChild(focused);
}
super.requestChildFocus(child, focused);
super.requestChildFocus(child, focused);
}

@Override
Expand Down Expand Up @@ -386,7 +386,7 @@ public boolean onTouchEvent(MotionEvent ev) {
@Override
public void fling(int velocityX) {
if (mPagingEnabled) {
smoothScrollAndSnap(velocityX);
flingAndSnap(velocityX);
} else if (mScroller != null) {
// FB SCROLLVIEW CHANGE

Expand Down Expand Up @@ -564,7 +564,7 @@ public void run() {
// Only if we have pagingEnabled and we have not snapped to the page do we
// need to continue checking for the scroll. And we cause that scroll by asking for it
mSnappingToPage = true;
smoothScrollAndSnap(0);
flingAndSnap(0);
ViewCompat.postOnAnimationDelayed(ReactHorizontalScrollView.this,
this,
ReactScrollViewHelper.MOMENTUM_DELAY);
Expand All @@ -583,28 +583,15 @@ public void run() {
ReactScrollViewHelper.MOMENTUM_DELAY);
}

/**
* This will smooth scroll us to the nearest snap offset point
* It currently just looks at where the content is and slides to the nearest point.
* It is intended to be run after we are done scrolling, and handling any momentum scrolling.
*/
private void smoothScrollAndSnap(int velocityX) {
if (getChildCount() <= 0) {
return;
}

int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
int targetOffset = 0;
int smallerOffset = 0;
int largerOffset = maximumOffset;

private int predictFinalScrollPosition(int velocityX) {
// ScrollView can *only* scroll for 250ms when using smoothScrollTo and there's
// no way to customize the scroll duration. So, we create a temporary OverScroller
// so we can predict where a fling would land and snap to nearby that point.
OverScroller scroller = new OverScroller(getContext());
scroller.setFriction(1.0f - mDecelerationRate);

// predict where a fling would end up so we can scroll to the nearest snap offset
int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
int width = getWidth() - getPaddingStart() - getPaddingEnd();
scroller.fling(
getScrollX(), // startX
Expand All @@ -618,7 +605,76 @@ private void smoothScrollAndSnap(int velocityX) {
width/2, // overX
0 // overY
);
targetOffset = scroller.getFinalX();
return scroller.getFinalX();
}

/**
* This will smooth scroll us to the nearest snap offset point
* It currently just looks at where the content is and slides to the nearest point.
* It is intended to be run after we are done scrolling, and handling any momentum scrolling.
*/
private void smoothScrollAndSnap(int velocity) {
double interval = (double) getSnapInterval();
double currentOffset = (double) getScrollX();
double targetOffset = (double) predictFinalScrollPosition(velocity);

int previousPage = (int) Math.floor(currentOffset / interval);
int nextPage = (int) Math.ceil(currentOffset / interval);
int currentPage = (int) Math.round(currentOffset / interval);
int targetPage = (int) Math.round(targetOffset / interval);

if (velocity > 0 && nextPage == previousPage) {
nextPage ++;
} else if (velocity < 0 && previousPage == nextPage) {
previousPage --;
}

if (
// if scrolling towards next page
velocity > 0 &&
// and the middle of the page hasn't been crossed already
currentPage < nextPage &&
// and it would have been crossed after flinging
targetPage > previousPage
) {
currentPage = nextPage;
}
else if (
// if scrolling towards previous page
velocity < 0 &&
// and the middle of the page hasn't been crossed already
currentPage > previousPage &&
// and it would have been crossed after flinging
targetPage < nextPage
) {
currentPage = previousPage;
}

targetOffset = currentPage * interval;
if (targetOffset != currentOffset) {
mActivelyScrolling = true;
smoothScrollTo((int) targetOffset, getScrollY());
}
}

private void flingAndSnap(int velocityX) {
if (getChildCount() <= 0) {
return;
}

// pagingEnabled only allows snapping one interval at a time
if (mSnapInterval == 0 && mSnapOffsets == null) {
smoothScrollAndSnap(velocityX);
return;
}

int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
int targetOffset = predictFinalScrollPosition(velocityX);
int smallerOffset = 0;
int largerOffset = maximumOffset;
int firstOffset = 0;
int lastOffset = maximumOffset;
int width = getWidth() - getPaddingStart() - getPaddingEnd();

// offsets are from the right edge in RTL layouts
boolean isRTL = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL;
Expand Down
Loading