Example usage for com.facebook.react.uimanager ViewProps TEXT_ALIGN

List of usage examples for com.facebook.react.uimanager ViewProps TEXT_ALIGN

Introduction

In this page you can find the example usage for com.facebook.react.uimanager ViewProps TEXT_ALIGN.

Prototype

String TEXT_ALIGN

To view the source code for com.facebook.react.uimanager ViewProps TEXT_ALIGN.

Click Source Link

Usage

From source file:fr.bamlab.textinput.ReactTextInputManager.java

License:Open Source License

@ReactProp(name = ViewProps.TEXT_ALIGN)
public void setTextAlign(ReactEditText view, @Nullable String textAlign) {
    if (textAlign == null || "auto".equals(textAlign)) {
        view.setGravityHorizontal(Gravity.NO_GRAVITY);
    } else if ("left".equals(textAlign)) {
        view.setGravityHorizontal(Gravity.LEFT);
    } else if ("right".equals(textAlign)) {
        view.setGravityHorizontal(Gravity.RIGHT);
    } else if ("center".equals(textAlign)) {
        view.setGravityHorizontal(Gravity.CENTER_HORIZONTAL);
    } else {//from w w w. jav  a 2  s.c  o m
        throw new JSApplicationIllegalArgumentException("Invalid textAlign: " + textAlign);
    }
}