selectable text experiment

This commit is contained in:
Hailey
2024-01-11 00:38:47 -08:00
parent c75771047c
commit c6d2e54923
18 changed files with 787 additions and 2 deletions
@@ -0,0 +1,26 @@
import ExpoModulesCore
public class ExpoProTextModule: Module {
public func definition() -> ModuleDefinition {
Name("ExpoProText")
View(ExpoProTextView.self) {
Events("onTextPress", "onTextLongPress")
Prop("segments") { (view: ExpoProTextView, prop: String) in
// Convert the JSON to segments
if let data = prop.data(using: .utf8) {
print("yes")
if let segments = try? JSONDecoder().decode(TextSegments.self, from: data) {
print("yes2")
view.segments = segments.segments
}
}
}
Prop("selectable") { (view: ExpoProTextView, prop: Bool) in
view.textView.isSelectable = prop
}
}
}
}