mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
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:
parent
a68c731aca
commit
c8eed6a361
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user