react-native-highlight-text-view 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = "HighlightText"
7
+ s.version = package["version"]
8
+ s.summary = package["description"]
9
+ s.homepage = package["homepage"]
10
+ s.license = package["license"]
11
+ s.authors = package["author"]
12
+
13
+ s.platforms = { :ios => min_ios_version_supported }
14
+ s.source = { :git => "https://github.com/aqeelkhokhar/react-native-highlight-text.git.git", :tag => "#{s.version}" }
15
+
16
+ s.source_files = "ios/**/*.{h,m,mm,cpp}"
17
+ s.private_header_files = "ios/**/*.h"
18
+
19
+
20
+ install_modules_dependencies(s)
21
+ end
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Aqeel Ahmad Khokhar
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # react-native-highlight-text
2
+
3
+ A native text input for React Native that supports inline text highlighting
4
+
5
+ ## Installation
6
+
7
+
8
+ ```sh
9
+ npm install react-native-highlight-text
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+
16
+ ```js
17
+ import { HighlightTextView } from "react-native-highlight-text";
18
+
19
+ // ...
20
+
21
+ <HighlightTextView color="tomato" />
22
+ ```
23
+
24
+
25
+ ## Contributing
26
+
27
+ - [Development workflow](CONTRIBUTING.md#development-workflow)
28
+ - [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
29
+ - [Code of conduct](CODE_OF_CONDUCT.md)
30
+
31
+ ## License
32
+
33
+ MIT
34
+
35
+ ---
36
+
37
+ Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
@@ -0,0 +1,77 @@
1
+ buildscript {
2
+ ext.getExtOrDefault = {name ->
3
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['HighlightText_' + name]
4
+ }
5
+
6
+ repositories {
7
+ google()
8
+ mavenCentral()
9
+ }
10
+
11
+ dependencies {
12
+ classpath "com.android.tools.build:gradle:8.7.2"
13
+ // noinspection DifferentKotlinGradleVersion
14
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
15
+ }
16
+ }
17
+
18
+
19
+ apply plugin: "com.android.library"
20
+ apply plugin: "kotlin-android"
21
+
22
+ apply plugin: "com.facebook.react"
23
+
24
+ def getExtOrIntegerDefault(name) {
25
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["HighlightText_" + name]).toInteger()
26
+ }
27
+
28
+ android {
29
+ namespace "com.highlighttext"
30
+
31
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
32
+
33
+ defaultConfig {
34
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
36
+ }
37
+
38
+ buildFeatures {
39
+ buildConfig true
40
+ }
41
+
42
+ buildTypes {
43
+ release {
44
+ minifyEnabled false
45
+ }
46
+ }
47
+
48
+ lintOptions {
49
+ disable "GradleCompatible"
50
+ }
51
+
52
+ compileOptions {
53
+ sourceCompatibility JavaVersion.VERSION_1_8
54
+ targetCompatibility JavaVersion.VERSION_1_8
55
+ }
56
+
57
+ sourceSets {
58
+ main {
59
+ java.srcDirs += [
60
+ "generated/java",
61
+ "generated/jni"
62
+ ]
63
+ }
64
+ }
65
+ }
66
+
67
+ repositories {
68
+ mavenCentral()
69
+ google()
70
+ }
71
+
72
+ def kotlin_version = getExtOrDefault("kotlinVersion")
73
+
74
+ dependencies {
75
+ implementation "com.facebook.react:react-android"
76
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
+ }
@@ -0,0 +1,5 @@
1
+ HighlightText_kotlinVersion=2.0.21
2
+ HighlightText_minSdkVersion=24
3
+ HighlightText_targetSdkVersion=34
4
+ HighlightText_compileSdkVersion=35
5
+ HighlightText_ndkVersion=27.1.12297006
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,19 @@
1
+ package com.highlighttext
2
+
3
+ import com.facebook.react.ReactPackage
4
+ import com.facebook.react.bridge.NativeModule
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.uimanager.ViewManager
7
+ import java.util.ArrayList
8
+
9
+ class HighlightTextViewPackage : ReactPackage {
10
+ override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
11
+ val viewManagers: MutableList<ViewManager<*, *>> = ArrayList()
12
+ viewManagers.add(HighlightTextViewManager())
13
+ return viewManagers
14
+ }
15
+
16
+ override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
17
+ return emptyList()
18
+ }
19
+ }
@@ -0,0 +1,15 @@
1
+ package com.highlighttext
2
+
3
+ import android.content.Context
4
+ import android.util.AttributeSet
5
+ import android.view.View
6
+
7
+ class HighlightTextView : View {
8
+ constructor(context: Context?) : super(context)
9
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
10
+ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
11
+ context,
12
+ attrs,
13
+ defStyleAttr
14
+ )
15
+ }
@@ -0,0 +1,41 @@
1
+ package com.highlighttext
2
+
3
+ import android.graphics.Color
4
+ import com.facebook.react.module.annotations.ReactModule
5
+ import com.facebook.react.uimanager.SimpleViewManager
6
+ import com.facebook.react.uimanager.ThemedReactContext
7
+ import com.facebook.react.uimanager.ViewManagerDelegate
8
+ import com.facebook.react.uimanager.annotations.ReactProp
9
+ import com.facebook.react.viewmanagers.HighlightTextViewManagerInterface
10
+ import com.facebook.react.viewmanagers.HighlightTextViewManagerDelegate
11
+
12
+ @ReactModule(name = HighlightTextViewManager.NAME)
13
+ class HighlightTextViewManager : SimpleViewManager<HighlightTextView>(),
14
+ HighlightTextViewManagerInterface<HighlightTextView> {
15
+ private val mDelegate: ViewManagerDelegate<HighlightTextView>
16
+
17
+ init {
18
+ mDelegate = HighlightTextViewManagerDelegate(this)
19
+ }
20
+
21
+ override fun getDelegate(): ViewManagerDelegate<HighlightTextView>? {
22
+ return mDelegate
23
+ }
24
+
25
+ override fun getName(): String {
26
+ return NAME
27
+ }
28
+
29
+ public override fun createViewInstance(context: ThemedReactContext): HighlightTextView {
30
+ return HighlightTextView(context)
31
+ }
32
+
33
+ @ReactProp(name = "color")
34
+ override fun setColor(view: HighlightTextView?, color: String?) {
35
+ view?.setBackgroundColor(Color.parseColor(color))
36
+ }
37
+
38
+ companion object {
39
+ const val NAME = "HighlightTextView"
40
+ }
41
+ }
@@ -0,0 +1,24 @@
1
+ #import <React/RCTViewComponentView.h>
2
+ #import <UIKit/UIKit.h>
3
+
4
+ #ifndef HighlightTextViewNativeComponent_h
5
+ #define HighlightTextViewNativeComponent_h
6
+
7
+ NS_ASSUME_NONNULL_BEGIN
8
+
9
+ @interface RoundedBackgroundLayoutManager : NSLayoutManager
10
+ @property (nonatomic, strong) UIColor *backgroundColor;
11
+ @property (nonatomic, assign) CGFloat padding;
12
+ @property (nonatomic, assign) CGFloat paddingLeft;
13
+ @property (nonatomic, assign) CGFloat paddingRight;
14
+ @property (nonatomic, assign) CGFloat paddingTop;
15
+ @property (nonatomic, assign) CGFloat paddingBottom;
16
+ @property (nonatomic, assign) CGFloat cornerRadius;
17
+ @end
18
+
19
+ @interface HighlightTextView : RCTViewComponentView
20
+ @end
21
+
22
+ NS_ASSUME_NONNULL_END
23
+
24
+ #endif /* HighlightTextViewNativeComponent_h */
@@ -0,0 +1,294 @@
1
+ #import "HighlightTextView.h"
2
+
3
+ #import <react/renderer/components/HighlightTextViewSpec/ComponentDescriptors.h>
4
+ #import <react/renderer/components/HighlightTextViewSpec/EventEmitters.h>
5
+ #import <react/renderer/components/HighlightTextViewSpec/Props.h>
6
+ #import <react/renderer/components/HighlightTextViewSpec/RCTComponentViewHelpers.h>
7
+
8
+ #import "RCTFabricComponentsPlugins.h"
9
+
10
+ using namespace facebook::react;
11
+
12
+ @implementation RoundedBackgroundLayoutManager
13
+
14
+ - (void)drawBackgroundForGlyphRange:(NSRange)glyphsToShow atPoint:(CGPoint)origin {
15
+ NSTextStorage *textStorage = self.textStorage;
16
+ NSTextContainer *textContainer = self.textContainers.firstObject;
17
+
18
+ [textStorage enumerateAttribute:NSBackgroundColorAttributeName
19
+ inRange:glyphsToShow
20
+ options:0
21
+ usingBlock:^(id value, NSRange range, BOOL *stop) {
22
+ if (value && [value isKindOfClass:[UIColor class]]) {
23
+ // Draw background for each character individually to avoid line wrapping issues
24
+ for (NSUInteger i = range.location; i < range.location + range.length; i++) {
25
+ NSRange charRange = NSMakeRange(i, 1);
26
+ NSRange glyphRange = [self glyphRangeForCharacterRange:charRange actualCharacterRange:NULL];
27
+
28
+ if (glyphRange.length > 0) {
29
+ // Get the actual character to ensure it's not a whitespace or control character
30
+ unichar character = [textStorage.string characterAtIndex:i];
31
+ if (character == '\n' || character == '\r' || character == ' ' || character == '\t') {
32
+ continue;
33
+ }
34
+
35
+ CGRect boundingRect = [self boundingRectForGlyphRange:glyphRange inTextContainer:textContainer];
36
+
37
+ // Ensure the glyph has reasonable dimensions and isn't a line fragment artifact
38
+ // Also check that it's not spanning the full container width (which indicates line wrapping issues)
39
+ if (boundingRect.size.width > 1.0 && boundingRect.size.height > 1.0 &&
40
+ boundingRect.size.width < (textContainer.size.width * 0.8)) {
41
+
42
+ // Apply individual padding values
43
+ boundingRect.origin.x += origin.x - self.paddingLeft;
44
+ boundingRect.origin.y += origin.y - self.paddingTop;
45
+ boundingRect.size.width += self.paddingLeft + self.paddingRight;
46
+ boundingRect.size.height += self.paddingTop + self.paddingBottom;
47
+
48
+ UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:boundingRect cornerRadius:self.cornerRadius];
49
+ [self.backgroundColor setFill];
50
+ [path fill];
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }];
56
+
57
+ // Don't call super to avoid default background drawing
58
+ }
59
+
60
+ @end
61
+
62
+ @interface HighlightTextView () <RCTHighlightTextViewViewProtocol, UITextViewDelegate>
63
+
64
+ @end
65
+
66
+ @implementation HighlightTextView {
67
+ UITextView * _textView;
68
+ RoundedBackgroundLayoutManager * _layoutManager;
69
+ NSString * _characterBackgroundColor;
70
+ CGFloat _padding;
71
+ CGFloat _paddingLeft;
72
+ CGFloat _paddingRight;
73
+ CGFloat _paddingTop;
74
+ CGFloat _paddingBottom;
75
+ CGFloat _cornerRadius;
76
+ }
77
+
78
+ + (ComponentDescriptorProvider)componentDescriptorProvider
79
+ {
80
+ return concreteComponentDescriptorProvider<HighlightTextViewComponentDescriptor>();
81
+ }
82
+
83
+ - (instancetype)initWithFrame:(CGRect)frame
84
+ {
85
+ if (self = [super initWithFrame:frame]) {
86
+ static const auto defaultProps = std::make_shared<const HighlightTextViewProps>();
87
+ _props = defaultProps;
88
+
89
+ _characterBackgroundColor = @"#FFFF00";
90
+ _padding = 4.0;
91
+ _paddingLeft = 4.0;
92
+ _paddingRight = 4.0;
93
+ _paddingTop = 4.0;
94
+ _paddingBottom = 4.0;
95
+ _cornerRadius = 4.0;
96
+
97
+ // Create text storage, layout manager, and text container
98
+ NSTextStorage *textStorage = [[NSTextStorage alloc] init];
99
+ _layoutManager = [[RoundedBackgroundLayoutManager alloc] init];
100
+ _layoutManager.backgroundColor = [self hexStringToColor:_characterBackgroundColor];
101
+ _layoutManager.padding = _padding;
102
+ _layoutManager.paddingLeft = _paddingLeft;
103
+ _layoutManager.paddingRight = _paddingRight;
104
+ _layoutManager.paddingTop = _paddingTop;
105
+ _layoutManager.paddingBottom = _paddingBottom;
106
+ _layoutManager.cornerRadius = _cornerRadius;
107
+
108
+ [textStorage addLayoutManager:_layoutManager];
109
+
110
+ NSTextContainer *textContainer = [[NSTextContainer alloc] init];
111
+ [_layoutManager addTextContainer:textContainer];
112
+
113
+ _textView = [[UITextView alloc] initWithFrame:CGRectZero textContainer:textContainer];
114
+ _textView.delegate = self;
115
+ _textView.font = [UIFont systemFontOfSize:32];
116
+ _textView.textAlignment = NSTextAlignmentCenter;
117
+ _textView.textContainerInset = UIEdgeInsetsMake(10, 10, 10, 10);
118
+ _textView.backgroundColor = [UIColor clearColor];
119
+ _textView.editable = YES;
120
+ _textView.scrollEnabled = YES;
121
+ _textView.userInteractionEnabled = YES;
122
+
123
+ self.contentView = _textView;
124
+ self.userInteractionEnabled = YES;
125
+ }
126
+
127
+ return self;
128
+ }
129
+
130
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
131
+ {
132
+ const auto &oldViewProps = *std::static_pointer_cast<HighlightTextViewProps const>(_props);
133
+ const auto &newViewProps = *std::static_pointer_cast<HighlightTextViewProps const>(props);
134
+
135
+ if (oldViewProps.color != newViewProps.color) {
136
+ _characterBackgroundColor = [[NSString alloc] initWithUTF8String: newViewProps.color.c_str()];
137
+ _layoutManager.backgroundColor = [self hexStringToColor:_characterBackgroundColor];
138
+ [self applyCharacterBackgrounds];
139
+ }
140
+
141
+ if (oldViewProps.textColor != newViewProps.textColor) {
142
+ NSString *textColorStr = [[NSString alloc] initWithUTF8String: newViewProps.textColor.c_str()];
143
+ _textView.textColor = [self hexStringToColor:textColorStr];
144
+ [self applyCharacterBackgrounds];
145
+ }
146
+
147
+ if (oldViewProps.textAlign != newViewProps.textAlign) {
148
+ NSString *alignment = [[NSString alloc] initWithUTF8String: newViewProps.textAlign.c_str()];
149
+ if ([alignment isEqualToString:@"center"]) {
150
+ _textView.textAlignment = NSTextAlignmentCenter;
151
+ } else if ([alignment isEqualToString:@"right"]) {
152
+ _textView.textAlignment = NSTextAlignmentRight;
153
+ } else {
154
+ _textView.textAlignment = NSTextAlignmentLeft;
155
+ }
156
+ [self applyCharacterBackgrounds]; // Reapply to update alignment
157
+ }
158
+
159
+ if (oldViewProps.fontSize != newViewProps.fontSize) {
160
+ NSString *fontSizeStr = [[NSString alloc] initWithUTF8String: newViewProps.fontSize.c_str()];
161
+ CGFloat fontSize = [fontSizeStr floatValue];
162
+ if (fontSize > 0) {
163
+ NSString *fontFamily = _textView.font.familyName;
164
+ _textView.font = [UIFont fontWithName:fontFamily size:fontSize] ?: [UIFont systemFontOfSize:fontSize];
165
+ }
166
+ }
167
+
168
+ if (oldViewProps.fontFamily != newViewProps.fontFamily) {
169
+ NSString *fontFamily = [[NSString alloc] initWithUTF8String: newViewProps.fontFamily.c_str()];
170
+ CGFloat fontSize = _textView.font.pointSize;
171
+ _textView.font = [UIFont fontWithName:fontFamily size:fontSize] ?: [UIFont systemFontOfSize:fontSize];
172
+ }
173
+
174
+ if (oldViewProps.padding != newViewProps.padding) {
175
+ NSString *paddingStr = [[NSString alloc] initWithUTF8String: newViewProps.padding.c_str()];
176
+ CGFloat padding = [paddingStr floatValue];
177
+ if (padding > 0) {
178
+ _padding = padding;
179
+ _paddingLeft = _paddingRight = _paddingTop = _paddingBottom = padding;
180
+ _layoutManager.padding = _padding;
181
+ _layoutManager.paddingLeft = _paddingLeft;
182
+ _layoutManager.paddingRight = _paddingRight;
183
+ _layoutManager.paddingTop = _paddingTop;
184
+ _layoutManager.paddingBottom = _paddingBottom;
185
+ }
186
+ }
187
+
188
+ if (oldViewProps.paddingLeft != newViewProps.paddingLeft) {
189
+ NSString *paddingStr = [[NSString alloc] initWithUTF8String: newViewProps.paddingLeft.c_str()];
190
+ CGFloat padding = [paddingStr floatValue];
191
+ if (padding >= 0) {
192
+ _paddingLeft = padding;
193
+ _layoutManager.paddingLeft = _paddingLeft;
194
+ }
195
+ }
196
+
197
+ if (oldViewProps.paddingRight != newViewProps.paddingRight) {
198
+ NSString *paddingStr = [[NSString alloc] initWithUTF8String: newViewProps.paddingRight.c_str()];
199
+ CGFloat padding = [paddingStr floatValue];
200
+ if (padding >= 0) {
201
+ _paddingRight = padding;
202
+ _layoutManager.paddingRight = _paddingRight;
203
+ }
204
+ }
205
+
206
+ if (oldViewProps.paddingTop != newViewProps.paddingTop) {
207
+ NSString *paddingStr = [[NSString alloc] initWithUTF8String: newViewProps.paddingTop.c_str()];
208
+ CGFloat padding = [paddingStr floatValue];
209
+ if (padding >= 0) {
210
+ _paddingTop = padding;
211
+ _layoutManager.paddingTop = _paddingTop;
212
+ }
213
+ }
214
+
215
+ if (oldViewProps.paddingBottom != newViewProps.paddingBottom) {
216
+ NSString *paddingStr = [[NSString alloc] initWithUTF8String: newViewProps.paddingBottom.c_str()];
217
+ CGFloat padding = [paddingStr floatValue];
218
+ if (padding >= 0) {
219
+ _paddingBottom = padding;
220
+ _layoutManager.paddingBottom = _paddingBottom;
221
+ }
222
+ }
223
+
224
+ [super updateProps:props oldProps:oldProps];
225
+ }
226
+
227
+ Class<RCTComponentViewProtocol> HighlightTextViewCls(void)
228
+ {
229
+ return HighlightTextView.class;
230
+ }
231
+
232
+ - (void)textViewDidChange:(UITextView *)textView
233
+ {
234
+ [self applyCharacterBackgrounds];
235
+ }
236
+
237
+ - (void)applyCharacterBackgrounds
238
+ {
239
+ NSString *text = _textView.text;
240
+ if (text.length == 0) {
241
+ return;
242
+ }
243
+
244
+ NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:text];
245
+ UIColor *bgColor = [self hexStringToColor:_characterBackgroundColor];
246
+
247
+ // Apply font and paragraph style
248
+ [attributedString addAttribute:NSFontAttributeName
249
+ value:_textView.font
250
+ range:NSMakeRange(0, text.length)];
251
+
252
+ // Apply text color if available
253
+ if (_textView.textColor) {
254
+ [attributedString addAttribute:NSForegroundColorAttributeName
255
+ value:_textView.textColor
256
+ range:NSMakeRange(0, text.length)];
257
+ }
258
+
259
+ NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
260
+ paragraphStyle.alignment = _textView.textAlignment;
261
+ [attributedString addAttribute:NSParagraphStyleAttributeName
262
+ value:paragraphStyle
263
+ range:NSMakeRange(0, text.length)];
264
+
265
+ for (NSUInteger i = 0; i < text.length; i++) {
266
+ unichar character = [text characterAtIndex:i];
267
+
268
+ // Skip newlines and spaces for background
269
+ if (character != '\n' && character != ' ') {
270
+ [attributedString addAttribute:NSBackgroundColorAttributeName
271
+ value:bgColor
272
+ range:NSMakeRange(i, 1)];
273
+ }
274
+ }
275
+
276
+ _textView.attributedText = attributedString;
277
+ [_textView setNeedsDisplay];
278
+ }
279
+
280
+ - (UIColor *)hexStringToColor:(NSString *)stringToConvert
281
+ {
282
+ NSString *noHashString = [stringToConvert stringByReplacingOccurrencesOfString:@"#" withString:@""];
283
+ NSScanner *stringScanner = [NSScanner scannerWithString:noHashString];
284
+
285
+ unsigned hex;
286
+ if (![stringScanner scanHexInt:&hex]) return nil;
287
+ int r = (hex >> 16) & 0xFF;
288
+ int g = (hex >> 8) & 0xFF;
289
+ int b = (hex) & 0xFF;
290
+
291
+ return [UIColor colorWithRed:r / 255.0f green:g / 255.0f blue:b / 255.0f alpha:1.0f];
292
+ }
293
+
294
+ @end
@@ -0,0 +1,18 @@
1
+ import { codegenNativeComponent, type ViewProps } from 'react-native';
2
+
3
+ export interface HighlightTextViewProps extends ViewProps {
4
+ color?: string;
5
+ textColor?: string;
6
+ textAlign?: string;
7
+ fontFamily?: string;
8
+ fontSize?: string;
9
+ padding?: string;
10
+ paddingLeft?: string;
11
+ paddingRight?: string;
12
+ paddingTop?: string;
13
+ paddingBottom?: string;
14
+ }
15
+
16
+ export default codegenNativeComponent<HighlightTextViewProps>(
17
+ 'HighlightTextView'
18
+ );
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ export { default as HighlightTextView } from './HighlightTextViewNativeComponent';
4
+ export * from './HighlightTextViewNativeComponent';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["default","HighlightTextView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,OAAO,IAAIC,iBAAiB,QAAQ,oCAAoC;AACjF,cAAc,oCAAoC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,16 @@
1
+ import { type ViewProps } from 'react-native';
2
+ export interface HighlightTextViewProps extends ViewProps {
3
+ color?: string;
4
+ textColor?: string;
5
+ textAlign?: string;
6
+ fontFamily?: string;
7
+ fontSize?: string;
8
+ padding?: string;
9
+ paddingLeft?: string;
10
+ paddingRight?: string;
11
+ paddingTop?: string;
12
+ paddingBottom?: string;
13
+ }
14
+ declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<HighlightTextViewProps>;
15
+ export default _default;
16
+ //# sourceMappingURL=HighlightTextViewNativeComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HighlightTextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/HighlightTextViewNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,MAAM,WAAW,sBAAuB,SAAQ,SAAS;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;;AAED,wBAEE"}
@@ -0,0 +1,3 @@
1
+ export { default as HighlightTextView } from './HighlightTextViewNativeComponent';
2
+ export * from './HighlightTextViewNativeComponent';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAClF,cAAc,oCAAoC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,169 @@
1
+ {
2
+ "name": "react-native-highlight-text-view",
3
+ "version": "0.1.0",
4
+ "description": "A native text input for React Native that supports inline text highlighting",
5
+ "main": "./lib/module/index.js",
6
+ "types": "./lib/typescript/src/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.tsx",
10
+ "types": "./lib/typescript/src/index.d.ts",
11
+ "default": "./lib/module/index.js"
12
+ },
13
+ "./package.json": "./package.json"
14
+ },
15
+ "files": [
16
+ "src",
17
+ "lib",
18
+ "android",
19
+ "ios",
20
+ "cpp",
21
+ "*.podspec",
22
+ "react-native.config.js",
23
+ "!ios/build",
24
+ "!android/build",
25
+ "!android/gradle",
26
+ "!android/gradlew",
27
+ "!android/gradlew.bat",
28
+ "!android/local.properties",
29
+ "!**/__tests__",
30
+ "!**/__fixtures__",
31
+ "!**/__mocks__",
32
+ "!**/.*"
33
+ ],
34
+ "scripts": {
35
+ "example": "yarn workspace react-native-highlight-text-example",
36
+ "test": "jest",
37
+ "typecheck": "tsc",
38
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
39
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
40
+ "prepare": "bob build",
41
+ "release": "release-it --only-version"
42
+ },
43
+ "keywords": [
44
+ "react-native",
45
+ "ios",
46
+ "android"
47
+ ],
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "git+https://github.com/aqeelkhokhar/react-native-highlight-text.git.git"
51
+ },
52
+ "author": "Aqeel Ahmad Khokhar <aqeelahmadkhokhar99@gmail.com> (https://portfolio-aqeel-ahmads-projects-6ef4879c.vercel.app/)",
53
+ "license": "MIT",
54
+ "bugs": {
55
+ "url": "https://github.com/aqeelkhokhar/react-native-highlight-text.git/issues"
56
+ },
57
+ "homepage": "https://github.com/aqeelkhokhar/react-native-highlight-text.git#readme",
58
+ "publishConfig": {
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "devDependencies": {
62
+ "@commitlint/config-conventional": "^19.8.1",
63
+ "@eslint/compat": "^1.3.2",
64
+ "@eslint/eslintrc": "^3.3.1",
65
+ "@eslint/js": "^9.35.0",
66
+ "@evilmartians/lefthook": "^1.12.3",
67
+ "@react-native-community/cli": "20.0.1",
68
+ "@react-native/babel-preset": "0.81.1",
69
+ "@react-native/eslint-config": "^0.81.1",
70
+ "@release-it/conventional-changelog": "^10.0.1",
71
+ "@types/jest": "^29.5.14",
72
+ "@types/react": "^19.1.0",
73
+ "commitlint": "^19.8.1",
74
+ "del-cli": "^6.0.0",
75
+ "eslint": "^9.35.0",
76
+ "eslint-config-prettier": "^10.1.8",
77
+ "eslint-plugin-prettier": "^5.5.4",
78
+ "jest": "^29.7.0",
79
+ "prettier": "^3.6.2",
80
+ "react": "19.1.0",
81
+ "react-native": "0.81.1",
82
+ "react-native-builder-bob": "^0.40.13",
83
+ "release-it": "^19.0.4",
84
+ "turbo": "^2.5.6",
85
+ "typescript": "^5.9.2"
86
+ },
87
+ "peerDependencies": {
88
+ "react": "*",
89
+ "react-native": "*"
90
+ },
91
+ "workspaces": [
92
+ "example"
93
+ ],
94
+ "packageManager": "yarn@3.6.1",
95
+ "jest": {
96
+ "preset": "react-native",
97
+ "modulePathIgnorePatterns": [
98
+ "<rootDir>/example/node_modules",
99
+ "<rootDir>/lib/"
100
+ ]
101
+ },
102
+ "commitlint": {
103
+ "extends": [
104
+ "@commitlint/config-conventional"
105
+ ]
106
+ },
107
+ "release-it": {
108
+ "git": {
109
+ "commitMessage": "chore: release ${version}",
110
+ "tagName": "v${version}"
111
+ },
112
+ "npm": {
113
+ "publish": true
114
+ },
115
+ "github": {
116
+ "release": true
117
+ },
118
+ "plugins": {
119
+ "@release-it/conventional-changelog": {
120
+ "preset": {
121
+ "name": "angular"
122
+ }
123
+ }
124
+ }
125
+ },
126
+ "prettier": {
127
+ "quoteProps": "consistent",
128
+ "singleQuote": true,
129
+ "tabWidth": 2,
130
+ "trailingComma": "es5",
131
+ "useTabs": false
132
+ },
133
+ "react-native-builder-bob": {
134
+ "source": "src",
135
+ "output": "lib",
136
+ "targets": [
137
+ [
138
+ "module",
139
+ {
140
+ "esm": true
141
+ }
142
+ ],
143
+ [
144
+ "typescript",
145
+ {
146
+ "project": "tsconfig.build.json"
147
+ }
148
+ ]
149
+ ]
150
+ },
151
+ "codegenConfig": {
152
+ "name": "HighlightTextViewSpec",
153
+ "type": "all",
154
+ "jsSrcsDir": "src",
155
+ "android": {
156
+ "javaPackageName": "com.highlighttext"
157
+ },
158
+ "ios": {
159
+ "componentProvider": {
160
+ "HighlightTextView": "HighlightTextView"
161
+ }
162
+ }
163
+ },
164
+ "create-react-native-library": {
165
+ "languages": "kotlin-objc",
166
+ "type": "fabric-view",
167
+ "version": "0.54.5"
168
+ }
169
+ }
@@ -0,0 +1,18 @@
1
+ import { codegenNativeComponent, type ViewProps } from 'react-native';
2
+
3
+ export interface HighlightTextViewProps extends ViewProps {
4
+ color?: string;
5
+ textColor?: string;
6
+ textAlign?: string;
7
+ fontFamily?: string;
8
+ fontSize?: string;
9
+ padding?: string;
10
+ paddingLeft?: string;
11
+ paddingRight?: string;
12
+ paddingTop?: string;
13
+ paddingBottom?: string;
14
+ }
15
+
16
+ export default codegenNativeComponent<HighlightTextViewProps>(
17
+ 'HighlightTextView'
18
+ );
package/src/index.tsx ADDED
@@ -0,0 +1,2 @@
1
+ export { default as HighlightTextView } from './HighlightTextViewNativeComponent';
2
+ export * from './HighlightTextViewNativeComponent';