Remove a couple unneede callbacks
This commit is contained in:
@@ -1,11 +1,4 @@
|
|||||||
import {
|
import {useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react'
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useImperativeHandle,
|
|
||||||
useMemo,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from 'react'
|
|
||||||
import {
|
import {
|
||||||
type TextInput,
|
type TextInput,
|
||||||
type TextInputSubmitEditingEvent,
|
type TextInputSubmitEditingEvent,
|
||||||
@@ -253,37 +246,34 @@ export function Composer({
|
|||||||
* Web keyboard handling
|
* Web keyboard handling
|
||||||
*/
|
*/
|
||||||
const isComposing = useRef(false)
|
const isComposing = useRef(false)
|
||||||
const onKeyPressWeb = useCallback(
|
const onKeyPressWeb = (e: React.KeyboardEvent | any) => {
|
||||||
(e: React.KeyboardEvent | any) => {
|
if (IS_WEB_TOUCH_DEVICE) return
|
||||||
if (IS_WEB_TOUCH_DEVICE) return
|
if (isComposing.current) return
|
||||||
if (isComposing.current) return
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On Safari, the final keydown to dismiss an IME is also "Enter" with
|
* On Safari, the final keydown to dismiss an IME is also "Enter" with
|
||||||
* keyCode 229. Chrome/Firefox don't have this problem.
|
* keyCode 229. Chrome/Firefox don't have this problem.
|
||||||
*
|
*
|
||||||
* @see https://github.com/bluesky-social/social-app/issues/4178
|
* @see https://github.com/bluesky-social/social-app/issues/4178
|
||||||
*/
|
*/
|
||||||
if (e.key === 'Enter' && e.keyCode === 229) return
|
if (e.key === 'Enter' && e.keyCode === 229) return
|
||||||
|
|
||||||
if (e.key === 'Enter') {
|
if (e.key === 'Enter') {
|
||||||
onRequestSubmit?.({
|
onRequestSubmit?.({
|
||||||
platform: 'web',
|
platform: 'web',
|
||||||
shiftKey: e.shiftKey,
|
shiftKey: e.shiftKey,
|
||||||
metaKey: e.metaKey,
|
metaKey: e.metaKey,
|
||||||
nativeEvent: e.nativeEvent,
|
nativeEvent: e.nativeEvent,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
[onRequestSubmit],
|
|
||||||
)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sift popover positioning
|
* Sift popover positioning
|
||||||
*/
|
*/
|
||||||
const updateAutocompletePosition = useCallback(() => {
|
const updateAutocompletePosition = () => {
|
||||||
sift.updatePosition()
|
sift.updatePosition()
|
||||||
}, [sift])
|
}
|
||||||
|
|
||||||
const textContent = (
|
const textContent = (
|
||||||
<Text style={[textStyle, web({whiteSpace: 'pre-wrap'})]}>
|
<Text style={[textStyle, web({whiteSpace: 'pre-wrap'})]}>
|
||||||
|
|||||||
Reference in New Issue
Block a user