Skip to content
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

Add base RTL support. #554

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/i18n/en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
optional: " (optional)",
optional: "",
required: "",
add: "Add",
remove: "✘",
Expand Down
35 changes: 23 additions & 12 deletions lib/stylesheets/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
"use strict";

import { Platform } from "react-native";
import { Platform, I18nManager } from "react-native";

var LABEL_COLOR = "#000000";
var INPUT_COLOR = "#000000";
Expand All @@ -16,13 +16,14 @@ var DISABLED_COLOR = "#777777";
var DISABLED_BACKGROUND_COLOR = "#eeeeee";
var FONT_SIZE = 17;
var FONT_WEIGHT = "500";
var WRITING_DIRECTION = I18nManager.isRTL ? 'rtl' : 'ltr';

var stylesheet = Object.freeze({
fieldset: {},
// the style applied to the container of all inputs
formGroup: {
normal: {
marginBottom: 10
marginBottom: 10,
},
error: {
marginBottom: 10
Expand All @@ -33,33 +34,38 @@ var stylesheet = Object.freeze({
color: LABEL_COLOR,
fontSize: FONT_SIZE,
marginBottom: 7,
fontWeight: FONT_WEIGHT
fontWeight: FONT_WEIGHT,
writingDirection: WRITING_DIRECTION,
},
// the style applied when a validation error occours
error: {
color: ERROR_COLOR,
fontSize: FONT_SIZE,
marginBottom: 7,
fontWeight: FONT_WEIGHT
fontWeight: FONT_WEIGHT,
writingDirection: WRITING_DIRECTION,
}
},
helpBlock: {
normal: {
color: HELP_COLOR,
fontSize: FONT_SIZE,
marginBottom: 2
marginBottom: 2,
writingDirection: WRITING_DIRECTION,
},
// the style applied when a validation error occours
error: {
color: HELP_COLOR,
fontSize: FONT_SIZE,
marginBottom: 2
marginBottom: 2,
writingDirection: WRITING_DIRECTION,
}
},
errorBlock: {
fontSize: FONT_SIZE,
marginBottom: 2,
color: ERROR_COLOR
color: ERROR_COLOR,
writingDirection: WRITING_DIRECTION,
},
textboxView: {
normal: {},
Expand All @@ -76,7 +82,8 @@ var stylesheet = Object.freeze({
borderRadius: 4,
borderColor: BORDER_COLOR,
borderWidth: 1,
marginBottom: 5
marginBottom: 5,
writingDirection: WRITING_DIRECTION,
},
// the style applied when a validation error occours
error: {
Expand All @@ -88,7 +95,8 @@ var stylesheet = Object.freeze({
borderRadius: 4,
borderColor: ERROR_COLOR,
borderWidth: 1,
marginBottom: 5
marginBottom: 5,
writingDirection: WRITING_DIRECTION,
},
// the style applied when the textbox is not editable
notEditable: {
Expand All @@ -101,7 +109,8 @@ var stylesheet = Object.freeze({
borderWidth: 1,
marginBottom: 5,
color: DISABLED_COLOR,
backgroundColor: DISABLED_BACKGROUND_COLOR
backgroundColor: DISABLED_BACKGROUND_COLOR,
writingDirection: WRITING_DIRECTION,
}
},
checkbox: {
Expand Down Expand Up @@ -200,13 +209,15 @@ var stylesheet = Object.freeze({
color: INPUT_COLOR,
fontSize: FONT_SIZE,
padding: 7,
marginBottom: 5
marginBottom: 5,
writingDirection: WRITING_DIRECTION,
},
error: {
color: ERROR_COLOR,
fontSize: FONT_SIZE,
padding: 7,
marginBottom: 5
marginBottom: 5,
writingDirection: WRITING_DIRECTION,
}
},
buttonText: {
Expand Down