Skip to content

Commit f544376

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Revert D46871197: Add workaround for android API 33 ANR when inverting ScrollView
Differential Revision: D46871197 Original commit changeset: 872a2ce5313f Original Phabricator Diff: D46871197 fbshipit-source-id: d07e9e536d578f0612126bae07a83a02b5e6b792
1 parent 0e41ad0 commit f544376

File tree

4 files changed

+3
-42
lines changed

4 files changed

+3
-42
lines changed

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -379,22 +379,4 @@ public void setPointerEvents(ReactScrollView view, @Nullable String pointerEvent
379379
public void setScrollEventThrottle(ReactScrollView view, int scrollEventThrottle) {
380380
view.setScrollEventThrottle(scrollEventThrottle);
381381
}
382-
383-
@ReactProp(name = "inverted")
384-
public void setInverted(ReactScrollView view, boolean inverted) {
385-
// Usually when inverting the scroll view we are using scaleY: -1 on the list
386-
// and on the parent container. HOWEVER, starting from android API 33 there is
387-
// a bug that can cause an ANR due to that. Thus we are using different transform
388-
// commands to circumvent the ANR. This however causes the vertical scrollbar to
389-
// be on the wrong side. Thus we are moving it to the other side, when the list
390-
// is inverted.
391-
// See also:
392-
// - https://github.com/facebook/react-native/issues/35350
393-
// - https://issuetracker.google.com/issues/287304310
394-
if (inverted) {
395-
view.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT);
396-
} else {
397-
view.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_DEFAULT);
398-
}
399-
}
400382
}

packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,7 @@ ScrollViewProps::ScrollViewProps(
319319
rawProps,
320320
"scrollToOverflowEnabled",
321321
sourceProps.scrollToOverflowEnabled,
322-
{})),
323-
inverted(
324-
CoreFeatures::enablePropIteratorSetter ? sourceProps.inverted
325-
: convertRawProp(
326-
context,
327-
rawProps,
328-
"inverted",
329-
sourceProps.inverted,
330-
{})) {}
322+
{})) {}
331323

332324
void ScrollViewProps::setProp(
333325
const PropsParserContext &context,
@@ -376,7 +368,6 @@ void ScrollViewProps::setProp(
376368
RAW_SET_PROP_SWITCH_CASE_BASIC(snapToEnd);
377369
RAW_SET_PROP_SWITCH_CASE_BASIC(contentInsetAdjustmentBehavior);
378370
RAW_SET_PROP_SWITCH_CASE_BASIC(scrollToOverflowEnabled);
379-
RAW_SET_PROP_SWITCH_CASE_BASIC(inverted);
380371
}
381372
}
382373

@@ -501,9 +492,7 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
501492
debugStringConvertibleItem(
502493
"snapToStart", snapToStart, defaultScrollViewProps.snapToStart),
503494
debugStringConvertibleItem(
504-
"snapToEnd", snapToEnd, defaultScrollViewProps.snapToEnd),
505-
debugStringConvertibleItem(
506-
"inverted", inverted, defaultScrollViewProps.inverted)};
495+
"snapToEnd", snapToEnd, defaultScrollViewProps.snapToEnd)};
507496
}
508497
#endif
509498

packages/react-native/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class ScrollViewProps final : public ViewProps {
6868
ContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior{
6969
ContentInsetAdjustmentBehavior::Never};
7070
bool scrollToOverflowEnabled{false};
71-
bool inverted{false};
7271

7372
#pragma mark - DebugStringConvertible
7473

packages/virtualized-lists/Lists/VirtualizedList.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import type {
1414
LayoutEvent,
1515
ScrollEvent,
1616
} from 'react-native/Libraries/Types/CoreEventTypes';
17-
import Platform from 'react-native/Libraries/Utilities/Platform';
1817
import type {ViewToken} from './ViewabilityHelper';
1918
import type {
2019
Item,
@@ -1970,15 +1969,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
19701969

19711970
const styles = StyleSheet.create({
19721971
verticallyInverted: {
1973-
transform:
1974-
// Android 13 Bug Workaround:
1975-
// On Android, we need to invert both axes to mitigate a native bug
1976-
// that could lead to ANRs.
1977-
// Simply using scaleY: -1 leads to the application of scaleY and
1978-
// rotationX natively, resulting in the ANR.
1979-
// For more information, refer to the following Android tracking issue:
1980-
// https://issuetracker.google.com/issues/287304310
1981-
Platform.OS === 'android' ? [{scale: -1}] : [{scaleY: -1}],
1972+
transform: [{scaleY: -1}],
19821973
},
19831974
horizontallyInverted: {
19841975
transform: [{scaleX: -1}],

0 commit comments

Comments
 (0)