nativescript-rtl / ui

Add right-to-left support to the NativeScript framework
MIT License
24 stars 3 forks source link

[iOS] GridLayout crashes on `isRtl = false` #12

Closed vchimev closed 4 years ago

vchimev commented 4 years ago

Hello @xlmnxp,

Thank you for developing and maintaining this plugin.

I'd like to change layouts' isRTL/direction property based on the selected language at runtime.

The snippet below causes a crash on iOS.

Setup: @nativescript-rtl/ui: ~0.1.5 iOS: 13.4.1

Sample

import { GridLayout } from "@nativescript-rtl/ui/grid-layout";

export function onLoaded(args: LoadEventData) {
    const grid = args.object as GridLayout;
    grid.isRtl = false;
}

Output:

CONSOLE LOG file: node_modules/@nativescript-rtl/ui/grid-layout/grid-layout.ios.js:49:0: ---> _this.nativeViewProtected.layer.transform <struct CATransform3D: 0x6000039fba80>
CONSOLE LOG file: node_modules/@nativescript-rtl/ui/grid-layout/grid-layout.ios.js:50:0: ---> ZeroRotation <struct CGAffineTransform: 0x600001997ed0>
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x11055c60e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x110564b52 NativeScript::RecordConstructor::write(JSC::ExecState*, JSC::JSValue const&, void*, JSC::JSCell*)
3   0x110516a3a NativeScript::FFICall::preCall(JSC::ExecState*, NativeScript::FFICall::Invocation&)
4   0x1105163a0 NativeScript::FunctionWrapper::call(JSC::ExecState*)
5   0x110f7d2d2 vmEntryToNative
6   0x11064e8bc JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
7   0x110e1a92b JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
8   0x110c476e6 JSC::callSetter(JSC::ExecState*, JSC::JSValue, JSC::JSValue, JSC::JSValue, JSC::ECMAMode)
9   0x110cd4107 JSC::JSObject::putInlineSlow(JSC::ExecState*, JSC::PropertyName, JSC::JSValue, JSC::PutPropertySlot&)
10  0x11085b4ac llint_slow_path_put_by_id
11  0x110f86ee5 llint_entry
12  0x110f94ea5 llint_entry
13  0x110f93f7f llint_entry
14  0x110f7d1ab vmEntryToJavaScript
15  0x11064e84c JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
16  0x110e1a92b JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&)
17  0x11059c498 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::callFunction(JSC::JSValue const&, JSC::ArgList const&, void*)
18  0x11059be20 NativeScript::ObjCMethodCallback::ffiClosureCallback(void*, void**, void*)
19  0x11059d53c NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
20  0x110f9e222 ffi_closure_unix64_inner
21  0x110f9ec4a ffi_closure_unix64
22  0x7fff23d9e634 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
23  0x7fff23d9e2ce __CFRunLoopDoTimer
24  0x7fff23d9d92a __CFRunLoopDoTimers
25  0x7fff23d9857e __CFRunLoopRun
26  0x7fff23d97ac4 CFRunLoopRunSpecific
27  0x7fff38b2fc1a GSEventRunModal
28  0x7fff48bc7f80 UIApplicationMain
29  0x110f9ea8d ffi_call_unix64
30  0x113f938e0
JavaScript stack trace:
setTransform(file: node_modules/@nativescript-rtl/ui/grid-layout/grid-layout.ios.js:52:0)
at file: node_modules/@nativescript-rtl/ui/grid-layout/grid-layout.ios.js:52:0
at invoke(file: node_modules/@nativescript/core/timer/timer.ios.js:54:30)
at file: node_modules/@nativescript/core/timer/timer.ios.js:18:0
at UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:0)
at file:///app/bundle.js:278:65
at ./app.ts(file:///app/bundle.js:294:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file: app/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: app/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]
at promiseReactionJob([native code])
JavaScript error:
file: node_modules/@nativescript-rtl/ui/grid-layout/grid-layout.ios.js:52:0: JS ERROR Error: Different record types
xlmnxp commented 4 years ago

sorry I forget to compile typescript to javascript on last publish

xlmnxp commented 4 years ago

published to npm 📦 @nativescript-rtl/ui@0.1.6 If the issue solved, I want you to tell me

xlmnxp commented 4 years ago

solved

vchimev commented 4 years ago

It works, thanks!