Fix Android composer cursor bug by removing `setTimeout` from native composer `onChangeText` (#4922)
parent
75c19b2dc2
commit
db7a744433
|
@ -85,18 +85,7 @@ export const TextInput = forwardRef(function TextInputImpl(
|
||||||
const pastSuggestedUris = useRef(new Set<string>())
|
const pastSuggestedUris = useRef(new Set<string>())
|
||||||
const prevDetectedUris = useRef(new Map<string, LinkFacetMatch>())
|
const prevDetectedUris = useRef(new Map<string, LinkFacetMatch>())
|
||||||
const onChangeText = useCallback(
|
const onChangeText = useCallback(
|
||||||
(newText: string) => {
|
async (newText: string) => {
|
||||||
/*
|
|
||||||
* This is a hack to bump the rendering of our styled
|
|
||||||
* `textDecorated` to _after_ whatever processing is happening
|
|
||||||
* within the `PasteInput` library. Without this, the elements in
|
|
||||||
* `textDecorated` are not correctly painted to screen.
|
|
||||||
*
|
|
||||||
* NB: we tried a `0` timeout as well, but only positive values worked.
|
|
||||||
*
|
|
||||||
* @see https://github.com/bluesky-social/social-app/issues/929
|
|
||||||
*/
|
|
||||||
setTimeout(async () => {
|
|
||||||
const mayBePaste = newText.length > prevLength.current + 1
|
const mayBePaste = newText.length > prevLength.current + 1
|
||||||
|
|
||||||
const newRt = new RichText({text: newText})
|
const newRt = new RichText({text: newText})
|
||||||
|
@ -149,7 +138,6 @@ export const TextInput = forwardRef(function TextInputImpl(
|
||||||
onNewLink(suggestedUri)
|
onNewLink(suggestedUri)
|
||||||
}
|
}
|
||||||
prevLength.current = newText.length
|
prevLength.current = newText.length
|
||||||
}, 1)
|
|
||||||
},
|
},
|
||||||
[setRichText, autocompletePrefix, onPhotoPasted, onNewLink],
|
[setRichText, autocompletePrefix, onPhotoPasted, onNewLink],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue