react-native-laminar 1.4.3 → 1.4.5

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.
Files changed (40) hide show
  1. package/lib/commonjs/hooks/use-inline-auto-width.js +24 -1
  2. package/lib/commonjs/hooks/use-inline-auto-width.js.map +1 -1
  3. package/lib/commonjs/hooks/use-text-glyphs.js +24 -21
  4. package/lib/commonjs/hooks/use-text-glyphs.js.map +1 -1
  5. package/lib/commonjs/index.js +1 -0
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/view/glyph-run.js +38 -19
  8. package/lib/commonjs/view/glyph-run.js.map +1 -1
  9. package/lib/commonjs/view/text-run.js +4 -0
  10. package/lib/commonjs/view/text-run.js.map +1 -1
  11. package/lib/module/hooks/use-inline-auto-width.js +24 -1
  12. package/lib/module/hooks/use-inline-auto-width.js.map +1 -1
  13. package/lib/module/hooks/use-text-glyphs.js +24 -21
  14. package/lib/module/hooks/use-text-glyphs.js.map +1 -1
  15. package/lib/module/index.js +1 -0
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/view/glyph-run.js +39 -20
  18. package/lib/module/view/glyph-run.js.map +1 -1
  19. package/lib/module/view/text-run.js +4 -0
  20. package/lib/module/view/text-run.js.map +1 -1
  21. package/lib/typescript/commonjs/hooks/use-inline-auto-width.d.ts.map +1 -1
  22. package/lib/typescript/commonjs/hooks/use-text-glyphs.d.ts.map +1 -1
  23. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  24. package/lib/typescript/commonjs/view/glyph-run.d.ts +3 -1
  25. package/lib/typescript/commonjs/view/glyph-run.d.ts.map +1 -1
  26. package/lib/typescript/commonjs/view/text-run.d.ts +2 -1
  27. package/lib/typescript/commonjs/view/text-run.d.ts.map +1 -1
  28. package/lib/typescript/module/hooks/use-inline-auto-width.d.ts.map +1 -1
  29. package/lib/typescript/module/hooks/use-text-glyphs.d.ts.map +1 -1
  30. package/lib/typescript/module/index.d.ts.map +1 -1
  31. package/lib/typescript/module/view/glyph-run.d.ts +3 -1
  32. package/lib/typescript/module/view/glyph-run.d.ts.map +1 -1
  33. package/lib/typescript/module/view/text-run.d.ts +2 -1
  34. package/lib/typescript/module/view/text-run.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/src/hooks/use-inline-auto-width.ts +33 -1
  37. package/src/hooks/use-text-glyphs.ts +35 -28
  38. package/src/index.tsx +1 -0
  39. package/src/view/glyph-run.tsx +62 -33
  40. package/src/view/text-run.tsx +10 -0
@@ -15,6 +15,7 @@ type TextRunProps = {
15
15
  readonly motionRecipe: MotionRecipe;
16
16
  readonly align: LaminarAlign;
17
17
  readonly leading?: ReactNode;
18
+ readonly leadingLayoutGroup?: boolean;
18
19
  readonly leadingKey?: string | number;
19
20
  readonly leadingGap?: number;
20
21
  readonly ready?: boolean;
@@ -29,6 +30,7 @@ export const TextRun = React.memo(
29
30
  motionRecipe,
30
31
  align,
31
32
  leading,
33
+ leadingLayoutGroup = false,
32
34
  leadingKey,
33
35
  leadingGap = 0,
34
36
  ready = true,
@@ -72,6 +74,10 @@ export const TextRun = React.memo(
72
74
  Boolean(visibleLeading) &&
73
75
  lastLeadingPresenceRef.current &&
74
76
  visibleLeadingKey !== lastLeadingKeyRef.current;
77
+ const isLeadingChange =
78
+ Boolean(visibleLeading) !== lastLeadingPresenceRef.current ||
79
+ (Boolean(visibleLeading) &&
80
+ visibleLeadingKey !== lastLeadingKeyRef.current);
75
81
  // update the worklet flag after commit so render never writes a shared value
76
82
  const leadingSwapProgress = useSharedValue(0);
77
83
  useLayoutEffect(() => {
@@ -127,6 +133,10 @@ export const TextRun = React.memo(
127
133
  layoutTransition={
128
134
  hasAnimated ? motionRecipe.layoutTransition : undefined
129
135
  }
136
+ leadingLayoutTransition={
137
+ isLeadingChange ? motionRecipe.layoutTransition : undefined
138
+ }
139
+ leadingLayoutGroup={leadingLayoutGroup}
130
140
  enterTransition={
131
141
  hasAnimatedRef.current
132
142
  ? motionRecipe.enterTransition