Skip to content

Commit 3260e06

Browse files
committed
fix(crash): fix issue with expo sdk 52 causing crash
1 parent 11ba995 commit 3260e06

File tree

7 files changed

+2985
-2989
lines changed

7 files changed

+2985
-2989
lines changed

example/app.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
"orientation": "portrait",
77
"icon": "./assets/icon.png",
88
"userInterfaceStyle": "light",
9+
"newArchEnabled": true,
910
"splash": {
1011
"image": "./assets/splash.png",
1112
"resizeMode": "contain",
1213
"backgroundColor": "#ffffff"
1314
},
14-
"assetBundlePatterns": [
15-
"**/*"
16-
],
15+
"assetBundlePatterns": ["**/*"],
1716
"ios": {
1817
"supportsTablet": true
1918
},

example/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@
1010
},
1111
"dependencies": {
1212
"@gorhom/bottom-sheet": "^4.6.3",
13-
"expo": "~50.0.17",
14-
"expo-status-bar": "~1.11.1",
15-
"react": "18.2.0",
16-
"react-dom": "18.2.0",
17-
"react-native": "0.73.6",
18-
"react-native-gesture-handler": "~2.14.0",
19-
"react-native-reanimated": "~3.6.2",
20-
"react-native-safe-area-context": "4.8.2",
21-
"react-native-web": "~0.19.6"
13+
"expo": "~52.0.38",
14+
"expo-status-bar": "~2.0.1",
15+
"react": "18.3.1",
16+
"react-dom": "18.3.1",
17+
"react-native": "0.76.7",
18+
"react-native-gesture-handler": "~2.20.2",
19+
"react-native-reanimated": "~3.16.1",
20+
"react-native-safe-area-context": "4.12.0",
21+
"react-native-web": "~0.19.13"
2222
},
2323
"devDependencies": {
24-
"@babel/core": "^7.20.0",
24+
"@babel/core": "^7.25.2",
2525
"@expo/webpack-config": "^18.0.1",
2626
"babel-loader": "^8.1.0",
2727
"babel-plugin-module-resolver": "^5.0.0"

example/src/third-party/gorhom-bottom-sheet/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const Example = () => {
5858
>
5959
<MagicScroll.TextInput
6060
name="username"
61+
chainTo="first_name"
6162
textInputProps={{
6263
placeholder: 'Username',
6364
style: {
@@ -70,6 +71,7 @@ const Example = () => {
7071
/>
7172
<MagicScroll.TextInput
7273
name="first_name"
74+
chainTo="last_name"
7375
containerStyle={{ marginTop: 8 }}
7476
textInputProps={{
7577
placeholder: 'First Name',
@@ -83,6 +85,7 @@ const Example = () => {
8385
/>
8486
<MagicScroll.TextInput
8587
name="last_name"
88+
chainTo="email"
8689
containerStyle={{ marginTop: 8 }}
8790
textInputProps={{
8891
placeholder: 'Last Name',
@@ -96,6 +99,7 @@ const Example = () => {
9699
/>
97100
<MagicScroll.TextInput
98101
name="email"
102+
chainTo="password"
99103
containerStyle={{ marginTop: 8 }}
100104
textInputProps={{
101105
placeholder: 'Email',

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@
6767
"eslint-plugin-prettier": "^5.0.1",
6868
"jest": "^29.7.0",
6969
"prettier": "^3.0.3",
70-
"react": "18.2.0",
71-
"react-native": "0.73.6",
72-
"react-native-builder-bob": "^0.23.2",
73-
"react-native-reanimated": "^3.11.0",
70+
"react": "18.3.1",
71+
"react-native": "0.76.7",
72+
"react-native-builder-bob": "^0.37.0",
73+
"react-native-reanimated": "^3.16.1",
7474
"react-native-safe-area-context": "^4.10.5",
75-
"release-it": "^15.0.0",
75+
"release-it": "^17.0.0",
7676
"typescript": "^5.2.2"
7777
},
7878
"resolutions": {
@@ -163,6 +163,6 @@
163163
]
164164
},
165165
"dependencies": {
166-
"jotai": "^2.8.0"
166+
"jotai": "^2.12.2"
167167
}
168168
}

src/Provider.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ import React, {
77
type RefObject,
88
} from 'react';
99
import Animated, {
10-
scrollTo,
1110
useAnimatedRef,
11+
useAnimatedScrollHandler,
1212
useAnimatedStyle,
13-
useDerivedValue,
1413
useSharedValue,
1514
withTiming,
1615
type AnimatedScrollViewProps,
@@ -85,15 +84,15 @@ function InsideScrollView(
8584
additionalPadding?: number;
8685
}>
8786
) {
88-
const { scrollRef, baseScrollViewProps, translateStyle } = useFormSmartScroll(
89-
{ padding: props?.additionalPadding }
90-
);
87+
const { scrollRef, baseScrollViewProps, translateStyle, scrollHandler } =
88+
useFormSmartScroll({ padding: props?.additionalPadding });
9189

9290
return (
9391
<Animated.ScrollView
9492
ref={scrollRef}
9593
{...baseScrollViewProps}
9694
{...props.scrollViewProps}
95+
onScroll={scrollHandler}
9796
>
9897
<Animated.View style={translateStyle}>{props.children}</Animated.View>
9998
</Animated.ScrollView>
@@ -136,6 +135,11 @@ export function useFormSmartScroll({
136135

137136
const currentFocus = useAtomValue(currentFocusAtom);
138137

138+
const scrollHandler = useAnimatedScrollHandler((event) => {
139+
console.log('event', event.contentOffset.y);
140+
scrollY.value = event.contentOffset.y;
141+
});
142+
139143
// we have a flick on first focus so we make the scrollview wait a bit before animate
140144
useLayoutEffect(() => {
141145
if (currentFocus && !isReady) {
@@ -218,10 +222,6 @@ export function useFormSmartScroll({
218222
[inputs]
219223
);
220224

221-
useDerivedValue(() => {
222-
scrollTo(scrollRef, 0, scrollY.value, false);
223-
});
224-
225225
const onFocus = useCallback(
226226
(name: string) => () => {
227227
setState((s) => ({
@@ -300,5 +300,6 @@ export function useFormSmartScroll({
300300
baseTextInputProps,
301301
currentFocus: currentFocus?.name,
302302
isReady,
303+
scrollHandler,
303304
};
304305
}

src/__tests__/index.test.tsx

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)