diff --git a/src/descriptionFormatter.ts b/src/descriptionFormatter.ts index 4e9f30b..9acccc7 100644 --- a/src/descriptionFormatter.ts +++ b/src/descriptionFormatter.ts @@ -186,6 +186,7 @@ function formatDescription( text = format(text, { ...options, parser: "markdown", + printWidth: printWidth - column, }).trim(); if (isAddedFakeDash) { diff --git a/tests/__snapshots__/paragraph.test.js.snap b/tests/__snapshots__/paragraph.test.js.snap index 7bd70df..312ec05 100644 --- a/tests/__snapshots__/paragraph.test.js.snap +++ b/tests/__snapshots__/paragraph.test.js.snap @@ -183,8 +183,8 @@ exports[`description contain paragraph 4`] = ` exports[`description new line with dash 1`] = ` "/** * We will allow the scroll view to give up its lock iff it acquired the lock - * during an animation. This is a very useful default that happens to satisfy - * many common user experiences. + * during an - animation. This is a very useful default that happens to + * satisfy many common user experiences. * * - Stop a scroll on the left edge, then turn that into an outer view's backswipe. * - Stop a scroll mid-bounce at the top, continue pulling to have the outer view dismiss. @@ -215,6 +215,23 @@ function scrollResponderHandleTerminationRequest() { " `; +exports[`description new line with dash 2`] = ` +"/** + * Measures the \`HitRect\` node on activation. The Bounding rectangle is with + * respect to viewport - not page, so adding the \`pageXOffset/pageYOffset\` + * should result in points that are in the same coordinate system as an + * event's \`globalX/globalY\` data values. + * + * - Consider caching this for the lifetime of the component, or possibly being + * able to share this cache between any \`ScrollMap\` view. + * + * @private + * + * @sideeffects + */ +" +`; + exports[`numbers and code in description 1`] = ` "/** * =========================== PressResponder Tutorial =========================== diff --git a/tests/paragraph.test.js b/tests/paragraph.test.js index fcbab97..550d381 100644 --- a/tests/paragraph.test.js +++ b/tests/paragraph.test.js @@ -89,7 +89,7 @@ test("description new line with dash", () => { const result1 = subject(` /** * We will allow the scroll view to give up its lock iff it acquired the lock - * during an animation. This is a very useful default that happens to satisfy + * during an - animation. This is a very useful default that happens to satisfy * many common user experiences. * * - Stop a scroll on the left edge, then turn that into an outer view's @@ -127,8 +127,25 @@ test("description new line with dash", () => { return !this.state.observedScrollSinceBecomingResponder; } `); - expect(result1).toMatchSnapshot(); + + const result2 = subject(` + /** + * Measures the \`HitRect\` node on activation. The Bounding rectangle is with + * respect to viewport - not page, so adding the \`pageXOffset/pageYOffset\` + * should result in points that are in the same coordinate system as an + * event's \`globalX/globalY\` data values. + * + * - Consider caching this for the lifetime of the component, or possibly being able to share this + * cache between any \`ScrollMap\` view. + * + * @private + * + * @sideeffects + */ + `); + + expect(result2).toMatchSnapshot(); }); test("numbers and code in description", () => { @@ -298,3 +315,12 @@ test("code in description", () => { expect(result1).toMatchSnapshot(); }); + +/** + * If this is a vertical ScrollView scrolls to the bottom. + * If this is a horizontal ScrollView scrolls to the right. + * + * Use `scrollToEnd({ animated: true })` for smooth animated scrolling, + * `scrollToEnd({ animated: false })` for immediate scrolling. + * If no options are passed, `animated` defaults to true. + */