react-native-macos
react-native-macos copied to clipboard
feat: upgrade Text and TextInput to 2716f53
🚧 Work in progress
Opening this PR now that its changes are compiled without error. I'll be testing it today, so I decided to share my progress in case anyone wants to help out.
2/27/2019: I've fixed all of the issues that will affect my current project. I don't have time to fix the remaining bugs, so it would be great if anyone could lend a hand! Simply direct any PRs toward the text
branch of this repository. 👍 Once all of the known bugs are fixed, we can merge this! 🚀
Details
The ./React
, ./ReactCommon
and ./Libraries/Text
directories have been updated to this commit: https://github.com/facebook/react-native/commit/2716f53220f947c690d5f627286aad51313256a0 (from 01/09/2018 to 01/24/2018)
The goals are as follows:
- Upgrade to the "new" rewrite of text-related native components
- Fix all visual bugs in
<TextInput>
- Make the "tab" key focus the next editable
<TextInput>
- Make multiline
<TextInput>
scrollable when amaxHeight
is used - Make
<TextInput>
placeholders more memory-efficient - Bunch of small fixes, probably
Known bugs
-
password
prop not working - Styled
Text
inside multilineTextInput
not working - Special fonts may have incorrect line height
-
focusRingType
prop not working -
selection
prop not working - Tabbing to an offscreen
TextInput
does not scroll its enclosing scroll views - Scrollable
TextInput
jumps to top when a new line is added to the end via the "return" key - Caret is slightly thinner when the
TextInput
is empty
Related issues
Closes #216 Closes #148
Skipped commits
The following commits were skipped and may be cherry-picked in the future:
- "CI for iOS fixed" (https://github.com/facebook/react-native/commit/605a6e4031fc9b63edbb9120ffacf7b045dc9db8)
- "CI for Android fixed" (https://github.com/facebook/react-native/commit/c8e98bbaf58b7a7f866e831982355b78dfa43b9d)
- "Typos in comments and log messages" (https://github.com/facebook/react-native/commit/d2c569795ca07b6b7c0227cfc6d0b3bf5dd23b99)
- "Make xplat react native files buildable" (https://github.com/facebook/react-native/commit/4f2cc42a2dfac9d3a799b643c625df7506c4b32c)
- "Split folly/Memory out from headers-only targets" (https://github.com/facebook/react-native/commit/b8e79a7e8be1f3db1482a849352fda6e23c1c78a)
- "new feature to support smooth bi-directional content loading" (https://github.com/facebook/react-native/commit/cae7179c9459f12b1cb5e1a1d998a9dc45f927dc)
- "rename and extend new maintain visible content position feature" (https://github.com/facebook/react-native/commit/65184ec6b0ef2d136c0db239d65e0624efac8a2d)
Cherry-picked commits
I also picked some commits ahead of https://github.com/facebook/react-native/commit/2716f53220f947c690d5f627286aad51313256a0 that fix some issues:
- "Support for inherited events in view managers" (https://github.com/facebook/react-native/commit/2afe7d4765)
- "Proper attributed strings comparsion in RCTBaseTextInputView" (https://github.com/facebook/react-native/commit/46fd864348)
- "Fixed a bug when <Text> does not redraw native view on relayout" (https://github.com/facebook/react-native/commit/7d1ec7a3dc)
- "Removed outdated assertion in RCTShadowView related to breaking change in Yoga" (https://github.com/facebook/react-native/commit/e3ff3cf6cb)
- "Fixing clowntown in RCTSurfaceRootShadowView" (https://github.com/facebook/react-native/commit/5fba82deff)
- "Fixed typo in RCTSurfaceRootShadowView" (https://github.com/facebook/react-native/commit/d74ff6fadd)
- "Fixed double
onChange
event triggering from <TextInput> on iOS" (https://github.com/facebook/react-native/commit/d7fa81f181) - "
[RCTShadowView isHidden]
was removed" (https://github.com/facebook/react-native/commit/c19bc79688) - "
processUpdatedProperties
&collectUpdatedProperties
was removed from RCTShadowView" (https://github.com/facebook/react-native/commit/0f9fc4b295) - "Removed
[ShadowView collectUpdatedFrames:]
" (https://github.com/facebook/react-native/commit/9dfa2e7f3c) - "Removing our own implementation of round-to-pixel algorithm" (https://github.com/facebook/react-native/commit/ceb1d1ca5b)
- "Enabling round-to-pixel Yoga feature for RN (iOS)" (https://github.com/facebook/react-native/commit/114c258045)
- "always create debugger websocket connection" (https://github.com/facebook/react-native/commit/fa334ce464)
- "Reimagining of RCTShadowView layout API" (https://github.com/facebook/react-native/commit/f91f7d91a1)
- "
base-line
metric exposure for <Text>" (https://github.com/facebook/react-native/commit/51b3529f6c) - "Wrong height when TextInput has an empty string" (https://github.com/facebook/react-native/commit/def789cd7e)
- "Update ModuleRegistry if there're new modules registered" (https://github.com/facebook/react-native/commit/b5f90ed497)
- "iOS: Fixed the bug where a Backspace event was emitted when entering characters after clearing a text in TextInput by an empty string" (https://github.com/facebook/react-native/commit/1ffb2b63be)
- "Suppress spurious warning about RCTCxxModule" (https://github.com/facebook/react-native/commit/569061dd83)
- "Use module copies in RCTBridge APIs" (https://github.com/facebook/react-native/commit/3d8b83927b)
- "Catch JS bundle load failure and prevent calls to JS after that" (https://github.com/facebook/react-native/commit/201ba8c69d)
- "Fix #18272 TextInput.setNativeProps({text: ''}) to work" (https://github.com/facebook/react-native/commit/2307ea60d0)
- "Added lock around RN module initialization to fix crash" (https://github.com/facebook/react-native/commit/6770b53f8d)
- "Added locking around RN bridge cxx module registry to avoid crash" (https://github.com/facebook/react-native/commit/1c3191992a)
- "Reset module registry flag when resetting React Instance" (https://github.com/facebook/react-native/commit/188cbb04ad)
- "Fix isBatchActive of RCTCxxBridge" (https://github.com/facebook/react-native/commit/d55558e138)
Wow, this one is hard. Text inputs are particularly hard to keep up with RN for iOS due to differences between UIKit and AppKit.
Haha yep. It's been... a learning experience. 😆
It's so nice seeing my old dusty project (NSLabel) being used like that... 🥰 Thanks again @aleclarson for the PRs you sent me! I already released it as version 1.1.0 on Cocoapods. If you fix any other issues it'd be very kind of you if you could send me PRs for these as well. 🙂
@lhecker Of course! Thanks again for open-sourcing your work in 2015. 😉
The remaining bugs are up to the community to fix; unless I ever need them fixed for my own project, that is! Until then, this PR will remain unmerged. 😝
If only we have enough time to revive CI and tests. :(