|
1 | 1 | import React, { ReactElement, useRef, useImperativeHandle, useCallback } from 'react'; |
2 | | -import { View, StyleSheet, NativeModules } from 'react-native'; |
| 2 | +import { View, StyleSheet, NativeModules, AccessibilityInfo, findNodeHandle } from 'react-native'; |
3 | 3 | import { KeyboardAccessoryView } from 'react-native-ui-lib/keyboard'; |
4 | 4 | import { useBackHandler } from '@react-native-community/hooks'; |
5 | 5 | import { Q } from '@nozbe/watermelondb'; |
@@ -210,6 +210,13 @@ export const MessageComposer = ({ |
210 | 210 | emitter.emit(`setComposerHeight${tmid ? 'Thread' : ''}`, height); |
211 | 211 | }; |
212 | 212 |
|
| 213 | + const accessibilityFocusOnInput = () => { |
| 214 | + const node = findNodeHandle(composerInputRef.current); |
| 215 | + if (node) { |
| 216 | + AccessibilityInfo.setAccessibilityFocus(node); |
| 217 | + } |
| 218 | + }; |
| 219 | + |
213 | 220 | const backgroundColor = action === 'edit' ? colors.statusBackgroundWarning2 : colors.surfaceLight; |
214 | 221 |
|
215 | 222 | const renderContent = () => { |
@@ -249,7 +256,10 @@ export const MessageComposer = ({ |
249 | 256 | iOSScrollBehavior={NativeModules.KeyboardTrackingViewTempManager?.KeyboardTrackingScrollBehaviorFixedOffset} |
250 | 257 | onHeightChanged={onHeightChanged} |
251 | 258 | /> |
252 | | - <Autocomplete onPress={item => composerInputComponentRef.current.onAutocompleteItemSelected(item)} /> |
| 259 | + <Autocomplete |
| 260 | + onPress={item => composerInputComponentRef.current.onAutocompleteItemSelected(item)} |
| 261 | + accessibilityFocusOnInput={accessibilityFocusOnInput} |
| 262 | + /> |
253 | 263 | </MessageInnerContext.Provider> |
254 | 264 | ); |
255 | 265 | }; |
0 commit comments