react-native/Libraries/Text
Björn Pötzschke 1832d79bd1 TextStorage in RCTText is now only set when it differs from old value.
Summary:**Motivation**
Multiple instances of `Text` inside a `ListView` is a bad idea for the performance of the app.
When you create 1000 elements and you scroll through the list it is really slow and laggy because the `NSTextStorage`, which is the backbone of the `RCTText` element, will set more than 1,000 times and also the method `setNeedsDisplay` is called multiple times. This will causes huge memory problems and the app crashes.

With this commit I check in `RCTText` if the `NSTextStorage` differs from the old value. If yes then set it otherwise don't set the `NSTextStorage`. This will prevent to call `setNeedsDisplay` when not really needed.

Gist with sample app to show behavior can be found here: https://gist.github.com/bpoetzschke/28a17969c6aa54219e18
Closes https://github.com/facebook/react-native/pull/6341

Differential Revision: D3035485

Pulled By: nicklockwood

fb-gh-sync-id: 181f01b7f87f765dbb01a4ad3196fc40f9d50694
shipit-source-id: 181f01b7f87f765dbb01a4ad3196fc40f9d50694
2016-03-10 07:46:52 -08:00
..
RCTText.xcodeproj Text highlighting on iOS 2015-07-24 08:41:58 -08:00
RCTRawTextManager.h [ReactNative] Expanded license on obj-c files 2015-03-23 13:18:29 -08:00
RCTRawTextManager.m Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
RCTShadowRawText.h [ReactNative] Expanded license on obj-c files 2015-03-23 13:18:29 -08:00
RCTShadowRawText.m Fix Groups text input 2015-11-04 04:09:27 -08:00
RCTShadowText.h Add <Text> shadow support 2016-01-01 09:33:31 -08:00
RCTShadowText.m Added support for width & height for text images 2016-01-22 11:32:32 -08:00
RCTText.h Fixed crash in RCTText due to NSTextContainer/NSLayoutManager being accessed concurrently from main and shadow queues 2015-05-26 18:52:46 -08:00
RCTText.m TextStorage in RCTText is now only set when it differs from old value. 2016-03-10 07:46:52 -08:00
RCTTextField.h Open sourced the onSelectionChange event 2015-11-14 09:44:30 -08:00
RCTTextField.m Maintain cursor position when TextInput value is changed programmatically 2015-12-17 10:23:26 -08:00
RCTTextFieldManager.h Migrated RCTText into FBReactKit 2015-07-08 07:13:00 -08:00
RCTTextFieldManager.m Add support for selectionColor on Android TextInput 2016-02-03 05:49:32 -08:00
RCTTextManager.h Add support for multiline TextInput via UITextView 2015-04-29 01:33:58 -08:00
RCTTextManager.m Improved shadow performance 2016-01-14 14:04:34 -08:00
RCTTextView.h Added blurOnSubmit support to multine TextInput (aka RCTTextView) 2015-12-02 08:16:27 -08:00
RCTTextView.m Added support for auto-resizing text fields 2016-01-25 05:46:29 -08:00
RCTTextViewManager.h Add support for multiline TextInput via UITextView 2015-04-29 01:33:58 -08:00
RCTTextViewManager.m Add support for `textAlign` on iOS multiline text input 2016-02-07 12:38:36 -08:00
Text.js Updates to Text & IntentAndroid 2016-01-23 11:01:33 -08:00
TextStylePropTypes.js Fix StyleSheet 'textAlign' for AndroidTextInput. Closes #2702 2016-01-21 11:08:34 -08:00
TextUpdateTest.js [ReactNative] Fix Text Updating Crash 2015-05-02 10:07:08 -08:00