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

iOS dark mode improvements #1415

Merged
merged 5 commits into from
Oct 9, 2019
Merged
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
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Fix issue when multiple media selection adds only one image or video block on Android
* Fix issue when force Touch app shortcut doesn't work properly selecting "New Photo Post" on iOS
* Add Link Target (Open in new tab) to Image Block.
* [iOS] DarkMode improvements.

1.14.0
------
Expand Down
22 changes: 20 additions & 2 deletions react-native-aztec/ios/RNTAztecView/RCTAztecView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,23 @@ class RCTAztecView: Aztec.TextView {
}
}

override var textColor: UIColor? {
didSet {
typingAttributes[NSAttributedString.Key.foregroundColor] = self.textColor
}
}

override var typingAttributes: [NSAttributedString.Key : Any] {
didSet {
// Keep placeholder attributes in sync with typing attributes.
placeholderLabel.attributedText = NSAttributedString(string: placeholderLabel.text ?? "", attributes: placeholderAttributes)
}
}

// MARK: - Placeholder

@objc var placeholder: String {
set {
var placeholderAttributes = typingAttributes
placeholderAttributes[.foregroundColor] = placeholderTextColor
placeholderLabel.attributedText = NSAttributedString(string: newValue, attributes: placeholderAttributes)
}

Expand All @@ -421,6 +432,13 @@ class RCTAztecView: Aztec.TextView {
}
}

/// Attributes to use on the placeholder.
var placeholderAttributes: [NSAttributedString.Key: Any] {
var placeholderAttributes = typingAttributes
placeholderAttributes[.foregroundColor] = placeholderTextColor
return placeholderAttributes
}

@objc var placeholderTextColor: UIColor {
set {
placeholderLabel.textColor = newValue
Expand Down