mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
0e41ad09b0
commit
f544376f7c
-18
@@ -379,22 +379,4 @@ public class ReactScrollViewManager extends ViewGroupManager<ReactScrollView>
|
||||
public void setScrollEventThrottle(ReactScrollView view, int scrollEventThrottle) {
|
||||
view.setScrollEventThrottle(scrollEventThrottle);
|
||||
}
|
||||
|
||||
@ReactProp(name = "inverted")
|
||||
public void setInverted(ReactScrollView view, boolean inverted) {
|
||||
// Usually when inverting the scroll view we are using scaleY: -1 on the list
|
||||
// and on the parent container. HOWEVER, starting from android API 33 there is
|
||||
// a bug that can cause an ANR due to that. Thus we are using different transform
|
||||
// commands to circumvent the ANR. This however causes the vertical scrollbar to
|
||||
// be on the wrong side. Thus we are moving it to the other side, when the list
|
||||
// is inverted.
|
||||
// See also:
|
||||
// - https://github.com/facebook/react-native/issues/35350
|
||||
// - https://issuetracker.google.com/issues/287304310
|
||||
if (inverted) {
|
||||
view.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT);
|
||||
} else {
|
||||
view.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-13
@@ -319,15 +319,7 @@ ScrollViewProps::ScrollViewProps(
|
||||
rawProps,
|
||||
"scrollToOverflowEnabled",
|
||||
sourceProps.scrollToOverflowEnabled,
|
||||
{})),
|
||||
inverted(
|
||||
CoreFeatures::enablePropIteratorSetter ? sourceProps.inverted
|
||||
: convertRawProp(
|
||||
context,
|
||||
rawProps,
|
||||
"inverted",
|
||||
sourceProps.inverted,
|
||||
{})) {}
|
||||
{})) {}
|
||||
|
||||
void ScrollViewProps::setProp(
|
||||
const PropsParserContext &context,
|
||||
@@ -376,7 +368,6 @@ void ScrollViewProps::setProp(
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(snapToEnd);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(contentInsetAdjustmentBehavior);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(scrollToOverflowEnabled);
|
||||
RAW_SET_PROP_SWITCH_CASE_BASIC(inverted);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,9 +492,7 @@ SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const {
|
||||
debugStringConvertibleItem(
|
||||
"snapToStart", snapToStart, defaultScrollViewProps.snapToStart),
|
||||
debugStringConvertibleItem(
|
||||
"snapToEnd", snapToEnd, defaultScrollViewProps.snapToEnd),
|
||||
debugStringConvertibleItem(
|
||||
"inverted", inverted, defaultScrollViewProps.inverted)};
|
||||
"snapToEnd", snapToEnd, defaultScrollViewProps.snapToEnd)};
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
-1
@@ -68,7 +68,6 @@ class ScrollViewProps final : public ViewProps {
|
||||
ContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior{
|
||||
ContentInsetAdjustmentBehavior::Never};
|
||||
bool scrollToOverflowEnabled{false};
|
||||
bool inverted{false};
|
||||
|
||||
#pragma mark - DebugStringConvertible
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import type {
|
||||
LayoutEvent,
|
||||
ScrollEvent,
|
||||
} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import Platform from 'react-native/Libraries/Utilities/Platform';
|
||||
import type {ViewToken} from './ViewabilityHelper';
|
||||
import type {
|
||||
Item,
|
||||
@@ -1970,15 +1969,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
verticallyInverted: {
|
||||
transform:
|
||||
// Android 13 Bug Workaround:
|
||||
// On Android, we need to invert both axes to mitigate a native bug
|
||||
// that could lead to ANRs.
|
||||
// Simply using scaleY: -1 leads to the application of scaleY and
|
||||
// rotationX natively, resulting in the ANR.
|
||||
// For more information, refer to the following Android tracking issue:
|
||||
// https://issuetracker.google.com/issues/287304310
|
||||
Platform.OS === 'android' ? [{scale: -1}] : [{scaleY: -1}],
|
||||
transform: [{scaleY: -1}],
|
||||
},
|
||||
horizontallyInverted: {
|
||||
transform: [{scaleX: -1}],
|
||||
|
||||
Reference in New Issue
Block a user