-
Notifications
You must be signed in to change notification settings - Fork 3.5k
When you long-press on a message in iOS mobile, the message moves out of the screen frame and is hidden (iOS only) #16356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
terrysahaidak
wants to merge
137
commits into
Expensify:main
from
margelo:fix/10632-when-long-press-on-message-add-space-for-image
Closed
Changes from 105 commits
Commits
Show all changes
137 commits
Select commit
Hold shift + click to select a range
1c6d612
WIP iOS
terrysahaidak 4facf63
iOS version kinda works
terrysahaidak 8034696
Clean up stuff
terrysahaidak 8b13bb5
More clean up
terrysahaidak 135f2f9
More clean up
terrysahaidak 59e97e7
Use state machine
terrysahaidak 2c80f08
Fix formatting issues
terrysahaidak ad9e6f9
use remoteVariable instead of global in worklets
terrysahaidak 7967c29
Fix crash
terrysahaidak 9fae48f
Improve keyboard handling on iOS
terrysahaidak 5e730d5
Do not blur keyboard when opening emoji picker
terrysahaidak b086a9b
Add safe area, emoji picker after action sheet handling
terrysahaidak 5e849c9
Add mock file for other platforms
terrysahaidak b48a65e
Fix bottom inset in keyboard avoiding view
terrysahaidak 1fa4d3f
cleanup
terrysahaidak b3ec31d
More cleanup; fix other platforms
terrysahaidak 5308a6d
Handle attachments and delete modal
terrysahaidak 3ba462e
Handle attachments long press
terrysahaidak 76b0653
Remove handling edit
terrysahaidak f44bd06
Fix errors on other platforms
terrysahaidak 7680f97
Merge remote-tracking branch 'upstream/main' into fix/10632-when-long…
terrysahaidak f1f9c63
More cleanup and some comments
terrysahaidak 0797298
Move files into a folder
terrysahaidak 8a417b8
Merge remote-tracking branch 'upstream/main' into fix/10632-when-long…
terrysahaidak 9f5ebfc
Merge remote-tracking branch 'upstream/main' into fix/10632-when-long…
terrysahaidak d7d0d87
Fix rebase typo
terrysahaidak e2af955
Add more comments
terrysahaidak c5cc218
Fix logging state machine actions
terrysahaidak 68bde8f
Merge remote-tracking branch 'upstream/main' into fix/10632-when-long…
terrysahaidak d9fa70f
format code consistently
terrysahaidak 4e75927
Handle call popover
terrysahaidak 8f88de1
Refactor code
terrysahaidak e725644
Add missing actions
terrysahaidak ceb0df8
Fix crash, use safer useState instead of useMemo
terrysahaidak bbde049
wip attachment modal handling; some review requests
terrysahaidak 8a02c22
Merge remote-tracking branch 'upstream/main' into fix/10632-when-long…
terrysahaidak 4d2c6dc
Fix crash
terrysahaidak b4a50f1
Merge remote-tracking branch 'upstream/main' into fix/10632-when-long…
terrysahaidak 61b69df
add prettier as in main
31dfdf3
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
f6d85cd
fix prettier linting
5df5bf4
fix: eslint config
69b5789
fix: eslint errors
ba77c38
replace KeyboardAvoidingView with new one from REA
b7c0912
fix: prettier errors
3f43547
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
754927a
update codegen pod
5596c6f
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
3e50f59
fix: merge problems
cf4abbf
fix: anchorPosition prop wrong
3d66d39
move keyboard events to useAnimatedReaction
1fa1806
re-structure state machine
57d2653
rename states and actions
077140d
move KEYBOARD_POPOVER_OPEN state up
046d861
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
c799dc3
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
2fe7d91
remove contextType from FC
c0e7438
chore: update react-native-pdf pod
a73f905
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
chrispader b4a15a7
fix: wrong import
chrispader 27c4443
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 6011c38
fix: compilation issues after a merge
kirillzyusko 0eb20f3
fix: resolve merge conflicts after a merge
kirillzyusko 0a0a8ed
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 9e99895
fix: post merge fixes
kirillzyusko 431a800
fix: crash when long press message
kirillzyusko 124511e
fix: smooth emoji picker transition
kirillzyusko d5f995b
fix: quick emoji selection crash
kirillzyusko c617120
fix: don't push message to bottom
kirillzyusko 299ea6c
fix: crash on long press document
kirillzyusko d178057
fix: click on attachment pushing it down
kirillzyusko 5700381
experimental: use RNKC
kirillzyusko 1cc271c
fix: smooth transition when keyboard gets closed (well, almost smooth…
kirillzyusko b16b0ac
fix: added missing OPEN_EMOJI_PICKER_POPOVER_STANDALONE
kirillzyusko 563053b
chore: keep intermediate changes
kirillzyusko e8a37c4
fix: crash when delete confirmation is shown
kirillzyusko 2cc0c58
feat: measure composer
kirillzyusko d5e820c
fix: correct offset when switch from keyboard to emoji picker
kirillzyusko b4b2138
fix: 10 magic pixels
kirillzyusko f0ed950
fix: attachment popover (big screen push up)
kirillzyusko 28129a6
fix: smooth attachment picker+keyboard transitions
kirillzyusko 8e6d06c
fix: unnecessary animation on popover hide (when image is not obscure…
kirillzyusko 5979f87
fix: more clickable message types
kirillzyusko f8d8fd4
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 048d6cc
refactor: partial migration to TS
kirillzyusko 52b3396
fix: wrong calculation sometimes
kirillzyusko 5c94c60
chore: update react-native-keyboard-controller
kirillzyusko e7110c5
long press on message that will be pushed -> close -> long press on m…
kirillzyusko a220c07
fix: focus on bottom message -> focus on bottom-1 message -> focus on…
kirillzyusko a003c8f
fix: when message is not overlapped by action sheet keep it in curren…
kirillzyusko 9efcabd
fix: double transitions when multiline text is covered by keyboard in…
kirillzyusko 51295aa
fix: add animated transition when call popup gets shown
kirillzyusko dfd7f3e
fix: double transitions when call popup appears
kirillzyusko 71d33b8
fix: enable keyboard-controller only on iOS for now
kirillzyusko 4d047a6
fix: smooth call popover back transitions
kirillzyusko d4de091
chore: better TS support
kirillzyusko e057c1e
refactor: create reusable function
kirillzyusko 37f1b79
fix: save keyboard height only before dismiss, since condition is in…
kirillzyusko d7aed3e
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 194f82f
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 454575d
chore: changes after self review
kirillzyusko 23ad038
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 693981b
fix: react on composer height changes when keyboard is opened to cons…
kirillzyusko 84735e4
chore: restore displayName after incorrect conflicts merges
kirillzyusko 1f492da
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 110f10e
chore: changes after review
kirillzyusko d6f005e
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko a639731
chore: remove empty line
kirillzyusko 5c2e0cc
chore: re-generate
kirillzyusko 9454c00
fix: double transitions when call popup is shown
kirillzyusko 85e1082
fix: occasional blinks when keyboard open and message is moving
kirillzyusko fd33fcc
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 43a6c9b
fix: occasional blinks when message is not pushed (on long press)
kirillzyusko 2fdd63e
refactor: useState -> useRef
kirillzyusko 2ed311f
fix: removed unreachable code, better (but not ideal) TS support
kirillzyusko f55bb14
fix: ts error in context
kirillzyusko e7f0bc4
fix: better TS support (less TS errors, but we still have them)
kirillzyusko 4feb4d1
fix: occasional content movement when keyboard open & you open bottom…
kirillzyusko c430dce
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko cd2a2e0
chore: removed console.log statements
kirillzyusko e25d764
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 619a1c9
chore: update Podfile.lock
kirillzyusko 92f3592
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 8d6bc04
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 077be6e
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko ad42989
fix: prettier
kirillzyusko 7cbabff
fix: mock for unit tests
kirillzyusko a17688c
fix: partial TS fixes
kirillzyusko 8920741
fix: prettier
kirillzyusko 6ba15fd
fix: further fixes (CI still will fail, but at least we should have o…
kirillzyusko 77eeb68
fix: eslint issues
kirillzyusko 1611eea
fix: TS issues
kirillzyusko f1fe95f
fix: lint
kirillzyusko 25332a0
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko f4660eb
fix: CI
kirillzyusko 1f0260c
Merge branch 'main' into fix/10632-when-long-press-on-message-add-spa…
kirillzyusko 002505f
fix: prettier
kirillzyusko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
198 changes: 198 additions & 0 deletions
198
src/components/ActionSheetAwareScrollView/ActionSheetAwareScrollViewContext.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,198 @@ | ||
| import noop from "lodash/noop" | ||
| import type {PropsWithChildren} from 'react'; | ||
| import React, { createContext, useMemo} from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
|
|
||
| import type { ActionWithPayload, State } from '@hooks/useWorkletStateMachine'; | ||
| import useWorkletStateMachine from '@hooks/useWorkletStateMachine'; | ||
| import type { SharedValue } from 'react-native-reanimated'; | ||
|
|
||
| type Context = { | ||
| currentActionSheetState: SharedValue<State>, | ||
| transitionActionSheetState: (action: ActionWithPayload) => void, | ||
| transitionActionSheetStateWorklet: (action: ActionWithPayload) => void; | ||
| resetStateMachine: () => void; | ||
| }; | ||
| const defaultValue: Context = { | ||
| currentActionSheetState: { | ||
| value: { | ||
| previous: null, | ||
| current: { | ||
| state: 'idle', | ||
| payload: null, | ||
| }, | ||
| }, | ||
| addListener: noop, | ||
| removeListener: noop, | ||
| modify: noop, | ||
| }, | ||
| transitionActionSheetState: noop, | ||
| transitionActionSheetStateWorklet: noop, | ||
| resetStateMachine: noop, | ||
| }; | ||
|
|
||
| const ActionSheetAwareScrollViewContext = createContext<Context>(defaultValue); | ||
|
|
||
| const Actions = { | ||
| OPEN_KEYBOARD: 'KEYBOARD_OPEN', | ||
| CLOSE_KEYBOARD: 'CLOSE_KEYBOARD', | ||
| OPEN_POPOVER: 'OPEN_POPOVER', | ||
| CLOSE_POPOVER: 'CLOSE_POPOVER', | ||
| MEASURE_POPOVER: 'MEASURE_POPOVER', | ||
| MEASURE_COMPOSER: 'MEASURE_COMPOSER', | ||
| POPOVER_ANY_ACTION: 'POPOVER_ANY_ACTION', | ||
| OPEN_EMOJI_PICKER_POPOVER: 'OPEN_EMOJI_PICKER_POPOVER', | ||
| OPEN_EMOJI_PICKER_POPOVER_STANDALONE: 'OPEN_EMOJI_PICKER_POPOVER_STANDALONE', | ||
| CLOSE_EMOJI_PICKER_POPOVER: 'CLOSE_EMOJI_PICKER_POPOVER', | ||
| MEASURE_EMOJI_PICKER_POPOVER: 'MEASURE_EMOJI_PICKER_POPOVER', | ||
| HIDE_WITHOUT_ANIMATION: 'HIDE_WITHOUT_ANIMATION', | ||
| EDIT_REPORT: 'EDIT_REPORT', | ||
| SHOW_DELETE_CONFIRM_MODAL: 'SHOW_DELETE_CONFIRM_MODAL', | ||
| END_TRANSITION: 'END_TRANSITION', | ||
| OPEN_CALL_POPOVER: 'OPEN_CALL_POPOVER', | ||
| CLOSE_CONFIRM_MODAL: 'CLOSE_CONFIRM_MODAL', | ||
| MEASURE_CONFIRM_MODAL: 'MEASURE_CONFIRM_MODAL', | ||
| SHOW_ATTACHMENTS_POPOVER: 'SHOW_ATTACHMENTS_POPOVER', | ||
| CLOSE_ATTACHMENTS_POPOVER: 'CLOSE_ATTACHMENTS_POPOVER', | ||
| SHOW_ATTACHMENTS_PICKER_POPOVER: 'SHOW_ATTACHMENTS_PICKER_POPOVER', | ||
| CLOSE_EMOJI_PICKER_POPOVER_STANDALONE: 'CLOSE_EMOJI_PICKER_POPOVER_STANDALONE', | ||
| MEASURE_CALL_POPOVER: 'MEASURE_CALL_POPOVER', | ||
| CLOSE_CALL_POPOVER: 'CLOSE_CALL_POPOVER' | ||
| }; | ||
|
|
||
| const States = { | ||
| IDLE: 'idle', | ||
| KEYBOARD_OPEN: 'keyboardOpen', | ||
| POPOVER_OPEN: 'popoverOpen', | ||
| POPOVER_CLOSED: 'popoverClosed', | ||
| KEYBOARD_POPOVER_CLOSED: 'keyboardPopoverClosed', | ||
| KEYBOARD_POPOVER_OPEN: 'keyboardPopoverOpen', | ||
| KEYBOARD_CLOSED_POPOVER: 'keyboardClosingPopover', | ||
| POPOVER_MEASURED: 'popoverMeasured', | ||
| EMOJI_PICKER_POPOVER_OPEN: 'emojiPickerPopoverOpen', | ||
| DELETE_MODAL_OPEN: 'deleteModalOpen', | ||
| DELETE_MODAL_WITH_KEYBOARD_OPEN: 'deleteModalWithKeyboardOpen', | ||
| EMOJI_PICKER_POPOVER_WITH_KEYBOARD_OPEN: 'emojiPickerPopoverWithKeyboardOpen', | ||
| EMOJI_PICKER_WITH_KEYBOARD_OPEN: 'emojiPickerWithKeyboardOpen', | ||
| CALL_POPOVER_WITH_KEYBOARD_OPEN: 'callPopoverWithKeyboardOpen', | ||
| CALL_POPOVER_WITH_KEYBOARD_CLOSED: 'callPopoverWithKeyboardClosed', | ||
| ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN: 'attachmentsPopoverWithKeyboardOpen', | ||
| ATTACHMENTS_POPOVER_WITH_KEYBOARD_CLOSED: 'attachmentsPopoverWithKeyboardClosed', | ||
| MODAL_DELETED: 'modalDeleted', | ||
| MODAL_WITH_KEYBOARD_OPEN_DELETED: 'modalWithKeyboardOpenDeleted' | ||
| }; | ||
|
|
||
| const STATE_MACHINE = { | ||
| [States.IDLE]: { | ||
| [Actions.OPEN_POPOVER]: States.POPOVER_OPEN, | ||
| [Actions.OPEN_KEYBOARD]: States.KEYBOARD_OPEN, | ||
| [Actions.MEASURE_POPOVER]: States.IDLE, | ||
| [Actions.MEASURE_COMPOSER]: States.IDLE, | ||
| [Actions.OPEN_EMOJI_PICKER_POPOVER]: States.EMOJI_PICKER_POPOVER_OPEN, | ||
| [Actions.SHOW_ATTACHMENTS_PICKER_POPOVER]: States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN, | ||
| }, | ||
| [States.POPOVER_OPEN]: { | ||
| [Actions.CLOSE_POPOVER]: States.POPOVER_CLOSED, | ||
| [Actions.MEASURE_POPOVER]: States.POPOVER_OPEN, | ||
| [Actions.MEASURE_COMPOSER]: States.POPOVER_OPEN, | ||
| [Actions.OPEN_EMOJI_PICKER_POPOVER]: States.EMOJI_PICKER_POPOVER_OPEN, | ||
| [Actions.POPOVER_ANY_ACTION]: States.POPOVER_CLOSED, | ||
| [Actions.HIDE_WITHOUT_ANIMATION]: States.IDLE, | ||
| [Actions.EDIT_REPORT]: States.IDLE, | ||
| [Actions.SHOW_DELETE_CONFIRM_MODAL]: States.MODAL_DELETED, | ||
| }, | ||
| [States.POPOVER_CLOSED]: { | ||
| [Actions.END_TRANSITION]: States.IDLE, | ||
| }, | ||
| [States.EMOJI_PICKER_POPOVER_OPEN]: { | ||
| [Actions.MEASURE_EMOJI_PICKER_POPOVER]: States.EMOJI_PICKER_POPOVER_OPEN, | ||
| [Actions.CLOSE_EMOJI_PICKER_POPOVER]: States.POPOVER_CLOSED, | ||
| }, | ||
| [States.MODAL_DELETED]: { | ||
| [Actions.MEASURE_CONFIRM_MODAL]: States.MODAL_DELETED, | ||
| [Actions.CLOSE_CONFIRM_MODAL]: States.POPOVER_CLOSED, | ||
| }, | ||
| [States.KEYBOARD_OPEN]: { | ||
| [Actions.OPEN_KEYBOARD]: States.KEYBOARD_OPEN, | ||
| [Actions.OPEN_POPOVER]: States.KEYBOARD_POPOVER_OPEN, | ||
| [Actions.OPEN_EMOJI_PICKER_POPOVER]: States.KEYBOARD_POPOVER_OPEN, | ||
| [Actions.OPEN_EMOJI_PICKER_POPOVER_STANDALONE]: States.EMOJI_PICKER_WITH_KEYBOARD_OPEN, | ||
| [Actions.CLOSE_KEYBOARD]: States.IDLE, | ||
| [Actions.OPEN_CALL_POPOVER]: States.CALL_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.SHOW_ATTACHMENTS_POPOVER]: States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.SHOW_ATTACHMENTS_PICKER_POPOVER]: States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.MEASURE_COMPOSER]: States.KEYBOARD_OPEN, | ||
| }, | ||
| [States.KEYBOARD_POPOVER_OPEN]: { | ||
| [Actions.MEASURE_POPOVER]: States.KEYBOARD_POPOVER_OPEN, | ||
| [Actions.MEASURE_COMPOSER]: States.KEYBOARD_POPOVER_OPEN, | ||
| [Actions.CLOSE_POPOVER]: States.KEYBOARD_CLOSED_POPOVER, | ||
| [Actions.CLOSE_EMOJI_PICKER_POPOVER]: States.KEYBOARD_CLOSED_POPOVER, | ||
| [Actions.MEASURE_EMOJI_PICKER_POPOVER]: States.KEYBOARD_POPOVER_OPEN, | ||
| [Actions.OPEN_EMOJI_PICKER_POPOVER]: States.EMOJI_PICKER_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.SHOW_DELETE_CONFIRM_MODAL]: States.MODAL_WITH_KEYBOARD_OPEN_DELETED, | ||
| }, | ||
| [States.MODAL_WITH_KEYBOARD_OPEN_DELETED]: { | ||
| [Actions.MEASURE_CONFIRM_MODAL]: States.MODAL_WITH_KEYBOARD_OPEN_DELETED, | ||
| [Actions.CLOSE_CONFIRM_MODAL]: States.KEYBOARD_CLOSED_POPOVER, | ||
| }, | ||
| [States.EMOJI_PICKER_POPOVER_WITH_KEYBOARD_OPEN]: { | ||
| [Actions.MEASURE_EMOJI_PICKER_POPOVER]: States.EMOJI_PICKER_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.CLOSE_EMOJI_PICKER_POPOVER]: States.KEYBOARD_CLOSED_POPOVER, | ||
| }, | ||
| [States.EMOJI_PICKER_WITH_KEYBOARD_OPEN]: { | ||
| [Actions.MEASURE_EMOJI_PICKER_POPOVER]: States.EMOJI_PICKER_WITH_KEYBOARD_OPEN, | ||
| [Actions.CLOSE_EMOJI_PICKER_POPOVER_STANDALONE]: States.KEYBOARD_POPOVER_CLOSED, | ||
| }, | ||
| [States.CALL_POPOVER_WITH_KEYBOARD_OPEN]: { | ||
| [Actions.MEASURE_POPOVER]: States.CALL_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.MEASURE_CALL_POPOVER]: States.CALL_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.CLOSE_CALL_POPOVER]: States.CALL_POPOVER_WITH_KEYBOARD_CLOSED, | ||
| }, | ||
| [States.CALL_POPOVER_WITH_KEYBOARD_CLOSED]: { | ||
| [Actions.OPEN_KEYBOARD]: States.KEYBOARD_OPEN, | ||
| }, | ||
| [States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN]: { | ||
| [Actions.MEASURE_POPOVER]: States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.MEASURE_COMPOSER]: States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_OPEN, | ||
| [Actions.CLOSE_ATTACHMENTS_POPOVER]: States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_CLOSED, | ||
| }, | ||
| [States.ATTACHMENTS_POPOVER_WITH_KEYBOARD_CLOSED]: { | ||
| [Actions.OPEN_KEYBOARD]: States.KEYBOARD_OPEN, | ||
| }, | ||
| [States.KEYBOARD_POPOVER_CLOSED]: { | ||
| [Actions.OPEN_KEYBOARD]: States.KEYBOARD_OPEN, | ||
| }, | ||
| [States.KEYBOARD_CLOSED_POPOVER]: { | ||
| [Actions.OPEN_KEYBOARD]: States.KEYBOARD_OPEN, | ||
| [Actions.END_TRANSITION]: States.KEYBOARD_OPEN, | ||
| }, | ||
| }; | ||
|
|
||
| function ActionSheetAwareScrollViewProvider(props: PropsWithChildren<unknown>) { | ||
| const {currentState, transition, transitionWorklet, reset} = useWorkletStateMachine(STATE_MACHINE, { | ||
| previous: null, | ||
| current: { | ||
| state: 'idle', | ||
| payload: null, | ||
| }, | ||
| }); | ||
|
|
||
| const value = useMemo( | ||
| () => ({ | ||
| currentActionSheetState: currentState, | ||
| transitionActionSheetState: transition, | ||
| transitionActionSheetStateWorklet: transitionWorklet, | ||
| resetStateMachine: reset, | ||
| }), | ||
| [currentState, reset, transition, transitionWorklet], | ||
| ); | ||
|
|
||
| return <ActionSheetAwareScrollViewContext.Provider value={value}>{props.children}</ActionSheetAwareScrollViewContext.Provider>; | ||
| } | ||
|
|
||
| ActionSheetAwareScrollViewProvider.propTypes = { | ||
| children: PropTypes.node.isRequired, | ||
| }; | ||
|
|
||
| export {ActionSheetAwareScrollViewContext, ActionSheetAwareScrollViewProvider, Actions, States}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice you're enabling this only on iOS, but this issue occurs the same on Android as it does on iOS. So I think we'd like to see a consistent approach to keyboard avoidance on all platforms.
Currently, I think we use an unintuitive mix of native and JS-layer keyboard avoidance, and it's inconsistent between platforms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, should this be inside the error boundary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to the level of all providers - the reason why it's a separate JSX element because I specify
props(enabled) and right nowComposeProvidersdoesn't have an ability to specify additional props. And as I can see all providers are not underErrorBoundary.Would you mind to give a brief explanation why do you think it's worth to put this element under
ErrorBoundary?Yes, because an initial PR supported only iOS (from PR description: This PR is iOS only for now. Other platforms are not affected. Also, in this explanation, we are talking about iOS only since on Android, iOS web and Android Web keyboard handling works differently.)
But I agree with you that it would be good to have cross-platform code that handles keyboard interactions. And we actually wanted to suggest to do that, but our vision was to merge this PR first (because it's quite old and contains a lot of changes) and then add Android support in next PRs. What do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kirillzyusko lets create a new
KeyboardHandlerProviderin components, that returns the <KeyboardProvider with theenabledprop set.Then we can pass it to
ComposeProvidersso it's in line with all the other providers