I need to add native performance to the present React Native Textual content element. Due to this fact, I intend to create a brand new element that maintains the performance of the present Textual content element whereas incorporating extra native options, by inheriting from the Textual content element.
import Basis
import React
@objc(MyAwesomeText)
class MyAwesomeText: RCTTextViewManager {
override func view() -> UIView! {
let textView = UITextView()
return textView
}
override static func requiresMainQueueSetup() -> Bool {
return true
}
}
After I inherit from RCTTextViewManager as described above, the next error happens:
Exception thrown whereas executing UI block: -[UITextView setTextStorage:contentFrame:descendantViews:]: unrecognized selector despatched to occasion 0x13f619400
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke
RCTUIManager.m:1202
__44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.206
__RCTExecuteOnMainQueue_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_drain
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
-[UIApplication _run]
UIApplicationMain
major
start_sim
0x0
0x0
For Android, it really works nicely when inheriting from ReactTextViewManager as follows:
package deal com.rntextexample
import com.fb.react.bridge.ReactApplicationContext
import com.fb.react.uimanager.ThemedReactContext
import com.fb.react.uimanager.annotations.ReactProp
import com.fb.react.views.textual content.ReactTextView
import com.fb.react.views.textual content.ReactTextViewManager;
class MyAwesomeText(personal val callerContext: ReactApplicationContext): ReactTextViewManager() {
companion object {
const val REACT_CLASS = "MyAwesomeText"
}
override enjoyable getName(): String = REACT_CLASS
override enjoyable createViewInstance(context: ThemedReactContext): ReactTextView = ReactTextView(context)
...
}
I am curious The way it’s doable to increase and make the most of the present React Native Textual content element for iOS. (Simply so you recognize, I am seeking to develop in Swift.)