@onekeyfe/react-native-pager-view 6.7.0-alpha.414 → 6.7.0-alpha.415

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -148,7 +148,12 @@ export function WebCollapsiblePagerPage({
148
148
  owner.addEventListener("keydown", handleKey);
149
149
  owner.addEventListener("ok-collapsible-pager-user-scroll", handleUserInput);
150
150
  owner.addEventListener("ok-collapsible-pager-insets-changed", requestMeasure);
151
- requestMeasure();
151
+ // Measure synchronously while still inside the layout phase: the metrics
152
+ // start at width 0, and deferring this first measurement to the next
153
+ // animation frame let the page paint once at width 0, which collapsed
154
+ // shrinkable page content (a fiat hero wrapped one character per line,
155
+ // OK-66299). Resize and scroll updates stay frame-coalesced.
156
+ measure();
152
157
  return () => {
153
158
  observer.disconnect();
154
159
  observerRef.current = null;
@@ -162,7 +167,7 @@ export function WebCollapsiblePagerPage({
162
167
  if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
163
168
  frameRef.current = null;
164
169
  };
165
- }, [owner, requestMeasure, syncContentObservation]);
170
+ }, [owner, measure, requestMeasure, syncContentObservation]);
166
171
  React.useLayoutEffect(requestMeasure, [isFocused, isRouteActive, headerHeight, stickyHeaderHeight, requestMeasure]);
167
172
  const value = React.useMemo(() => ({
168
173
  isFocused,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-pager-view",
3
- "version": "6.7.0-alpha.414",
3
+ "version": "6.7.0-alpha.415",
4
4
  "description": "React Native wrapper for Android and iOS ViewPager",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/module/index.js",
@@ -43,7 +43,8 @@
43
43
  "prepare": "rm -rf lib && bob build",
44
44
  "typecheck": "tsc -b",
45
45
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
46
- "release": "yarn prepare && npm whoami && npm publish --access public"
46
+ "release": "yarn prepare && npm whoami && npm publish --access public",
47
+ "test": "jest"
47
48
  },
48
49
  "keywords": [
49
50
  "react-native",
@@ -73,7 +74,7 @@
73
74
  "typescript": "^5.9.2"
74
75
  },
75
76
  "peerDependencies": {
76
- "@onekeyfe/react-native-native-logger": "6.7.0-alpha.414",
77
+ "@onekeyfe/react-native-native-logger": "6.7.0-alpha.415",
77
78
  "react": "*",
78
79
  "react-native": "*"
79
80
  },
@@ -110,5 +111,16 @@
110
111
  }
111
112
  }
112
113
  },
113
- "react-native": "./lib/module/index.native.js"
114
+ "react-native": "./lib/module/index.native.js",
115
+ "jest": {
116
+ "preset": "react-native",
117
+ "modulePathIgnorePatterns": [
118
+ "<rootDir>/example/node_modules",
119
+ "<rootDir>/lib/"
120
+ ],
121
+ "watchman": false,
122
+ "testMatch": [
123
+ "<rootDir>/src/**/__tests__/*.test.ts?(x)"
124
+ ]
125
+ }
114
126
  }
@@ -221,7 +221,12 @@ export function WebCollapsiblePagerPage({
221
221
  owner.addEventListener("keydown", handleKey);
222
222
  owner.addEventListener("ok-collapsible-pager-user-scroll", handleUserInput);
223
223
  owner.addEventListener("ok-collapsible-pager-insets-changed", requestMeasure);
224
- requestMeasure();
224
+ // Measure synchronously while still inside the layout phase: the metrics
225
+ // start at width 0, and deferring this first measurement to the next
226
+ // animation frame let the page paint once at width 0, which collapsed
227
+ // shrinkable page content (a fiat hero wrapped one character per line,
228
+ // OK-66299). Resize and scroll updates stay frame-coalesced.
229
+ measure();
225
230
  return () => {
226
231
  observer.disconnect();
227
232
  observerRef.current = null;
@@ -235,7 +240,7 @@ export function WebCollapsiblePagerPage({
235
240
  if (frameRef.current !== null) cancelAnimationFrame(frameRef.current);
236
241
  frameRef.current = null;
237
242
  };
238
- }, [owner, requestMeasure, syncContentObservation]);
243
+ }, [owner, measure, requestMeasure, syncContentObservation]);
239
244
 
240
245
  React.useLayoutEffect(requestMeasure, [isFocused, isRouteActive, headerHeight, stickyHeaderHeight, requestMeasure]);
241
246