(left: number, top: number, right: number, bottom: number)
| 175 | } |
| 176 | |
| 177 | public onLayout(left: number, top: number, right: number, bottom: number): void { |
| 178 | if (!this.nativeViewProtected) { |
| 179 | return; |
| 180 | } |
| 181 | |
| 182 | const insets = this.getSafeAreaInsets(); |
| 183 | |
| 184 | let scrollWidth = right - left - insets.right - insets.left; |
| 185 | let scrollHeight = bottom - top - insets.bottom - insets.top; |
| 186 | |
| 187 | if (SDK_VERSION > 10) { |
| 188 | // Disable automatic adjustment of scroll view insets |
| 189 | // Consider exposing this as property with all 4 modes |
| 190 | // https://developer.apple.com/documentation/uikit/uiscrollview/contentinsetadjustmentbehavior |
| 191 | this.nativeViewProtected.contentInsetAdjustmentBehavior = 2; |
| 192 | } |
| 193 | |
| 194 | let scrollInsetWidth = scrollWidth + insets.left + insets.right; |
| 195 | let scrollInsetHeight = scrollHeight + insets.top + insets.bottom; |
| 196 | |
| 197 | if (this.orientation === 'horizontal') { |
| 198 | scrollInsetWidth = Math.max(this._contentMeasuredWidth + insets.left + insets.right, scrollInsetWidth); |
| 199 | scrollWidth = Math.max(this._contentMeasuredWidth, scrollWidth); |
| 200 | } else { |
| 201 | scrollInsetHeight = Math.max(this._contentMeasuredHeight + insets.top + insets.bottom, scrollInsetHeight); |
| 202 | scrollHeight = Math.max(this._contentMeasuredHeight, scrollHeight); |
| 203 | } |
| 204 | |
| 205 | this.nativeViewProtected.contentSize = CGSizeMake(layout.toDeviceIndependentPixels(scrollInsetWidth), layout.toDeviceIndependentPixels(scrollInsetHeight)); |
| 206 | |
| 207 | // RTL handling |
| 208 | if (this.orientation === 'horizontal') { |
| 209 | if (this._isFirstLayout) { |
| 210 | this._isFirstLayout = false; |
| 211 | |
| 212 | if (this.direction === CoreTypes.LayoutDirection.rtl) { |
| 213 | const scrollableWidth = scrollInsetWidth - this.getMeasuredWidth(); |
| 214 | if (scrollableWidth > 0) { |
| 215 | this.nativeViewProtected.contentOffset = CGPointMake(layout.toDeviceIndependentPixels(scrollableWidth), this.verticalOffset); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | View.layoutChild(this, this.layoutView, insets.left, insets.top, insets.left + scrollWidth, insets.top + scrollHeight); |
| 222 | } |
| 223 | |
| 224 | public _onOrientationChanged() { |
| 225 | this._isFirstLayout = true; |
nothing calls this directly
no test coverage detected