-
Notifications
You must be signed in to change notification settings - Fork 59
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
Use useLayoutEffect
instead of useEffect
for string parsing and height measurements
#169
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
CLA throws a 404 |
Oops - CLA should is added now! |
src/MarkdownTextInput.web.tsx
Outdated
@@ -464,7 +466,7 @@ const MarkdownTextInput = React.forwardRef<TextInput, MarkdownTextInputProps>( | |||
updateTextColor(divRef.current, value); | |||
}, [multiline, processedMarkdownStyle, processedValue]); | |||
|
|||
useEffect(() => { | |||
useClientEffect(function adjustHeightt() { |
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.
useClientEffect(function adjustHeightt() { | |
useClientEffect(function adjustHeight() { |
src/MarkdownTextInput.web.tsx
Outdated
@@ -9,7 +9,7 @@ import type { | |||
TextInputKeyPressEventData, | |||
TextInputFocusEventData, | |||
} from 'react-native'; | |||
import React, {useEffect, useRef, useCallback, useMemo} from 'react'; | |||
import React, {useEffect, useRef, useCallback, useMemo,useLayoutEffect} from 'react'; |
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.
import React, {useEffect, useRef, useCallback, useMemo,useLayoutEffect} from 'react'; | |
import React, {useEffect, useRef, useCallback, useMemo, useLayoutEffect} from 'react'; |
useLayoutEffect
insted of useEffect
for string parsing and height measurements
@nandorojo can You sign the CLA so we would be able to proceed with the merge 🙇🏼 |
I have read the CLA Document and I hereby sign the CLA |
useLayoutEffect
insted of useEffect
for string parsing and height measurementsuseLayoutEffect
instead of useEffect
for string parsing and height measurements
Thanks! |
Details
It's ideal for cases where dimensions are derived from a DOM element and then updates some other element before react paints the screen. These seem like good use cases.
Related Issues
GH_LINK
close #166
Manual Tests
I didn't add any tests, I'll try a video comparison maybe?
Linked PRs