react-native-advanced-text 0.1.11 → 0.1.13

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.
@@ -81,6 +81,23 @@ class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>(),
81
81
  view?.setIndicatorWordIndex(index)
82
82
  }
83
83
 
84
+ @ReactProp(name = "color")
85
+ fun setColor(view: AdvancedTextView?, color: String?) {
86
+ color?.let {
87
+ try {
88
+ view?.setTextColor(android.graphics.Color.parseColor(it))
89
+ } catch (e: IllegalArgumentException) {
90
+ // fallback to default color if parsing fails
91
+ view?.setTextColor(android.graphics.Color.BLACK)
92
+ }
93
+ }
94
+ }
95
+
96
+ @ReactProp(name = "fontSize")
97
+ fun setFontSize(view: AdvancedTextView?, fontSize: Int) {
98
+ view?.setTextSize(fontSize.toFloat())
99
+ }
100
+
84
101
  // Add this method to register custom events
85
102
  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> {
86
103
  return mapOf(
@@ -89,6 +106,7 @@ class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>(),
89
106
  )
90
107
  }
91
108
 
109
+
92
110
  companion object {
93
111
  const val NAME = "AdvancedTextView"
94
112
  }
@@ -9,7 +9,8 @@ export const AdvancedText = ({
9
9
  onWordPress,
10
10
  onSelection,
11
11
  indicatorWordIndex,
12
- ...restProps
12
+ color,
13
+ fontSize
13
14
  }) => {
14
15
  return /*#__PURE__*/_jsx(AdvancedTextViewNativeComponent, {
15
16
  text: text,
@@ -18,7 +19,8 @@ export const AdvancedText = ({
18
19
  onWordPress: onWordPress,
19
20
  onSelection: onSelection,
20
21
  indicatorWordIndex: indicatorWordIndex,
21
- ...restProps
22
+ color: color,
23
+ fontSize: fontSize
22
24
  });
23
25
  };
24
26
  //# sourceMappingURL=AdvancedText.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["AdvancedTextViewNativeComponent","jsx","_jsx","AdvancedText","text","highlightedWords","menuOptions","onWordPress","onSelection","indicatorWordIndex","restProps"],"sourceRoot":"..\\..\\src","sources":["AdvancedText.tsx"],"mappings":";;AACA,OAAOA,+BAA+B,MAAM,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAkBhF,OAAO,MAAMC,YAAmC,GAAGA,CAAC;EAClDC,IAAI;EACJC,gBAAgB;EAChBC,WAAW;EACXC,WAAW;EACXC,WAAW;EACXC,kBAAkB;EAClB,GAAGC;AACL,CAAC,KAAK;EACJ,oBACER,IAAA,CAACF,+BAA+B;IAC9BI,IAAI,EAAEA,IAAK;IACXC,gBAAgB,EAAEA,gBAAiB;IACnCC,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBC,kBAAkB,EAAEA,kBAAmB;IAAA,GACnCC;EAAS,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["AdvancedTextViewNativeComponent","jsx","_jsx","AdvancedText","text","highlightedWords","menuOptions","onWordPress","onSelection","indicatorWordIndex","color","fontSize"],"sourceRoot":"..\\..\\src","sources":["AdvancedText.tsx"],"mappings":";;AACA,OAAOA,+BAA+B,MAAM,mCAAmC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAuBhF,OAAO,MAAMC,YAAmC,GAAGA,CAAC;EAClDC,IAAI;EACJC,gBAAgB;EAChBC,WAAW;EACXC,WAAW;EACXC,WAAW;EACXC,kBAAkB;EAClBC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,oBACET,IAAA,CAACF,+BAA+B;IAC9BI,IAAI,EAAEA,IAAK;IACXC,gBAAgB,EAAEA,gBAAiB;IACnCC,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA,WAAY;IACzBC,kBAAkB,EAAEA,kBAAmB;IACvCC,KAAK,EAAEA,KAAM;IACbC,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC","ignoreList":[]}
@@ -11,6 +11,8 @@ interface HighlightedWord {
11
11
 
12
12
  interface NativeProps extends ViewProps {
13
13
  text: string;
14
+ color: string;
15
+ fontSize: Int32;
14
16
  highlightedWords?: ReadonlyArray<HighlightedWord>;
15
17
  menuOptions?: ReadonlyArray<string>;
16
18
  onWordPress?: DirectEventHandler<{ word: string }>;
@@ -6,13 +6,16 @@ interface HighlightedWord {
6
6
  interface NativeProps extends ViewProps {
7
7
  text: string;
8
8
  highlightedWords?: ReadonlyArray<HighlightedWord>;
9
+ color: string;
10
+ fontSize: number;
9
11
  menuOptions?: ReadonlyArray<string>;
10
12
  onWordPress?: (event: NativeSyntheticEvent<{
11
13
  word: string;
14
+ index: string;
12
15
  }>) => void;
13
16
  onSelection?: (event: NativeSyntheticEvent<{
14
17
  selectedText: string;
15
- eventType: string;
18
+ event: string;
16
19
  }>) => void;
17
20
  indicatorWordIndex?: number;
18
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AdvancedText.d.ts","sourceRoot":"","sources":["../../../src/AdvancedText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,KAAK,IAAI,CAAC;IACtE,WAAW,CAAC,EAAE,CACZ,KAAK,EAAE,oBAAoB,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,KACrE,IAAI,CAAC;IACV,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAoB9C,CAAC"}
1
+ {"version":3,"file":"AdvancedText.d.ts","sourceRoot":"","sources":["../../../src/AdvancedText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGpE,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IAEjB,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,CACZ,KAAK,EAAE,oBAAoB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,KACzD,IAAI,CAAC;IACV,WAAW,CAAC,EAAE,CACZ,KAAK,EAAE,oBAAoB,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,KACjE,IAAI,CAAC;IACV,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAsB9C,CAAC"}
@@ -6,6 +6,8 @@ interface HighlightedWord {
6
6
  }
7
7
  interface NativeProps extends ViewProps {
8
8
  text: string;
9
+ color: string;
10
+ fontSize: Int32;
9
11
  highlightedWords?: ReadonlyArray<HighlightedWord>;
10
12
  menuOptions?: ReadonlyArray<string>;
11
13
  onWordPress?: DirectEventHandler<{
@@ -1 +1 @@
1
- {"version":3,"file":"AdvancedTextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/AdvancedTextViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE3F,UAAU,eAAe;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,kBAAkB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,kBAAkB,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9E,kBAAkB,CAAC,EAAE,KAAK,CAAC;CAC5B;;AAED,wBAAuE"}
1
+ {"version":3,"file":"AdvancedTextViewNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/AdvancedTextViewNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAE3F,UAAU,eAAe;IACvB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,WAAY,SAAQ,SAAS;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC;IAChB,gBAAgB,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAClD,WAAW,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,CAAC,EAAE,kBAAkB,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnD,WAAW,CAAC,EAAE,kBAAkB,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9E,kBAAkB,CAAC,EAAE,KAAK,CAAC;CAC5B;;AAED,wBAAuE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-advanced-text",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": " Advanced text component for React Native with custom select options.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -9,10 +9,15 @@ interface HighlightedWord {
9
9
  interface NativeProps extends ViewProps {
10
10
  text: string;
11
11
  highlightedWords?: ReadonlyArray<HighlightedWord>;
12
+ color: string;
13
+ fontSize: number;
14
+
12
15
  menuOptions?: ReadonlyArray<string>;
13
- onWordPress?: (event: NativeSyntheticEvent<{ word: string }>) => void;
16
+ onWordPress?: (
17
+ event: NativeSyntheticEvent<{ word: string; index: string }>
18
+ ) => void;
14
19
  onSelection?: (
15
- event: NativeSyntheticEvent<{ selectedText: string; eventType: string }>
20
+ event: NativeSyntheticEvent<{ selectedText: string; event: string }>
16
21
  ) => void;
17
22
  indicatorWordIndex?: number;
18
23
  }
@@ -24,7 +29,8 @@ export const AdvancedText: React.FC<NativeProps> = ({
24
29
  onWordPress,
25
30
  onSelection,
26
31
  indicatorWordIndex,
27
- ...restProps
32
+ color,
33
+ fontSize,
28
34
  }) => {
29
35
  return (
30
36
  <AdvancedTextViewNativeComponent
@@ -34,7 +40,8 @@ export const AdvancedText: React.FC<NativeProps> = ({
34
40
  onWordPress={onWordPress}
35
41
  onSelection={onSelection}
36
42
  indicatorWordIndex={indicatorWordIndex}
37
- {...restProps}
43
+ color={color}
44
+ fontSize={fontSize}
38
45
  />
39
46
  );
40
47
  };
@@ -11,6 +11,8 @@ interface HighlightedWord {
11
11
 
12
12
  interface NativeProps extends ViewProps {
13
13
  text: string;
14
+ color: string;
15
+ fontSize: Int32;
14
16
  highlightedWords?: ReadonlyArray<HighlightedWord>;
15
17
  menuOptions?: ReadonlyArray<string>;
16
18
  onWordPress?: DirectEventHandler<{ word: string }>;