Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions app/note/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
Alert,
BackHandler,
Keyboard,
KeyboardAvoidingView,
Platform,
StyleSheet,
View,
useWindowDimensions,
Expand Down Expand Up @@ -529,8 +531,19 @@
...state,
textBoxes: [...state.textBoxes, box],
}));
const needsTrailingBlankPage = pageIndex >= enginePages.length - 1;
const ensureTrailingBlankPage = needsTrailingBlankPage
? canvasRef.current?.addPage({ force: true, scroll: false })

Check failure on line 536 in app/note/[id].tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Expected 0 arguments, but got 1.

Check failure on line 536 in app/note/[id].tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Expected 0 arguments, but got 1.

Check failure on line 536 in app/note/[id].tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Expected 0 arguments, but got 1.
: Promise.resolve();
void ensureTrailingBlankPage?.finally(() => {
// Wait for the keyboard and its layout resize before positioning the
// active line. This preserves the user's current page position.
setTimeout(() => {
canvasRef.current?.revealPagePosition(pageIndex, box.y, true);

Check failure on line 542 in app/note/[id].tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Property 'revealPagePosition' does not exist on type 'InfiniteInkCanvasRef'.

Check failure on line 542 in app/note/[id].tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Property 'revealPagePosition' does not exist on type 'InfiniteInkCanvasRef'.

Check failure on line 542 in app/note/[id].tsx

View workflow job for this annotation

GitHub Actions / Typecheck

Property 'revealPagePosition' does not exist on type 'InfiniteInkCanvasRef'.
}, 250);
});
},
[mutateOverlay],
[enginePages.length, mutateOverlay],
);

const handleUpdateTextBox = useCallback(
Expand Down Expand Up @@ -752,7 +765,10 @@
onExport={() => void handleExport()}
/>

<View style={styles.canvasArea}>
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={styles.canvasArea}
>
<InfiniteInkCanvas
ref={canvasRef}
style={styles.flex}
Expand Down Expand Up @@ -788,7 +804,7 @@
onRemoveInsertedElement={handleRemoveInsertedElement}
onCreateTextBoxId={textBoxId}
/>
</View>
</KeyboardAvoidingView>

<FloatingToolbar
activeTool={toolState.toolType as ToolDescriptor['type']}
Expand Down
4 changes: 3 additions & 1 deletion src/components/editor/OverlayLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ export function OverlayLayer({
x: Math.max(0, coord.x - 6),
y: Math.max(0, coord.y - 12),
width: 240,
height: 36,
// Give a new note enough room for several lines before its internal
// editor needs to scroll.
height: 120,
content: '',
color: activeColor,
fontSize: 18,
Expand Down
4 changes: 3 additions & 1 deletion src/components/editor/TextBoxOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ export function TextBoxOverlay({
value={localContent}
onChangeText={handleContentChange}
multiline
scrollEnabled={false}
// Keep the insertion point reachable when the text is longer
// than the box, particularly while the software keyboard is up.
scrollEnabled
style={[
styles.input,
{
Expand Down
Loading