react-native-advanced-text 0.1.18 → 0.1.19

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.
@@ -8,25 +8,10 @@ import com.facebook.react.bridge.ReadableArray
8
8
  import com.facebook.react.module.annotations.ReactModule
9
9
  import com.facebook.react.uimanager.SimpleViewManager
10
10
  import com.facebook.react.uimanager.ThemedReactContext
11
- import com.facebook.react.uimanager.ViewManagerDelegate
12
11
  import com.facebook.react.uimanager.annotations.ReactProp
13
- import com.facebook.react.viewmanagers.AdvancedTextViewManagerInterface
14
- import com.facebook.react.viewmanagers.AdvancedTextViewManagerDelegate
15
- import com.facebook.react.uimanager.PixelUtil
16
12
 
17
13
  @ReactModule(name = AdvancedTextViewManager.NAME)
18
- class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>(),
19
- AdvancedTextViewManagerInterface<AdvancedTextView> {
20
-
21
- private val mDelegate: ViewManagerDelegate<AdvancedTextView>
22
-
23
- init {
24
- mDelegate = AdvancedTextViewManagerDelegate(this)
25
- }
26
-
27
- override fun getDelegate(): ViewManagerDelegate<AdvancedTextView>? {
28
- return mDelegate
29
- }
14
+ class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>() {
30
15
 
31
16
  override fun getName(): String {
32
17
  return NAME
@@ -40,17 +25,18 @@ class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>(),
40
25
  )
41
26
  // Set default text color to black to ensure visibility
42
27
  view.setTextColor(Color.BLACK)
28
+ android.util.Log.d(NAME, "createViewInstance: View created")
43
29
  return view
44
30
  }
45
31
 
46
32
  @ReactProp(name = "text")
47
- override fun setText(view: AdvancedTextView?, text: String?) {
48
- android.util.Log.d("AdvancedTextViewManager", "setText called with: '$text'")
33
+ fun setText(view: AdvancedTextView?, text: String?) {
34
+ android.util.Log.d(NAME, "setText called with: '$text'")
49
35
  view?.setAdvancedText(text ?: "")
50
36
  }
51
37
 
52
38
  @ReactProp(name = "highlightedWords")
53
- override fun setHighlightedWords(view: AdvancedTextView?, highlightedWords: ReadableArray?) {
39
+ fun setHighlightedWords(view: AdvancedTextView?, highlightedWords: ReadableArray?) {
54
40
  if (highlightedWords == null) {
55
41
  view?.setHighlightedWords(emptyList())
56
42
  return
@@ -70,11 +56,12 @@ class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>(),
70
56
  }
71
57
  }
72
58
  }
59
+ android.util.Log.d(NAME, "setHighlightedWords: ${words.size} words")
73
60
  view?.setHighlightedWords(words)
74
61
  }
75
62
 
76
63
  @ReactProp(name = "menuOptions")
77
- override fun setMenuOptions(view: AdvancedTextView?, menuOptions: ReadableArray?) {
64
+ fun setMenuOptions(view: AdvancedTextView?, menuOptions: ReadableArray?) {
78
65
  if (menuOptions == null) {
79
66
  view?.setMenuOptions(emptyList())
80
67
  return
@@ -86,25 +73,26 @@ class AdvancedTextViewManager : SimpleViewManager<AdvancedTextView>(),
86
73
  options.add(option)
87
74
  }
88
75
  }
76
+ android.util.Log.d(NAME, "setMenuOptions: ${options.size} options")
89
77
  view?.setMenuOptions(options)
90
78
  }
91
79
 
92
80
  @ReactProp(name = "indicatorWordIndex")
93
- override fun setIndicatorWordIndex(view: AdvancedTextView?, index: Int) {
81
+ fun setIndicatorWordIndex(view: AdvancedTextView?, index: Int) {
82
+ android.util.Log.d(NAME, "setIndicatorWordIndex: $index")
94
83
  view?.setIndicatorWordIndex(if (index >= 0) index else -1)
95
84
  }
96
85
 
97
86
  @ReactProp(name = "color", customType = "Color")
98
87
  fun setColor(view: AdvancedTextView?, color: Int?) {
99
- android.util.Log.d("AdvancedTextViewManager", "setColor called with: $color")
88
+ android.util.Log.d(NAME, "setColor called with: $color")
100
89
  view?.setTextColor(color ?: Color.BLACK)
101
90
  }
102
91
 
103
92
  @ReactProp(name = "fontSize")
104
93
  fun setFontSize(view: AdvancedTextView?, fontSize: Float) {
105
- android.util.Log.d("AdvancedTextViewManager", "setFontSize called with: $fontSize")
94
+ android.util.Log.d(NAME, "setFontSize called with: $fontSize")
106
95
  if (fontSize > 0) {
107
- // Convert from React Native points to Android pixels
108
96
  view?.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize)
109
97
  }
110
98
  }
@@ -2,7 +2,7 @@
2
2
  import type { ViewProps } from 'react-native';
3
3
  import { codegenNativeComponent } from 'react-native';
4
4
  // @ts-ignore
5
- import type { DirectEventHandler, Float, Int32} from 'react-native/Libraries/Types/CodegenTypes';
5
+ import type { DirectEventHandler, Int32} from 'react-native/Libraries/Types/CodegenTypes';
6
6
 
7
7
  interface HighlightedWord {
8
8
  index: Int32;
@@ -16,8 +16,6 @@ interface NativeProps extends ViewProps {
16
16
  onWordPress?: DirectEventHandler<{ word: string; index: Int32 }>;
17
17
  onSelection?: DirectEventHandler<{ selectedText: string; event: string }>;
18
18
  indicatorWordIndex?: Int32;
19
- color?: Int32;
20
- fontSize?: Float;
21
19
  }
22
20
 
23
21
  export default codegenNativeComponent<NativeProps>('AdvancedTextView');
@@ -1,5 +1,5 @@
1
1
  import type { ViewProps } from 'react-native';
2
- import type { DirectEventHandler, Float, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
2
+ import type { DirectEventHandler, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  interface HighlightedWord {
4
4
  index: Int32;
5
5
  highlightColor: string;
@@ -17,8 +17,6 @@ interface NativeProps extends ViewProps {
17
17
  event: string;
18
18
  }>;
19
19
  indicatorWordIndex?: Int32;
20
- color?: Int32;
21
- fontSize?: Float;
22
20
  }
23
21
  declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
24
22
  export default _default;
@@ -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,EAA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AAA;KAAE,CAAC,CAAC;IACjE,WAAW,CAAC,EAAE,kBAAkB,CAAC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,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.18",
3
+ "version": "0.1.19",
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",
@@ -2,7 +2,7 @@
2
2
  import type { ViewProps } from 'react-native';
3
3
  import { codegenNativeComponent } from 'react-native';
4
4
  // @ts-ignore
5
- import type { DirectEventHandler, Float, Int32} from 'react-native/Libraries/Types/CodegenTypes';
5
+ import type { DirectEventHandler, Int32} from 'react-native/Libraries/Types/CodegenTypes';
6
6
 
7
7
  interface HighlightedWord {
8
8
  index: Int32;
@@ -16,8 +16,6 @@ interface NativeProps extends ViewProps {
16
16
  onWordPress?: DirectEventHandler<{ word: string; index: Int32 }>;
17
17
  onSelection?: DirectEventHandler<{ selectedText: string; event: string }>;
18
18
  indicatorWordIndex?: Int32;
19
- color?: Int32;
20
- fontSize?: Float;
21
19
  }
22
20
 
23
21
  export default codegenNativeComponent<NativeProps>('AdvancedTextView');