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.
- package/lib/commonjs/hooks/use-inline-auto-width.js +24 -1
- package/lib/commonjs/hooks/use-inline-auto-width.js.map +1 -1
- package/lib/commonjs/hooks/use-text-glyphs.js +24 -21
- package/lib/commonjs/hooks/use-text-glyphs.js.map +1 -1
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/view/glyph-run.js +38 -19
- package/lib/commonjs/view/glyph-run.js.map +1 -1
- package/lib/commonjs/view/text-run.js +4 -0
- package/lib/commonjs/view/text-run.js.map +1 -1
- package/lib/module/hooks/use-inline-auto-width.js +24 -1
- package/lib/module/hooks/use-inline-auto-width.js.map +1 -1
- package/lib/module/hooks/use-text-glyphs.js +24 -21
- package/lib/module/hooks/use-text-glyphs.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/view/glyph-run.js +39 -20
- package/lib/module/view/glyph-run.js.map +1 -1
- package/lib/module/view/text-run.js +4 -0
- package/lib/module/view/text-run.js.map +1 -1
- package/lib/typescript/commonjs/hooks/use-inline-auto-width.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/use-text-glyphs.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/view/glyph-run.d.ts +3 -1
- package/lib/typescript/commonjs/view/glyph-run.d.ts.map +1 -1
- package/lib/typescript/commonjs/view/text-run.d.ts +2 -1
- package/lib/typescript/commonjs/view/text-run.d.ts.map +1 -1
- package/lib/typescript/module/hooks/use-inline-auto-width.d.ts.map +1 -1
- package/lib/typescript/module/hooks/use-text-glyphs.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/view/glyph-run.d.ts +3 -1
- package/lib/typescript/module/view/glyph-run.d.ts.map +1 -1
- package/lib/typescript/module/view/text-run.d.ts +2 -1
- package/lib/typescript/module/view/text-run.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/hooks/use-inline-auto-width.ts +33 -1
- package/src/hooks/use-text-glyphs.ts +35 -28
- package/src/index.tsx +1 -0
- package/src/view/glyph-run.tsx +62 -33
- package/src/view/text-run.tsx +10 -0
package/src/view/text-run.tsx
CHANGED
|
@@ -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
|