Skip to content

JUSTIFICATION_MODE_NONE does not exist on Android API level 25 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jarmani opened this issue Jan 8, 2022 · 1 comment
Closed

JUSTIFICATION_MODE_NONE does not exist on Android API level 25 #11

jarmani opened this issue Jan 8, 2022 · 1 comment

Comments

@jarmani
Copy link

jarmani commented Jan 8, 2022

Which platform(s) does your issue occur on?

Android 7.1.X (API level 25)

Please, tell us how to recreate the issue in as much detail as possible.

JUSTIFICATION_MODE_INTER_WORD and JUSTIFICATION_MODE_NONE appeared in API level 26 but the code check for level >= 25 :

[textAlignmentProperty.setNative](value: CoreTypes.TextAlignmentType) {
        const view = this.nativeTextViewProtected;
        if (android.os.Build.VERSION.SDK_INT >= 25) {
            if ((value as any) === 'justify') {
                view.setJustificationMode(android.text.Layout.JUSTIFICATION_MODE_INTER_WORD);
            } else {
                view.setJustificationMode(android.text.Layout.JUSTIFICATION_MODE_NONE);
                view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
            }
        } else {
            view.setGravity(getHorizontalGravity(value) | getVerticalGravity(this.verticalTextAlignment));
        }
    }

causing the following error :

com.tns.NativeScriptException: Calling js method onCreateView failed Error: java.lang.NoSuchFieldError: no "I" field "JUSTIFICATION_MODE_NONE" in class "Landroid/text/Layout;" or its superclasses

@farfromrefug
Copy link
Member

@jarmani thanks for the report. fixed in 1.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants