Skip to content

Commit a8c2a8b

Browse files
authored
Merge pull request #496 from dohooo/develop
Develop
2 parents 6405922 + fdeef6b commit a8c2a8b

21 files changed

+590
-2070
lines changed

.changeset/hungry-actors-grab.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'react-native-reanimated-carousel': patch
3+
---
4+
5+
re-calculate when window size changed in browser.

babel.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module.exports = {
22
presets: ["module:metro-react-native-babel-preset"],
33
plugins: [
4+
"@babel/plugin-proposal-class-properties",
5+
"@babel/plugin-proposal-private-methods",
46
"react-native-reanimated/plugin",
5-
"inline-dotenv",
67
"@babel/plugin-syntax-dynamic-import",
78
],
89
};

example/app/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"react-native-gesture-handler": "~2.12.0",
2323
"react-native-reanimated": "~3.3.0",
2424
"react-native-safe-area-context": "4.6.3",
25-
"react-native-screens": "~3.22.0",
26-
"react-native-snap-carousel": "^3.9.1"
25+
"react-native-screens": "~3.22.0"
2726
}
2827
}

example/app/src/Home.tsx

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import ScaleFadeInOutComponent from "./pages/scale-fade-in-out";
3535
import StackComponent from "./pages/stack";
3636
import StackCards from "./pages/stack-cards";
3737
import Tear from "./pages/tear";
38-
import { isAndroid, isIos } from "./utils";
3938
import { useWebContext } from "./store/WebProvider";
4039
import { convertName } from "./utils/helpers";
4140
import { useColor } from "./hooks/useColor";
@@ -146,29 +145,6 @@ export const ExperimentPage = [
146145
},
147146
];
148147

149-
if (isIos || isAndroid) {
150-
// Not support to WEB (react-native-snap-carousel)
151-
const SnapCarouselComplexComponent = React.lazy(
152-
() => import("./pages/snap-carousel-complex"),
153-
);
154-
const SnapCarouselLoopComponent = React.lazy(
155-
() => import("./pages/snap-carousel-loop"),
156-
);
157-
158-
ExperimentPage.push(
159-
{
160-
name: "snap-carousel-complex",
161-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
162-
// @ts-expect-error
163-
page: SnapCarouselComplexComponent,
164-
},
165-
{
166-
name: "snap-carousel-loop",
167-
page: SnapCarouselLoopComponent,
168-
},
169-
);
170-
}
171-
172148
const ListItem = ({ name, onPress, color }: { name: string; onPress: () => void; color: string }) => (
173149
<TouchableOpacity onPress={onPress}>
174150
<View style={styles.listItem}>

example/app/src/pages/normal/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ import { SafeAreaView } from "react-native-safe-area-context";
77
import { SBItem } from "../../components/SBItem";
88
import SButton from "../../components/SButton";
99
import { ElementsText, window } from "../../constants";
10+
import { useWindowDimensions } from "react-native";
1011

1112
const PAGE_WIDTH = window.width;
1213

1314
function Index() {
15+
const windowWidth = useWindowDimensions().width;
16+
1417
const [data, setData] = React.useState([...new Array(4).keys()]);
1518
const [isVertical, setIsVertical] = React.useState(false);
1619
const [isFast, setIsFast] = React.useState(false);
@@ -21,12 +24,12 @@ function Index() {
2124
const baseOptions = isVertical
2225
? ({
2326
vertical: true,
24-
width: PAGE_WIDTH,
27+
width: windowWidth,
2528
height: PAGE_WIDTH / 2,
2629
} as const)
2730
: ({
2831
vertical: false,
29-
width: PAGE_WIDTH,
32+
width: windowWidth,
3033
height: PAGE_WIDTH / 2,
3134
} as const);
3235

example/app/src/pages/snap-carousel-complex/index.tsx

Lines changed: 0 additions & 81 deletions
This file was deleted.

example/app/src/pages/snap-carousel-loop/index.tsx

Lines changed: 0 additions & 53 deletions
This file was deleted.

example/expo/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@
3939
"react-native-gesture-handler": "~2.12.0",
4040
"react-native-reanimated": "~3.3.0",
4141
"react-native-safe-area-context": "4.6.3",
42-
"react-native-screens": "~3.22.0",
43-
"react-native-snap-carousel": "^3.9.1"
42+
"react-native-screens": "~3.22.0"
4443
},
4544
"devDependencies": {
4645
"@babel/core": "^7.20.0",
@@ -50,9 +49,7 @@
5049
"@testing-library/jest-native": "^5.4.1",
5150
"@testing-library/react-native": "^11.5.0",
5251
"@types/react": "~18.2.14",
53-
"@types/react-native-snap-carousel": "^3.8.5",
5452
"babel-plugin-import-glob": "^2.0.0",
55-
"babel-plugin-inline-dotenv": "^1.6.0",
5653
"babel-plugin-module-resolver": "^4.1.0",
5754
"gh-pages": "^3.2.3",
5855
"react-error-overlay": "6.0.9",

0 commit comments

Comments
 (0)