Skip to content

Instantly share code, notes, and snippets.

@nkt
Created Dec 23, 2017
Embed
What would you like to do?

React Native Swift

Example of react native swift component implementation

#import <React/RCTBridgeModule.h>
#import <React/RCTViewManager.h>
@interface RCT_EXTERN_MODULE(RNPhoneInputSwift, RCTViewManager)
RCT_EXPORT_VIEW_PROPERTY(value, NSString);
@end
import Foundation
@objc(RNPhoneInput)
public class RNPhoneInput : UITextField {
@objc(setValue:)
public func setValue(value: String) {
self.text = value
}
}
import Foundation
@objc(RNPhoneInputSwift)
class RNPhoneInputManager : RCTViewManager {
override static func requiresMainQueueSetup() -> Bool {
return false
}
override func view() -> UIView! {
return RNPhoneInput()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment