diff --git a/.scripts/post-build.mjs b/.scripts/post-build.mjs index 4cda8c1a..2ed51030 100644 --- a/.scripts/post-build.mjs +++ b/.scripts/post-build.mjs @@ -11,6 +11,10 @@ function createPackageFile() { JSON.parse(packageData) ); + // The dist folder is published as the package root, so "main" must point to + // the entry file relative to dist, not to the source tree. + packageJSON.main = "./index.js"; + return fse.writeFile( `./${BUILD_FOLDER}/package.json`, JSON.stringify(packageJSON, null, 2), diff --git a/package.json b/package.json index 9a0381bc..42d0fd5f 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ ] }, "peerDependencies": { + "@shopify/flash-list": ">=2.3.1", "react-native-device-info": "^10.3.0", "react-native-reanimated": ">=3.6.0", "react-native-safe-area-context": ">=3.3.2", @@ -47,7 +48,6 @@ }, "dependencies": { "@bigbinary/neeto-icons-rn": "^1.0.7", - "@shopify/flash-list": "^1.2.0", "@styled-system/prop-types": "^5.1.5", "dayjs": "^1.11.4", "node-html-parser": "^6.1.5", @@ -79,6 +79,7 @@ "@react-navigation/bottom-tabs": "^6.3.2", "@react-navigation/material-top-tabs": "^6.2.2", "@react-navigation/native": "^6.0.11", + "@shopify/flash-list": "^2.3.1", "@storybook/addon-actions": "^6.5.15", "@storybook/addon-controls": "^6.5.15", "@storybook/addon-essentials": "^6.5.15", diff --git a/src/components/FlashList.jsx b/src/components/FlashList.jsx index ae6c070a..7860bdae 100644 --- a/src/components/FlashList.jsx +++ b/src/components/FlashList.jsx @@ -146,12 +146,21 @@ const FadeInFlatList = React.forwardRef( item: PropTypes.object, }; - const renderItem = item => - isLoading || item.index < props.placeHolderItemCount ? ( - + const shouldAnimate = animationDuration > 0; + + const renderItem = item => { + if (isLoading || item.index < props.placeHolderItemCount) { + return ; + } + + return shouldAnimate ? ( + + {originalRenderItem(item)} + ) : ( originalRenderItem(item) ); + }; useEffect(() => { value.value = 0; diff --git a/src/components/SearchBar.jsx b/src/components/SearchBar.jsx index f8f40f7b..b6c76ee2 100644 --- a/src/components/SearchBar.jsx +++ b/src/components/SearchBar.jsx @@ -137,7 +137,7 @@ export const SearchBar = ({ }} {...searchbarProps} /> - {showCancelButton && searchText.length > 0 && ( + {showCancelButton && (