Skip to content

Commit

Permalink
refactor: update swipeable panel hook
Browse files Browse the repository at this point in the history
  • Loading branch information
enesozturk committed Sep 20, 2021
1 parent 6efc2ab commit 0e1cb12
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions example/src/hooks/useSwipeablePanel.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
import * as React from 'react';

import type { SwipeablePanelProps } from 'rn-swipeable-panel';

type ContentType = null | 'about' | 'settings' | 'configurations' | 'darkShoppingCart';

const useSwipeablePanel = () => {
const [panelState, setPanelState] = React.useState({
const [panelState, setPanelState] = React.useState<SwipeablePanelProps & { contentType: ContentType }>({
onClose: () => {},
isActive: false,
openLarge: false,
onlyLarge: false,
fullWidth: false,
noBackgroundOpacity: false,
bounceAnimation: false,
closeOnTouchOutside: false,
noBar: false,
showCloseButton: false,
onlySmall: false,
allowTouchOutside: false,
barStyle: {},
panelStyles: {},
style: {},
closeRootStyle: {},
contentType: null,
smallPanelHeight: 400,
});

const changePanelState = React.useCallback(
Expand Down Expand Up @@ -69,11 +75,9 @@ const useSwipeablePanel = () => {
fullWidth: true,
showCloseButton: true,
noBar: false,
panelStyles: {
style: { backgroundColor: '#1f1f1f' },
barStyle: { backgroundColor: 'rgba(255,255,255,0.2)' },
closeRootStyle: { backgroundColor: 'rgba(255,255,255,0.2)' },
},
style: { backgroundColor: '#1f1f1f' },
barStyle: { backgroundColor: 'rgba(255,255,255,0.2)' },
closeRootStyle: { backgroundColor: 'rgba(255,255,255,0.2)' },
contentType: 'darkShoppingCart',
});
}
Expand Down

0 comments on commit 0e1cb12

Please sign in to comment.