diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 294957f..0575263 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -886,7 +886,7 @@ PODS: - React-Mapbuffer (0.73.5): - glog - React-debug - - react-native-uitextview (1.1.5): + - react-native-uitextview (1.2.1): - glog - RCT-Folly (= 2022.05.16.00) - React-Core @@ -1251,7 +1251,7 @@ SPEC CHECKSUMS: React-jsinspector: 32db5e364bcae8fca8cdf8891830636275add0c5 React-logger: 0331362115f0f5b392bd7ed14636d1a3ea612479 React-Mapbuffer: 7c35cd53a22d0be04d3f26f7881c7fb7dd230216 - react-native-uitextview: 074935787667522fdde4625c7e57eb341270f892 + react-native-uitextview: a743682a89aac66e3ec6c94e5ac9c190c1fbdf01 React-nativeconfig: 1166714a4f7ea57a0df5c2cb44fbc70f98d580f9 React-NativeModulesApple: 726664e9829eb5eed8170241000e46ead269a05f React-perflogger: 0dd9f1725d55f8264b81efadd373fe1d9cca7dc2 diff --git a/example/src/App.tsx b/example/src/App.tsx index cef2259..e7863ea 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -130,6 +130,37 @@ export default function App() { + + Base, backgroundColor + + Hello world! + + + Hello world!{' '} + + And more! + + + + + UITextView, backgroundColor + + Hello world! + + + Hello world!{' '} + + And more! + + + + Base, textDecorationLine @@ -633,5 +664,8 @@ const styles = StyleSheet.create({ }, lineHeight30: { lineHeight: 30 + }, + backgroundColor: { + backgroundColor: 'yellow' } }) diff --git a/ios/RNUITextViewChildShadow.swift b/ios/RNUITextViewChildShadow.swift index 29e9d22..9f1db90 100644 --- a/ios/RNUITextViewChildShadow.swift +++ b/ios/RNUITextViewChildShadow.swift @@ -14,6 +14,7 @@ class RNUITextViewChildShadow: RCTShadowView { @objc var textDecorationLine: RCTTextDecorationLineType = .none @objc var textDecorationStyle: String = "solid" @objc var textDecorationColor: UIColor = .black + @objc var backgroundColor: UIColor? override func isYogaLeafNode() -> Bool { return true diff --git a/ios/RNUITextViewManager.m b/ios/RNUITextViewManager.m index 7129042..a7c1ff1 100644 --- a/ios/RNUITextViewManager.m +++ b/ios/RNUITextViewManager.m @@ -24,6 +24,7 @@ @interface RCT_EXTERN_MODULE(RNUITextViewChildManager, RCTViewManager) RCT_REMAP_SHADOW_PROPERTY(textDecorationLine, textDecorationLine, RCTTextDecorationLineType) RCT_REMAP_SHADOW_PROPERTY(textDecorationStyle, textDecorationStyle, NSString) RCT_REMAP_SHADOW_PROPERTY(textDecorationColor, textDecorationColor, UIColor) +RCT_REMAP_SHADOW_PROPERTY(backgroundColor, backgroundColor, UIColor) RCT_EXPORT_VIEW_PROPERTY(text, NSString) RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock) diff --git a/ios/RNUITextViewShadow.swift b/ios/RNUITextViewShadow.swift index b8e7843..c34ba71 100644 --- a/ios/RNUITextViewShadow.swift +++ b/ios/RNUITextViewShadow.swift @@ -111,6 +111,10 @@ class RNUITextViewShadow: RCTShadowView { attributes[.strikethroughStyle] = child.getTextDecorationStyle() attributes[.strikethroughColor] = child.getTextDecorationColor() } + + if child.backgroundColor != nil { + attributes[.backgroundColor] = child.backgroundColor + } // Create the attributed string with the generic attributes let string = NSMutableAttributedString(string: child.text, attributes: attributes)