Skip to content

Commit

Permalink
added reproducer for backdrop flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
schiller-manuel committed May 10, 2021
1 parent b5a6c65 commit 86b628e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
13 changes: 11 additions & 2 deletions example/src/screens/modal/DynamicSnapPointExample.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import React, { useCallback, useMemo, useRef, useState } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import { BottomSheetModal, BottomSheetView } from '@gorhom/bottom-sheet';
import {
BottomSheetBackdrop,
BottomSheetModal,
BottomSheetView,
} from '@gorhom/bottom-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Button from '../../components/button';
import withModalProvider from '../withModalProvider';
Expand Down Expand Up @@ -63,7 +67,12 @@ const DynamicSnapPointExample = () => {
<View style={styles.container}>
<Button label="Present" onPress={handlePresentPress} />
<Button label="Dismiss" onPress={handleDismissPress} />
<BottomSheetModal ref={bottomSheetRef} index={0} snapPoints={snapPoints}>
<BottomSheetModal
ref={bottomSheetRef}
index={0}
snapPoints={snapPoints}
backdropComponent={BottomSheetBackdrop}
>
<BottomSheetView
style={contentContainerStyle}
onLayout={handleOnLayout}
Expand Down
6 changes: 4 additions & 2 deletions src/components/bottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import {
import type { ScrollableRef, BottomSheetMethods } from '../../types';
import type { BottomSheetProps } from './types';
import { styles } from './styles';
import BottomSheetDebugView from '../bottomSheetDebugView';

Animated.addWhitelistedUIProps({
decelerationRate: true,
Expand Down Expand Up @@ -864,6 +865,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
useAnimatedReaction(
() => animatedIndex.value,
value => {
console.log('animatedIndex', animatedIndex.value)
if (_providedAnimatedIndex) {
_providedAnimatedIndex.value = value;
}
Expand Down Expand Up @@ -968,7 +970,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
/>
</BottomSheetInternalProvider>
</Animated.View>
{/* <BottomSheetDebugView
<BottomSheetDebugView
values={{
animatedIndex,
animatedPosition,
Expand All @@ -980,7 +982,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
scrollableState,
isExtendedByKeyboard,
}}
/> */}
/>
</BottomSheetContainer>
</BottomSheetProvider>
);
Expand Down

0 comments on commit 86b628e

Please sign in to comment.