Skip to content

Commit f6e0ffc

Browse files
RayKay91RayKay91
authored andcommitted
fix: some bugs
1 parent 178f808 commit f6e0ffc

File tree

7 files changed

+1560
-1499
lines changed

7 files changed

+1560
-1499
lines changed

babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
module.exports = {
22
presets: ['module:metro-react-native-babel-preset'],
3+
plugins: ['react-native-reanimated/plugin'],
34
};

example/babel.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = function (api) {
1717
},
1818
},
1919
],
20+
'react-native-reanimated/plugin',
2021
],
2122
};
2223
};

example/package.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,23 @@
99
"web": "expo start --web"
1010
},
1111
"dependencies": {
12+
"@types/react": "~18.0.24",
13+
"@types/react-native": "~0.70.6",
1214
"expo": "~47.0.12",
1315
"expo-status-bar": "~1.4.2",
1416
"react": "18.1.0",
15-
"react-native": "0.70.5",
1617
"react-dom": "18.1.0",
17-
"react-native-web": "~0.18.9"
18+
"react-native": "0.70.5",
19+
"react-native-gesture-handler": "~2.8.0",
20+
"react-native-reanimated": "~2.12.0",
21+
"react-native-web": "~0.18.9",
22+
"typescript": "^4.6.3"
1823
},
1924
"devDependencies": {
2025
"@babel/core": "^7.12.9",
21-
"babel-plugin-module-resolver": "^4.1.0",
2226
"@expo/webpack-config": "^0.17.2",
23-
"babel-loader": "^8.1.0"
27+
"babel-loader": "^8.1.0",
28+
"babel-plugin-module-resolver": "^4.1.0"
2429
},
2530
"private": true
26-
}
31+
}

example/yarn.lock

Lines changed: 1498 additions & 1448 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
"peerDependencies": {
8181
"react": "*",
8282
"react-native": "*",
83-
"react-native-gesture-handler": "^2.3.X",
8483
"react-native-reanimated": "^2.5.X"
8584
},
8685
"engines": {
@@ -161,7 +160,7 @@
161160
]
162161
},
163162
"dependencies": {
164-
"react-native-gesture-handler": "^2.3.X",
165-
"react-native-reanimated": "^2.5.X"
163+
"react-native-gesture-handler": "2.8",
164+
"react-native-reanimated": "2.12"
166165
}
167166
}

