Skip to content

Commit

Permalink
chore: fixed dynamic snap point example text color
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhom committed May 22, 2022
1 parent 29152fb commit 321de77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion example/src/screens/advanced/DynamicSnapPointExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BottomSheet, {
BottomSheetView,
useBottomSheetDynamicSnapPoints,
} from '@gorhom/bottom-sheet';
import { useShowcaseTheme } from '@gorhom/showcase-template';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Button from '../../components/button';

Expand All @@ -21,6 +22,7 @@ const DynamicSnapPointExample = () => {
animatedContentHeight,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(initialSnapPoints);
const { dark } = useShowcaseTheme();

// callbacks
const handleIncreaseContentPress = useCallback(() => {
Expand Down Expand Up @@ -51,6 +53,10 @@ const DynamicSnapPointExample = () => {
}),
[count]
);
const messageStyle = useMemo(
() => [styles.message, { color: dark ? 'white' : 'black' }],
[dark]
);

// renders
return (
Expand All @@ -69,7 +75,7 @@ const DynamicSnapPointExample = () => {
style={contentContainerStyle}
onLayout={handleContentLayout}
>
<Text style={styles.message}>
<Text style={messageStyle}>
Could this sheet resize to its content height ?
</Text>
<View style={emojiContainerStyle}>
Expand Down
8 changes: 7 additions & 1 deletion example/src/screens/modal/DynamicSnapPointExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BottomSheetView,
useBottomSheetDynamicSnapPoints,
} from '@gorhom/bottom-sheet';
import { useShowcaseTheme } from '@gorhom/showcase-template';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import Button from '../../components/button';
import withModalProvider from '../withModalProvider';
Expand All @@ -23,6 +24,7 @@ const DynamicSnapPointExample = () => {
animatedContentHeight,
handleContentLayout,
} = useBottomSheetDynamicSnapPoints(initialSnapPoints);
const { dark } = useShowcaseTheme();

// callbacks
const handleIncreaseContentPress = useCallback(() => {
Expand Down Expand Up @@ -54,6 +56,10 @@ const DynamicSnapPointExample = () => {
}),
[count]
);
const messageStyle = useMemo(
() => [styles.message, { color: dark ? 'white' : 'black' }],
[dark]
);

// renders
return (
Expand All @@ -71,7 +77,7 @@ const DynamicSnapPointExample = () => {
style={contentContainerStyle}
onLayout={handleContentLayout}
>
<Text style={styles.message}>
<Text style={messageStyle}>
Could this sheet modal resize to its content height ?
</Text>
<View style={emojiContainerStyle}>
Expand Down

0 comments on commit 321de77

Please sign in to comment.