Closed NickIliev closed 5 years ago
@NickIliev
The require vs import is a false trail; after you compile that statement in TS to JS, it will be the same. ;-)
However, as I have seen this type of issue appear in other components over the years -- this is the source of the call that causes issue. (So I know where to look right away. :grinning: )
https://github.com/NathanaelA/nativescript-orientation/blob/master/src/orientation.js#L310 Unfortunately this is needed; the root of the issue is that when I call the child refresh; the child (in this case the dropdown has something that might not be initialized correctly) which calls this: https://github.com/PeterStaev/NativeScript-Drop-Down/blob/master/drop-down.ios.ts#L154
Basically Peter needs to add a guard here as anything calling refresh
will cause the same failure if it done it early enough. My refresh can occur at the startup if the person rotates quickly while the screen is still being built...
So I would recommend he changes this function to be:
public refresh() {
if (this._listPicker) {
this._listPicker.reloadAllComponents();
// Coerce selected index after we have set items to native view.
selectedIndexProperty.coerce(this);
}
}
So that if _listPicker
has NOT been created yet, this code ends up being a no-op. :grinning:
@PeterStaev - Awesomely fast fix -- Thanks!
Thank you both for the nice tracing! 👍
The issue is happening under strange circumstances and only on iOS.
Steps to reproduce:
nativescript-drop-down
andnativescript-orientation
plugins.Execute
tns run ios
and the app will immediately crash withNote:
If I remove the DropDown the issue is resolved (app loading as expected)
If I remove the nativescript-orientation require the issue is resolved (app working - no crash - drop-down is showing as expected)
The orientation plugin was required as follows
Note if I use the TypeScript import the issue is not reproducible
The issue was reported through plain JS project were
require
is the only option.Not sure if the issue is caused by logic in the orientation plugin (@NathanaelA) or by some other incompatibility between the two plugins.