Skip to content

Commit

Permalink
Merge pull request #30857 from tsa321/ios-scrti
Browse files Browse the repository at this point in the history
Fix ios and msafari to scroll text of edit message to bottom when click edit comment
  • Loading branch information
tylerkaraszewski authored Nov 6, 2023
2 parents b852d71 + 657b79e commit 55799dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ function ReportActionItemMessageEdit(props) {
[props.action.reportActionID],
);

// Scroll content of textInputRef to bottom
useEffect(() => {
if (!textInputRef.current) {
return;
}
textInputRef.current.focus();
textInputRef.current.scrollTop = textInputRef.current.scrollHeight;
}, []);

useEffect(() => {
// For mobile Safari, updating the selection prop on an unfocused input will cause it to automatically gain focus
// and subsequent programmatic focus shifts (e.g., modal focus trap) to show the blue frame (:focus-visible style),
Expand Down
1 change: 1 addition & 0 deletions src/pages/home/report/ReportActionsList.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ function ReportActionsList({
keyboardShouldPersistTaps="handled"
onLayout={onLayoutInner}
onScroll={trackVerticalScrolling}
onScrollToIndexFailed={() => {}}
extraData={extraData}
/>
</Animated.View>
Expand Down

0 comments on commit 55799dc

Please sign in to comment.