|
15 | 15 | const auto nextSize = state.getContentSize(); |
16 | 16 |
|
17 | 17 | if (_prevContentSize != nextSize) { |
| 18 | + _prevContentSize = nextSize; |
18 | 19 | YGNodeMarkDirty(&yogaNode_); |
19 | 20 | } |
20 | | - |
21 | | - _prevContentSize = nextSize; |
22 | 21 | } |
23 | 22 |
|
24 | 23 | id EnrichedTextInputViewShadowNode::setupMockTextInputView_() const { |
|
74 | 73 | _prevContentSize = size; |
75 | 74 | return constraints.clamp(size); |
76 | 75 | } |
| 76 | + } |
| 77 | + __block CGSize estimatedSize; |
| 78 | + // synchronously dispatch to main thread if needed |
| 79 | + if ([NSThread isMainThread]) { |
| 80 | + EnrichedTextInputView *mockTextInputView = setupMockTextInputView_(); |
| 81 | + estimatedSize = [mockTextInputView |
| 82 | + measureInitialSizeWithMaxWidth:constraints.maximumSize.width]; |
77 | 83 | } else { |
78 | | - __block CGSize estimatedSize; |
79 | | - // synchronously dispatch to main thread if needed |
80 | | - if ([NSThread isMainThread]) { |
| 84 | + dispatch_sync(dispatch_get_main_queue(), ^{ |
81 | 85 | EnrichedTextInputView *mockTextInputView = setupMockTextInputView_(); |
82 | 86 | estimatedSize = [mockTextInputView |
83 | 87 | measureInitialSizeWithMaxWidth:constraints.maximumSize.width]; |
84 | | - } else { |
85 | | - dispatch_sync(dispatch_get_main_queue(), ^{ |
86 | | - EnrichedTextInputView *mockTextInputView = setupMockTextInputView_(); |
87 | | - estimatedSize = [mockTextInputView |
88 | | - measureInitialSizeWithMaxWidth:constraints.maximumSize.width]; |
89 | | - }); |
90 | | - } |
91 | | - |
92 | | - return {estimatedSize.width, |
93 | | - MIN(estimatedSize.height, constraints.maximumSize.height)}; |
| 88 | + }); |
94 | 89 | } |
95 | 90 |
|
96 | | - return Size(); |
| 91 | + return {estimatedSize.width, |
| 92 | + MIN(estimatedSize.height, constraints.maximumSize.height)}; |
97 | 93 | } |
98 | 94 |
|
99 | 95 | } // namespace facebook::react |
0 commit comments