mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
fix(android): undefined right-hand side of instance of
Picked from master:
fd5236f1b3
This commit is contained in:
@ -17,8 +17,16 @@ export * from "./flexbox-layout-common";
|
|||||||
let widgetFlexboxLayout: typeof org.nativescript.widgets.FlexboxLayout;
|
let widgetFlexboxLayout: typeof org.nativescript.widgets.FlexboxLayout;
|
||||||
let widgetLayoutParams: typeof org.nativescript.widgets.FlexboxLayout.LayoutParams;
|
let widgetLayoutParams: typeof org.nativescript.widgets.FlexboxLayout.LayoutParams;
|
||||||
|
|
||||||
|
function ensureNativeTypes() {
|
||||||
|
if (!widgetFlexboxLayout) {
|
||||||
|
widgetFlexboxLayout = org.nativescript.widgets.FlexboxLayout;
|
||||||
|
widgetLayoutParams = widgetFlexboxLayout.LayoutParams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function makeNativeSetter<T>(setter: (lp: org.nativescript.widgets.FlexboxLayout.LayoutParams, value: T) => void) {
|
function makeNativeSetter<T>(setter: (lp: org.nativescript.widgets.FlexboxLayout.LayoutParams, value: T) => void) {
|
||||||
return function (this: View, value: T) {
|
return function (this: View, value: T) {
|
||||||
|
ensureNativeTypes();
|
||||||
const nativeView: android.view.View = this.nativeViewProtected;
|
const nativeView: android.view.View = this.nativeViewProtected;
|
||||||
const lp = nativeView.getLayoutParams() || new widgetLayoutParams();
|
const lp = nativeView.getLayoutParams() || new widgetLayoutParams();
|
||||||
if (lp instanceof widgetLayoutParams) {
|
if (lp instanceof widgetLayoutParams) {
|
||||||
@ -86,10 +94,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
if (!widgetFlexboxLayout) {
|
ensureNativeTypes();
|
||||||
widgetFlexboxLayout = org.nativescript.widgets.FlexboxLayout;
|
|
||||||
widgetLayoutParams = widgetFlexboxLayout.LayoutParams;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public createNativeView() {
|
public createNativeView() {
|
||||||
|
Reference in New Issue
Block a user