Skip to content
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
26 changes: 0 additions & 26 deletions android/src/main/java/com/swmansion/rnscreens/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.facebook.react.bridge.GuardedRunnable
import com.facebook.react.bridge.ReactContext
import com.facebook.react.uimanager.PixelUtil
import com.facebook.react.uimanager.ReactClippingViewGroup
import com.facebook.react.uimanager.UIManagerHelper
import com.facebook.react.uimanager.UIManagerModule
import com.facebook.react.uimanager.events.EventDispatcher
import com.facebook.react.views.scroll.ReactHorizontalScrollView
import com.facebook.react.views.scroll.ReactScrollView
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.shape.CornerFamily
import com.google.android.material.shape.MaterialShapeDrawable
Expand Down Expand Up @@ -404,29 +401,6 @@ class Screen(
}

if (child is ViewGroup) {
// The children are miscounted when there's removeClippedSubviews prop
// set to true (which is the default for FlatLists).
// Unless the child is a ScrollView it's safe to assume that it's true
// and add a simple view for each possibly clipped item to make it work as expected.
// See https://github.com/software-mansion/react-native-screens/pull/2495

if (child is ReactClippingViewGroup &&
child.removeClippedSubviews &&
child !is ReactScrollView &&
child !is ReactHorizontalScrollView
) {
// We need to workaround the issue until our changes land in core.
// Some views do not accept any children or have set amount and they throw
// when we want to brute-forcefully manipulate that.
// Is this ugly? Very. Do we have better option before changes land in core?
// I'm not aware of any.
try {
for (j in 0 until child.childCount) {
child.addView(View(context))
}
} catch (_: Exception) {
}
}
startTransitionRecursive(child)
}
}
Expand Down
7 changes: 6 additions & 1 deletion apps/src/tests/Test2282.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,17 @@ function ExtraNestedFlatlist(props: Partial<FlatListProps<number>>) {

const Stack = createNativeStackNavigator();

/**
* You can use either the App component with `ListScreen` or `ListScreenSimplified`,
* of `AppSimple` component which has little to no navigation and attempts to reproduce the issue
*/

export default function App(): React.JSX.Element {
return (
<NavigationContainer>
<Stack.Navigator screenOptions={{ animation: 'slide_from_right' }}>
<Stack.Screen name="Home" component={Home} />
<Stack.Screen name="List" component={ListScreenSimplified}/>
<Stack.Screen name="List" component={ListScreenSimplified}/> {/* <- Exchange here for ListScreen for more complex case */}
</Stack.Navigator>
</NavigationContainer>
);
Expand Down
Loading