Skip to content

Commit

Permalink
chore: minor refactor (#473)
Browse files Browse the repository at this point in the history
* chore: minor refactor

* remove rounding

* chore: changes done by yarn lint --fix
  • Loading branch information
vonovak committed Jun 2, 2021
1 parent d0e5227 commit e209ebe
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 27 deletions.
12 changes: 1 addition & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@ module.exports = {
extends: ['@react-native-community', 'prettier'],
rules: {
'no-console': ['error', { allow: ['warn', 'error'] }],
'prettier/prettier': [
'error',
{
printWidth: 80,
arrowParens: 'avoid',
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
},
],
'prettier/prettier': 'error',
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ const ContactListContainerComponent = ({
headerStyle: _headerStyle,
onItemPress,
}: ContactListContainerProps) => {
const headerStyle = useMemo(() => [styles.headerContainer, _headerStyle], [
_headerStyle,
]);
const headerStyle = useMemo(
() => [styles.headerContainer, _headerStyle],
[_headerStyle]
);
return (
<>
<View style={headerStyle}>
Expand Down
5 changes: 2 additions & 3 deletions example/src/screens/advanced/BackdropExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import ContactListContainer from '../../components/contactListContainer';

const BackdropExample = () => {
// state
const [backdropPressBehavior, setBackdropPressBehavior] = useState<
'none' | 'close' | 'collapse'
>('collapse');
const [backdropPressBehavior, setBackdropPressBehavior] =
useState<'none' | 'close' | 'collapse'>('collapse');

// hooks
const bottomSheetRef = useRef<BottomSheet>(null);
Expand Down
5 changes: 2 additions & 3 deletions example/src/screens/modal/BackdropExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ import withModalProvider from '../withModalProvider';

const BackdropExample = () => {
// state
const [backdropPressBehavior, setBackdropPressBehavior] = useState<
'none' | 'close' | 'collapse'
>('collapse');
const [backdropPressBehavior, setBackdropPressBehavior] =
useState<'none' | 'close' | 'collapse'>('collapse');
// refs
const bottomSheetRef = useRef<BottomSheetModal>(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ function BottomSheetHandleContainerComponent({

return refs;
}, [_providedSimultaneousHandlers, _internalSimultaneousHandlers]);

const shouldRenderHandle = useMemo(
() => _providedHandleComponent !== null,
[_providedHandleComponent]
);
//#endregion

//#region callbacks
Expand Down Expand Up @@ -96,6 +91,7 @@ function BottomSheetHandleContainerComponent({
);
}, [animatedIndex, animatedPosition, _providedHandleComponent]);

const shouldRenderHandle = _providedHandleComponent !== null;
return shouldRenderHandle ? (
<PanGestureHandler
enabled={enableHandlePanningGesture}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function createBottomSheetScrollableComponent<T, P>(
ref={scrollableRef}
overScrollMode={overScrollMode}
scrollEventThrottle={16}
onScrollBeginDrag={handleScrollEvent}
onScroll={handleScrollEvent}
animatedProps={scrollableAnimatedProps}
style={containerStyle}
/>
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useScrollableInternal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export const useScrollableInternal = () => {
: 0;
// @ts-ignore
scrollTo(scrollableRef, 0, lockPosition, false);
scrollableContentOffsetY.value = lockPosition;
scrollableContentOffsetY.value = 0;
return;
}
Expand Down

0 comments on commit e209ebe

Please sign in to comment.