From edd174b4dfd364858ea14ad8a87613dddc7069e5 Mon Sep 17 00:00:00 2001 From: hyochan Date: Mon, 5 Feb 2024 00:17:16 +0900 Subject: [PATCH] fix: lint --- package.json | 2 +- packages/CalendarCarousel/index.tsx | 26 ++++++++--------- .../PinchZoomStories/PinchZoom.stories.tsx | 29 +++++++++++++++++++ .../PinchZoomArticleStory.tsx | 27 ----------------- stories/packages/PinchZoomStories/index.tsx | 14 --------- yarn.lock | 7 +---- 6 files changed, 44 insertions(+), 61 deletions(-) create mode 100644 stories/packages/PinchZoomStories/PinchZoom.stories.tsx delete mode 100644 stories/packages/PinchZoomStories/PinchZoomArticleStory.tsx delete mode 100644 stories/packages/PinchZoomStories/index.tsx diff --git a/package.json b/package.json index abe8ea65..8bdb1173 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint:ci": "commitlint --from HEAD~0 --to HEAD --verbose", "tsc": "tsc", "start": "expo start", - "start:reset": "watchman watch-del-all && lsof -t -i :8081 | xargs kill && expo start-c", + "start:reset": "watchman watch-del-all && lsof -t -i :8081 | xargs kill && expo start -c", "jest": "jest --runInBand", "android": "expo start --android", "ios": "expo start --ios", diff --git a/packages/CalendarCarousel/index.tsx b/packages/CalendarCarousel/index.tsx index a45c2a4d..6b03ab4f 100644 --- a/packages/CalendarCarousel/index.tsx +++ b/packages/CalendarCarousel/index.tsx @@ -149,6 +149,16 @@ function CalendarCarousel({ data={dates} horizontal keyExtractor={(_, i) => `calendar-${i}`} + onScrollEndDrag={() => { + if (index !== 1) { + setCurrentDate( + index === 0 + ? subMonths(currentDate, 1) + : addMonths(currentDate, 1), + ); + flatListRef.current?.scrollToIndex({index: 1, animated: false}); + } + }} onScrollToIndexFailed={() => { const wait = new Promise((resolve) => setTimeout(resolve, 500)); wait.then(() => { @@ -159,6 +169,7 @@ function CalendarCarousel({ ref={flatListRef} renderItem={({item}) => ( { onSelectDate?.(selectedDateObj.date); @@ -169,26 +180,15 @@ function CalendarCarousel({ flatListRef.current?.scrollToIndex({index: 1, animated: false}); } }} - dateObjects={item} - width={width} + renderDate={renderDate} selectedDateObject={selectedDateObject} showNextDates={showNextDates} showPrevDates={showPrevDates} - renderDate={renderDate} styles={styles?.date} + width={width} /> )} scrollEventThrottle={16} - onScrollEndDrag={() => { - if (index !== 1) { - setCurrentDate( - index === 0 - ? subMonths(currentDate, 1) - : addMonths(currentDate, 1), - ); - flatListRef.current?.scrollToIndex({index: 1, animated: false}); - } - }} // https://stackoverflow.com/a/60320726/8841562 showsHorizontalScrollIndicator={false} viewabilityConfigCallbackPairs={viewabilityConfigCallbackPairs.current} diff --git a/stories/packages/PinchZoomStories/PinchZoom.stories.tsx b/stories/packages/PinchZoomStories/PinchZoom.stories.tsx new file mode 100644 index 00000000..2a99d48b --- /dev/null +++ b/stories/packages/PinchZoomStories/PinchZoom.stories.tsx @@ -0,0 +1,29 @@ +import type {ComponentProps} from 'react'; +import type {Meta, StoryObj} from '@storybook/react'; + +import {DoobooProvider} from '../../../main'; +import type {PinchZoom} from '../../../packages/PinchZoom'; + +import Component from './PinchZoomImageListStory'; + +const meta = { + title: 'PinchZoom', + // @ts-ignore + component: Component, + argTypes: {}, + decorators: [ + (Story) => ( + + + + ), + ], +} satisfies Meta>; + +export default meta; + +type Story = StoryObj; + +export const Basic: Story = { + args: {}, +}; diff --git a/stories/packages/PinchZoomStories/PinchZoomArticleStory.tsx b/stories/packages/PinchZoomStories/PinchZoomArticleStory.tsx deleted file mode 100644 index 3ddf62ad..00000000 --- a/stories/packages/PinchZoomStories/PinchZoomArticleStory.tsx +++ /dev/null @@ -1,27 +0,0 @@ -// Caveat: Expo web needs React to be imported -import styled from '@emotion/native'; - -import {PinchZoom} from '../../../packages/PinchZoom/lib'; - -const TitleText = styled.Text` - font-size: 16px; -`; - -const ContentText = styled.Text` - font-size: 14px; -`; - -function PinchZoomArticleStory(): JSX.Element { - return ( - - Article Title - - {`This block is for the content of the article. \ -PinchZoom works at only Image but also other views. So, let's zoom in with your fingers. -`} - - - ); -} - -export default PinchZoomArticleStory; diff --git a/stories/packages/PinchZoomStories/index.tsx b/stories/packages/PinchZoomStories/index.tsx deleted file mode 100644 index 159d710f..00000000 --- a/stories/packages/PinchZoomStories/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -// Caveat: Expo web needs React to be imported -import React from 'react'; -import {storiesOf} from '@storybook/react-native'; - -import {renderStory} from '../../Common'; - -import PinchZoomArticleStory from './PinchZoomArticleStory'; -import PinchZoomImageListStory from './PinchZoomImageListStory'; -import PinchZoomImageSliderStory from './PinchZoomImageSliderStory'; - -storiesOf('[Package] PinchZoom', module) - .add('ImageSlider', () => renderStory()) - .add('Article', () => renderStory()) - .add('ImageList', () => renderStory()); diff --git a/yarn.lock b/yarn.lock index e4325a60..3f19efe6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1947,7 +1947,7 @@ dependencies: regenerator-runtime "^0.14.0" -"@babel/runtime@^7.12.0", "@babel/runtime@^7.13.10": +"@babel/runtime@^7.12.0", "@babel/runtime@^7.13.10", "@babel/runtime@^7.21.0": version "7.23.9" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.9.tgz#47791a15e4603bb5f905bc0753801cf21d6345f7" integrity sha512-0CX6F+BI2s9dkUqr08KFrAIZgNFj75rdBU/DjCyYLIaV/quFjkk6T+EJ2LkZHyZTbEV4L5p97mNkUsHl2wLFAw== @@ -11103,11 +11103,6 @@ internal-slot@^1.0.5: has "^1.0.3" side-channel "^1.0.4" -intl@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/intl/-/intl-1.2.5.tgz#82244a2190c4e419f8371f5aa34daa3420e2abde" - integrity sha512-rK0KcPHeBFBcqsErKSpvZnrOmWOj+EmDkyJ57e90YWaQNqbcivcqmKDlHEeNprDWOsKzPsh1BfSpPQdDvclHVw== - invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"