src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function EasterEgg({
7474
props.onGestureStart?.();
7575

7676
const didStartMovingOnXAxis =
77-
Math.abs(e.velocityX) > Math.abs(e.velocityY);
77+
Math.abs(e.translationX) > Math.abs(e.translationY);
7878

7979
lock.value = didStartMovingOnXAxis ? AxisLock.X : AxisLock.Y;
8080
setTimeout(() => (inputs.value = []), resetTimer);
@@ -103,8 +103,6 @@ export function EasterEgg({
103103
);
104104
const onEnd = useCallback(
105105
(e: GestureUpdateEvent<PanGestureHandlerEventPayload>) => {
106-
props.onGestureEnd?.();
107-
108106
const fingerDidGoRight = e.translationX > 0;
109107
const fingerDidGoDown = e.translationY > 0;
110108

@@ -115,6 +113,7 @@ export function EasterEgg({
115113
} else {
116114
inputs.value.push(fingerDidGoDown ? Directions.DOWN : Directions.UP);
117115
}
116+
props.onGestureEnd?.();
118117
x.value = withSpring(0);
119118
y.value = withSpring(0);
120119
lock.value = null;
@@ -148,6 +147,7 @@ export function EasterEgg({
148147

149148
return (
150149
<GestureDetector gesture={panGesture}>
150+
{/* @ts-ignore @todo solve resolution of element type. */}
151151
<Reanimated.View style={animatedStyle}>{props.children}</Reanimated.View>
152152
</GestureDetector>
153153
);

yarn.lock

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,11 +1397,11 @@
13971397
strip-ansi "^6.0.0"
13981398

13991399
"@jest/create-cache-key-function@^29.0.3":
1400-
version "29.4.2"
1401-
resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.4.2.tgz#cc8e966c28fd3bed309b0487de2e0bd12cbf519f"
1402-
integrity sha512-o2weIg3h8/7+jXF6EjcOiz9TAlNMtcmeH5IARTVgHs3IoQGbh5E/ZLLskfEsHVIYoCKgx+v093Vf8hOgMWggvg==
1400+
version "29.4.3"
1401+
resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.4.3.tgz#ea37769f69523019d81ee089a25a62550f209eb7"
1402+
integrity sha512-AJVFQTTy6jnZAQiAZrdOaTAPzJUrvAE/4IMe+Foav6WPhypFszqg7a4lOTyuzYQEEiT5RSrGYg9IY+/ivxiyXw==
14031403
dependencies:
1404-
"@jest/types" "^29.4.2"
1404+
"@jest/types" "^29.4.3"
14051405

14061406
"@jest/environment@^28.1.3":
14071407
version "28.1.3"
@@ -1487,10 +1487,10 @@
14871487
dependencies:
14881488
"@sinclair/typebox" "^0.24.1"
14891489

1490-
"@jest/schemas@^29.4.2":
1491-
version "29.4.2"
1492-
resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.2.tgz#cf7cfe97c5649f518452b176c47ed07486270fc1"
1493-
integrity sha512-ZrGzGfh31NtdVH8tn0mgJw4khQuNHiKqdzJAFbCaERbyCP9tHlxWuL/mnMu8P7e/+k4puWjI1NOzi/sFsjce/g==
1490+
"@jest/schemas@^29.4.3":
1491+
version "29.4.3"
1492+
resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788"
1493+
integrity sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg==
14941494
dependencies:
14951495
"@sinclair/typebox" "^0.25.16"
14961496

@@ -1578,12 +1578,12 @@
15781578
"@types/yargs" "^17.0.8"
15791579
chalk "^4.0.0"
15801580

1581-
"@jest/types@^29.4.2":
1582-
version "29.4.2"
1583-
resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.4.2.tgz#8f724a414b1246b2bfd56ca5225d9e1f39540d82"
1584-
integrity sha512-CKlngyGP0fwlgC1BRUtPZSiWLBhyS9dKwKmyGxk8Z6M82LBEGB2aLQSg+U1MyLsU+M7UjnlLllBM2BLWKVm/Uw==
1581+
"@jest/types@^29.4.3":
1582+
version "29.4.3"
1583+
resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.4.3.tgz#9069145f4ef09adf10cec1b2901b2d390031431f"
1584+
integrity sha512-bPYfw8V65v17m2Od1cv44FH+SiKW7w2Xu7trhcdTLUmSv85rfKsP+qXSjO4KGJr4dtPSzl/gvslZBXctf1qGEA==
15851585
dependencies:
1586-
"@jest/schemas" "^29.4.2"
1586+
"@jest/schemas" "^29.4.3"
15871587
"@types/istanbul-lib-coverage" "^2.0.0"
15881588
"@types/istanbul-reports" "^3.0.0"
15891589
"@types/node" "*"
@@ -2051,9 +2051,9 @@
20512051
integrity sha512-1P1OROm/rdubP5aFDSZQILU0vrLCJ4fvHt6EoqHEM+2D/G5MK3bIaymUKLit8Js9gbns5UyJnkP/TZROLw4tUA==
20522052

20532053
"@sinclair/typebox@^0.25.16":
2054-
version "0.25.21"
2055-
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.21.tgz#763b05a4b472c93a8db29b2c3e359d55b29ce272"
2056-
integrity sha512-gFukHN4t8K4+wVC+ECqeqwzBDeFeTzBXroBTqE6vcWrQGbEUpHO7LYdG0f4xnvYq4VOEwITSlHlp0JBAIFMS/g==
2054+
version "0.25.23"
2055+
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.23.tgz#1c15b0d2b872d89cc0f47c7243eacb447df8b8bd"
2056+
integrity sha512-VEB8ygeP42CFLWyAJhN5OklpxUliqdNEUcXb4xZ/CINqtYGTjL5ukluKdKzQ0iWdUxyQ7B0539PAUhHKrCNWSQ==
20572057

20582058
"@sindresorhus/is@^5.2.0":
20592059
version "5.3.0"
@@ -2156,6 +2156,11 @@
21562156
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812"
21572157
integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==
21582158

2159+
"@types/invariant@^2.2.35":
2160+
version "2.2.35"
2161+
resolved "https://registry.yarnpkg.com/@types/invariant/-/invariant-2.2.35.tgz#cd3ebf581a6557452735688d8daba6cf0bd5a3be"
2162+
integrity sha512-DxX1V9P8zdJPYQat1gHyY0xj3efl8gnMVjiM9iCY6y27lj+PoQWkgjt8jDqmovPqULkKVpKRg8J36iQiA+EtEg==
2163+
21592164
"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1":
21602165
version "2.0.4"
21612166
resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz#8467d4b3c087805d63580480890791277ce35c44"
@@ -3070,9 +3075,9 @@ camelcase@^7.0.0:
30703075
integrity sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==
30713076

30723077
caniuse-lite@^1.0.30001449:
3073-
version "1.0.30001452"
3074-
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001452.tgz#dff7b8bb834b3a91808f0a9ff0453abb1fbba02a"
3075-
integrity sha512-Lkp0vFjMkBB3GTpLR8zk4NwW5EdRdnitwYJHDOOKIU85x4ckYCPQ+9WlVvSVClHxVReefkUMtWZH2l9KGlD51w==
3078+
version "1.0.30001453"
3079+
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001453.tgz#6d3a1501622bf424a3cee5ad9550e640b0de3de8"
3080+
integrity sha512-R9o/uySW38VViaTrOtwfbFEiBFUh7ST3uIG4OEymIG3/uKdHDO4xk/FaqfUw0d+irSUyFPy3dZszf9VvSTPnsA==
30763081

30773082
30783083
version "5.1.2"
@@ -3900,9 +3905,9 @@ [email protected]:
39003905
integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==
39013906

39023907
electron-to-chromium@^1.4.284:
3903-
version "1.4.295"
3904-
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.295.tgz#911d5df67542bf7554336142eb302c5ec90bba66"
3905-
integrity sha512-lEO94zqf1bDA3aepxwnWoHUjA8sZ+2owgcSZjYQy0+uOSEclJX0VieZC+r+wLpSxUHRd6gG32znTWmr+5iGzFw==
3908+
version "1.4.299"
3909+
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.299.tgz#faa2069cd4879a73e540e533178db5c618768d41"
3910+
integrity sha512-lQ7ijJghH6pCGbfWXr6EY+KYCMaRSjgsY925r1p/TlpSfVM1VjHTcn1gAc15VM4uwti283X6QtjPTXdpoSGiZQ==
39063911

39073912
emittery@^0.10.2:
39083913
version "0.10.2"
@@ -4256,9 +4261,9 @@ esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0:
42564261
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
42574262

42584263
esquery@^1.4.0:
4259-
version "1.4.0"
4260-
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5"
4261-
integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==
4264+
version "1.4.2"
4265+
resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.2.tgz#c6d3fee05dd665808e2ad870631f221f5617b1d1"
4266+
integrity sha512-JVSoLdTlTDkmjFmab7H/9SL9qGSyjElT3myyKp7krqjVFQCDLmj1QFaCLRFBszBKI0XVZaiiXvuPIX3ZwHe1Ng==
42624267
dependencies:
42634268
estraverse "^5.1.0"
42644269

@@ -4575,9 +4580,9 @@ flatted@^3.1.0:
45754580
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
45764581

45774582
flow-parser@0.*:
4578-
version "0.199.1"
4579-
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.199.1.tgz#d2e37d3ccd3a4301738a429079a41320a54ada57"
4580-
integrity sha512-Mt+GFUQYij3miM7Z6o8E3aHTGXZKSOhvlCFgdQRoi6fkWfhyijnoX51zpOxM5PmZuiV6gallWhDZzwOsWxRutg==
4583+
version "0.200.0"
4584+
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.200.0.tgz#7cbdd4cace2843e2fd6098df68247b3876f55917"
4585+
integrity sha512-01eYYVlCEO2p6JexhTbMbDNPeDKQZV++SJbaHE/HzypTkV83oJmsJQVjVCGD8FYWiQ3ha9ALD/AHwsFhPwnZJA==
45814586

45824587
flow-parser@^0.121.0:
45834588
version "0.121.0"
@@ -8000,10 +8005,10 @@ react-native-codegen@^0.70.6:
80008005
jscodeshift "^0.13.1"
80018006
nullthrows "^1.1.1"
80028007

8003-
react-native-gesture-handler@^2.3.X:
8004-
version "2.9.0"
8005-
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.9.0.tgz#2f63812e523c646f25b9ad660fc6f75948e51241"
8006-
integrity sha512-a0BcH3Qb1tgVqUutc6d3VuWQkI1AM3+fJx8dkxzZs9t06qA27QgURYFoklpabuWpsUTzuKRpxleykp25E8m7tg==
8008+
react-native-gesture-handler@2.8:
8009+
version "2.8.0"
8010+
resolved "https://registry.yarnpkg.com/react-native-gesture-handler/-/react-native-gesture-handler-2.8.0.tgz#ef9857871c10663c95a51546225b6e00cd4740cf"
8011+
integrity sha512-poOSfz/w0IyD6Qwq7aaIRRfEaVTl1ecQFoyiIbpOpfNTjm2B1niY2FLrdVQIOtIOe+K9nH55Qal04nr4jGkHdQ==
80078012
dependencies:
80088013
"@egjs/hammerjs" "^2.0.17"
80098014
hoist-non-react-statics "^3.3.0"
@@ -8016,14 +8021,14 @@ react-native-gradle-plugin@^0.70.3:
80168021
resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz#cbcf0619cbfbddaa9128701aa2d7b4145f9c4fc8"
80178022
integrity sha512-oOanj84fJEXUg9FoEAQomA8ISG+DVIrTZ3qF7m69VQUJyOGYyDZmPqKcjvRku4KXlEH6hWO9i4ACLzNBh8gC0A==
80188023

8019-
react-native-reanimated@^2.5.X:
8020-
version "2.14.4"
8021-
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-2.14.4.tgz#3fa3da4e7b99f5dfb28f86bcf24d9d1024d38836"
8022-
integrity sha512-DquSbl7P8j4SAmc+kRdd75Ianm8G+IYQ9T4AQ6lrpLVeDkhZmjWI0wkutKWnp6L7c5XNVUrFDUf69dwETLCItQ==
8024+
react-native-reanimated@2.12:
8025+
version "2.12.0"
8026+
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-2.12.0.tgz#5821eecfb1769b1617a67a2d4dec12fdeedb2b6e"
8027+
integrity sha512-nrlPyw+Hx9u4iJhZk9PoTvDo/QmVAd+bo7OK9Tv3hveNEF9++5oig/g3Uv9V93shy9avTYGsUprUvAEt/xdzeQ==
80238028
dependencies:
80248029
"@babel/plugin-transform-object-assign" "^7.16.7"
80258030
"@babel/preset-typescript" "^7.16.7"
8026-
convert-source-map "^1.7.0"
8031+
"@types/invariant" "^2.2.35"
80278032
invariant "^2.2.4"
80288033
lodash.isequal "^4.5.0"
80298034
setimmediate "^1.0.5"
@@ -8259,9 +8264,9 @@ regexpp@^3.2.0:
82598264
integrity sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==
82608265

82618266
regexpu-core@^5.2.1:
8262-
version "5.3.0"
8263-
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.0.tgz#4d0d044b76fedbad6238703ae84bfdedee2cf074"
8264-
integrity sha512-ZdhUQlng0RoscyW7jADnUZ25F5eVtHdMyXSb2PiwafvteRAOJUjFoUPEYZSIfP99fBIs3maLIRfpEddT78wAAQ==
8267+
version "5.3.1"
8268+
resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-5.3.1.tgz#66900860f88def39a5cb79ebd9490e84f17bcdfb"
8269+
integrity sha512-nCOzW2V/X15XpLsK2rlgdwrysrBq+AauCn+omItIz4R1pIcmeot5zvjdmOBRLzEH/CkC6IxMJVmxDe3QcMuNVQ==
82658270
dependencies:
82668271
"@babel/regjsgen" "^0.8.0"
82678272
regenerate "^1.4.2"

0 commit comments

Comments
 (0)