Skip to content

Commit c6cb0ad

Browse files
authored
sync from internal (#5)
1 parent 07933ba commit c6cb0ad

File tree

22 files changed

+390
-4733
lines changed

22 files changed

+390
-4733
lines changed

CHANGELOG.json

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,73 @@
11
{
22
"name": "@microsoft/react-native",
33
"entries": [
4+
{
5+
"version": "0.3.9",
6+
"tag": "@microsoft/react-native_v0.3.9",
7+
"date": "Tue, 05 Mar 2019 20:54:55 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Auto sync from tenantreactnativewin",
12+
"author": "Tudor Mihai <[email protected]>",
13+
"commit": "1aab97d280d884c4eeb97005870bd591dd3a0725"
14+
}
15+
]
16+
}
17+
},
18+
{
19+
"version": "0.3.8",
20+
"tag": "@microsoft/react-native_v0.3.8",
21+
"date": "Tue, 05 Mar 2019 07:11:25 GMT",
22+
"comments": {
23+
"patch": [
24+
{
25+
"comment": "Synchronized github.com/Microsoft/react-native/.ado to ISS/sdx-platform/src/react-native/.ado",
26+
"author": "Tom Underhill <[email protected]>",
27+
"commit": "28ada9228417ac4fad240874de07329dbada73c7"
28+
}
29+
]
30+
}
31+
},
32+
{
33+
"version": "0.3.7",
34+
"tag": "@microsoft/react-native_v0.3.7",
35+
"date": "Tue, 05 Mar 2019 02:31:33 GMT",
36+
"comments": {
37+
"patch": [
38+
{
39+
"comment": "Introduce CalendarView for UWP only (no Android, no JS, no Apple updates)",
40+
"author": "Sasha Gil <[email protected]>",
41+
"commit": "c200088828a6b8318fe74cd56694c4051acdb7d9"
42+
},
43+
{
44+
"comment": "Auto sync from tenantreactnativewin",
45+
"author": "Tudor Mihai <[email protected]>",
46+
"commit": "a835f0ac9a307d84dee1e706d917ac358a307887"
47+
},
48+
{
49+
"comment": "Android ScrollView fix for pagingEnabled",
50+
"author": "Christopher Hogan <[email protected]>",
51+
"commit": "d5491cb2e5893cd4111845ff53a18b7a04d6dd53"
52+
},
53+
{
54+
"comment": "added code review feedback",
55+
"author": "Kshitij Jain <[email protected]>",
56+
"commit": "a0bee9866186b7d9c1690c3aef715499ed21584a"
57+
},
58+
{
59+
"comment": "Catching jsi::JSError and throwing JavaJSException which will be handle by DevSupportManager to show RedBox",
60+
"author": "Rohit Jain (MOD) <[email protected]>",
61+
"commit": "30e8d48b4d4bbe3fcbc4609eee3773bf39fcb49d"
62+
},
63+
{
64+
"comment": "JSICore (react-free) libraries",
65+
"author": "Tudor Mihai <[email protected]>",
66+
"commit": "7692fb3852df570233ec890e21861ac0e804880b"
67+
}
68+
]
69+
}
70+
},
471
{
572
"version": "0.3.5",
673
"tag": "@microsoft/react-native_v0.3.5",

CHANGELOG.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
# Change Log - @microsoft/react-native
22

3-
This log was last generated on Tue, 26 Feb 2019 20:40:41 GMT and should not be manually modified.
3+
This log was last generated on Tue, 05 Mar 2019 20:54:55 GMT and should not be manually modified.
4+
5+
## 0.3.9
6+
Tue, 05 Mar 2019 20:54:55 GMT
7+
8+
### Patches
9+
10+
- Auto sync from tenantreactnativewin
11+
12+
## 0.3.8
13+
Tue, 05 Mar 2019 07:11:25 GMT
14+
15+
### Patches
16+
17+
- Synchronized github.com/Microsoft/react-native/.ado to ISS/sdx-platform/src/react-native/.ado
18+
19+
## 0.3.7
20+
Tue, 05 Mar 2019 02:31:33 GMT
21+
22+
### Patches
23+
24+
- Introduce CalendarView for UWP only (no Android, no JS, no Apple updates)
25+
- Auto sync from tenantreactnativewin
26+
- Android ScrollView fix for pagingEnabled
27+
- added code review feedback
28+
- Catching jsi::JSError and throwing JavaJSException which will be handle by DevSupportManager to show RedBox
29+
- JSICore (react-free) libraries
430

531
## 0.3.5
632
Tue, 26 Feb 2019 20:40:41 GMT

CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ if(WIN32 AND NOT WINRT)
4242
endif(WIN32 AND NOT WINRT)
4343

4444
add_subdirectory(folly)
45-
add_subdirectory(ReactCommon)
45+
46+
if(NOT ANDROID)
47+
add_subdirectory(ReactCommon)
48+
endif(NOT ANDROID)
4649

4750
if(IOS OR APPLE OR ANDROID)
4851
add_subdirectory(glog)

Folly/folly/detail/sources.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
LIBLETNAME = FollyDetail
2-
2+
LIBLET_DEF_USEGENERATED = 0
33
!include $(OPENSOURCE_REACTNATIVE)\OfficeISS\ReactCommon\make.inc
44

55
SOURCES_SHARED = \

Libraries/Components/View/ViewPropTypes.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,6 @@ module.exports = {
613613
onFocusChange: PropTypes.func, // TODO(android ISS)
614614

615615
/**
616-
<<<<<<< HEAD
617-
* Enables Drag'n'Drop Support for certain types of dragged types
618-
=======
619616
* Fired when an element is focused
620617
*
621618
* @platform macos
@@ -633,7 +630,6 @@ module.exports = {
633630

634631
/**
635632
* Enables Dran'n'Drop Support for certain types of dragged types
636-
>>>>>>> origin/master
637633
*
638634
* Possible values for `draggedTypes` are:
639635
*

ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public void requestChildFocus(View child, View focused) {
211211
if (focused != null && !mPagingEnabled) {
212212
scrollToChild(focused);
213213
}
214-
super.requestChildFocus(child, focused);
214+
super.requestChildFocus(child, focused);
215215
}
216216

217217
@Override
@@ -386,7 +386,7 @@ public boolean onTouchEvent(MotionEvent ev) {
386386
@Override
387387
public void fling(int velocityX) {
388388
if (mPagingEnabled) {
389-
smoothScrollAndSnap(velocityX);
389+
flingAndSnap(velocityX);
390390
} else if (mScroller != null) {
391391
// FB SCROLLVIEW CHANGE
392392

@@ -564,7 +564,7 @@ public void run() {
564564
// Only if we have pagingEnabled and we have not snapped to the page do we
565565
// need to continue checking for the scroll. And we cause that scroll by asking for it
566566
mSnappingToPage = true;
567-
smoothScrollAndSnap(0);
567+
flingAndSnap(0);
568568
ViewCompat.postOnAnimationDelayed(ReactHorizontalScrollView.this,
569569
this,
570570
ReactScrollViewHelper.MOMENTUM_DELAY);
@@ -583,28 +583,15 @@ public void run() {
583583
ReactScrollViewHelper.MOMENTUM_DELAY);
584584
}
585585

586-
/**
587-
* This will smooth scroll us to the nearest snap offset point
588-
* It currently just looks at where the content is and slides to the nearest point.
589-
* It is intended to be run after we are done scrolling, and handling any momentum scrolling.
590-
*/
591-
private void smoothScrollAndSnap(int velocityX) {
592-
if (getChildCount() <= 0) {
593-
return;
594-
}
595-
596-
int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
597-
int targetOffset = 0;
598-
int smallerOffset = 0;
599-
int largerOffset = maximumOffset;
600-
586+
private int predictFinalScrollPosition(int velocityX) {
601587
// ScrollView can *only* scroll for 250ms when using smoothScrollTo and there's
602588
// no way to customize the scroll duration. So, we create a temporary OverScroller
603589
// so we can predict where a fling would land and snap to nearby that point.
604590
OverScroller scroller = new OverScroller(getContext());
605591
scroller.setFriction(1.0f - mDecelerationRate);
606592

607593
// predict where a fling would end up so we can scroll to the nearest snap offset
594+
int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
608595
int width = getWidth() - getPaddingStart() - getPaddingEnd();
609596
scroller.fling(
610597
getScrollX(), // startX
@@ -618,7 +605,76 @@ private void smoothScrollAndSnap(int velocityX) {
618605
width/2, // overX
619606
0 // overY
620607
);
621-
targetOffset = scroller.getFinalX();
608+
return scroller.getFinalX();
609+
}
610+
611+
/**
612+
* This will smooth scroll us to the nearest snap offset point
613+
* It currently just looks at where the content is and slides to the nearest point.
614+
* It is intended to be run after we are done scrolling, and handling any momentum scrolling.
615+
*/
616+
private void smoothScrollAndSnap(int velocity) {
617+
double interval = (double) getSnapInterval();
618+
double currentOffset = (double) getScrollX();
619+
double targetOffset = (double) predictFinalScrollPosition(velocity);
620+
621+
int previousPage = (int) Math.floor(currentOffset / interval);
622+
int nextPage = (int) Math.ceil(currentOffset / interval);
623+
int currentPage = (int) Math.round(currentOffset / interval);
624+
int targetPage = (int) Math.round(targetOffset / interval);
625+
626+
if (velocity > 0 && nextPage == previousPage) {
627+
nextPage ++;
628+
} else if (velocity < 0 && previousPage == nextPage) {
629+
previousPage --;
630+
}
631+
632+
if (
633+
// if scrolling towards next page
634+
velocity > 0 &&
635+
// and the middle of the page hasn't been crossed already
636+
currentPage < nextPage &&
637+
// and it would have been crossed after flinging
638+
targetPage > previousPage
639+
) {
640+
currentPage = nextPage;
641+
}
642+
else if (
643+
// if scrolling towards previous page
644+
velocity < 0 &&
645+
// and the middle of the page hasn't been crossed already
646+
currentPage > previousPage &&
647+
// and it would have been crossed after flinging
648+
targetPage < nextPage
649+
) {
650+
currentPage = previousPage;
651+
}
652+
653+
targetOffset = currentPage * interval;
654+
if (targetOffset != currentOffset) {
655+
mActivelyScrolling = true;
656+
smoothScrollTo((int) targetOffset, getScrollY());
657+
}
658+
}
659+
660+
private void flingAndSnap(int velocityX) {
661+
if (getChildCount() <= 0) {
662+
return;
663+
}
664+
665+
// pagingEnabled only allows snapping one interval at a time
666+
if (mSnapInterval == 0 && mSnapOffsets == null) {
667+
smoothScrollAndSnap(velocityX);
668+
return;
669+
}
670+
671+
int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth());
672+
int targetOffset = predictFinalScrollPosition(velocityX);
673+
int smallerOffset = 0;
674+
int largerOffset = maximumOffset;
675+
int firstOffset = 0;
676+
int lastOffset = maximumOffset;
677+
int width = getWidth() - getPaddingStart() - getPaddingEnd();
622678

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

0 commit comments

Comments
 (0)