RTL support added for ToolbarAndroid via "rtl" property

Summary: Closes https://github.com/facebook/react-native/pull/4378

Reviewed By: svcscm

Differential Revision: D2715052

Pulled By: mkonicek

fb-gh-sync-id: e24f5db230cd7329911797794e5ef150f6195c4a
This commit is contained in:
Sameer Rahmani 2015-12-03 04:38:07 -08:00 коммит произвёл facebook-github-bot-5
Родитель a68c731aca
Коммит c8eed6a361
2 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -125,6 +125,17 @@ var ToolbarAndroid = React.createClass({
* Sets the toolbar title color.
*/
titleColor: ReactPropTypes.string,
/**
* Used to set the toolbar direction to RTL.
* In addition to this property you need to add
*
* android:supportsRtl="true"
*
* to your application AndroidManifest.xml and then call
* `setLayoutDirection(LayoutDirection.RTL)` in your MainActivity
* `onCreate` method.
*/
rtl: ReactPropTypes.bool,
/**
* Used to locate this view in end-to-end tests.
*/
@ -180,6 +191,7 @@ var toolbarAttributes = {
logo: true,
navIcon: true,
overflowIcon: true,
rtl: true,
subtitle: true,
subtitleColor: true,
title: true,

Просмотреть файл

@ -18,6 +18,7 @@ import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.SystemClock;
import android.util.LayoutDirection;
import android.view.MenuItem;
import android.view.View;
@ -64,6 +65,11 @@ public class ReactToolbarManager extends ViewGroupManager<ReactToolbar> {
view.setOverflowIconSource(overflowIcon);
}
@ReactProp(name = "rtl")
public void setRtl(ReactToolbar view, boolean rtl) {
view.setLayoutDirection(rtl ? LayoutDirection.LTR : LayoutDirection.RTL);
}
@ReactProp(name = "subtitle")
public void setSubtitle(ReactToolbar view, @Nullable String subtitle) {
view.setSubtitle(subtitle);