Commit f64c614
authored
feat: add web support via CSS transitions (#3)
* feat: add web support via CSS transitions
Implement EaseView.web.tsx that uses CSS transitions for timing animations,
CSS @Keyframes for loop animations, and a timing approximation for springs.
React Native's .web.tsx resolution automatically picks this up on web.
* feat(example): add Expo for web support
Install expo and web dependencies (react-dom, react-native-web,
@expo/metro-runtime) to enable running the example app on web
via `npx expo start --web`.
* chore(example): expo web setup - fix web entry config
* fix(web): use StyleSheet.flatten to resolve RN style IDs/arrays
The web EaseView receives RN StyleSheet numeric IDs and style arrays,
but was trying to spread them directly as React.CSSProperties. Spreading
an array gives {0: id} which caused:
TypeError: Failed to set an indexed property [0] on CSSStyleDeclaration
Fix: use StyleSheet.flatten() to resolve any RN StyleProp to a plain
object before spreading into computedStyle.
* refactor(web): use View from react-native instead of raw div
Replace the raw <div> with react-native View which:
- Handles StyleSheet flattening automatically (no more manual flattenStyle)
- Accepts StyleProp<ViewStyle> natively
- Converts RN transform arrays to CSS transforms via react-native-web
- Properly handles all RN style types (numeric IDs, arrays, objects)
CSS transitions and keyframe animations are applied imperatively via
the DOM ref, since View does not expose those as style props.
Also removes accidentally committed .playwright-cli artifacts.
* fix(web): don't override style border-radius/backgroundColor in loop keyframes
Only include border-radius and background-color in CSS @Keyframes
when the user explicitly sets them in animate/initialAnimate props.
Previously, IDENTITY defaults (borderRadius: 0) were always included,
which overrode values set via the style prop (e.g. pulse's borderRadius: 30).
* fix(web): remove will-change hint to fix overflow:hidden clipping
will-change: transform causes the element to be promoted to its own
GPU compositing layer, which can escape parent overflow:hidden clipping
in some browsers. CSS animations already get GPU-promoted automatically,
so the hint is unnecessary.
* fix(example): use useWindowDimensions for banner width on web
BANNER_WIDTH was computed at module load time using Dimensions.get('window')
which bakes in the build-time window width on static web exports. Switched
to useWindowDimensions() hook so the banner correctly sizes to the actual
viewport width at render time.
* fix(web): add dom lib to tsconfig, fix viewRef type, fix app registration for native
* fix(example): remove duplicate gradle-plugin includeBuild for Android CI
* fix(example): fix Android build - deduplicate gradle-plugin includeBuild
* fix(example): fix Android CI - use expo autolinking for gradle-plugin includeBuild
* fix(example): restore gradle-plugin includeBuild in pluginManagement for settings plugin1 parent 899d15d commit f64c614
22 files changed
Lines changed: 2755 additions & 112 deletions
File tree
- example
- android
- app
- src/main/java/ease/example
- ios
- EaseExample.xcodeproj
- EaseExample
- src
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | | - | |
| 22 | + | |
22 | 23 | | |
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
2 | 5 | | |
3 | 6 | | |
4 | 7 | | |
| |||
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
13 | | - | |
| 16 | + | |
14 | 17 | | |
15 | 18 | | |
16 | 19 | | |
| |||
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
26 | 35 | | |
27 | 36 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
4 | 15 | | |
5 | 16 | | |
6 | 17 | | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
5 | | - | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
0 commit comments