mirror of
https://github.com/Tencent/Hippy.git
synced 2026-10-29 06:06:52 +08:00
refactor(ios): revert rename Hippy prefix to NativeRender
This commit is contained in:
committed by
hippy-actions[bot]
parent
e37764723c
commit
d3bff2625e
+1
-1
@@ -23,7 +23,7 @@
|
||||
#import "HippyRefresh.h"
|
||||
#import "HippyComponent.h"
|
||||
|
||||
@interface NativeRenderFooterRefresh : HippyRefresh
|
||||
@interface HippyFooterRefresh : HippyRefresh
|
||||
|
||||
@property (nonatomic, assign) BOOL refreshStick;
|
||||
@property (nonatomic, copy) HippyDirectEventBlock onFooterReleased;
|
||||
+2
-2
@@ -20,9 +20,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderFooterRefresh.h"
|
||||
#import "HippyFooterRefresh.h"
|
||||
|
||||
@implementation NativeRenderFooterRefresh
|
||||
@implementation HippyFooterRefresh
|
||||
|
||||
- (void)setScrollView:(UIScrollView *)scrollView {
|
||||
[super setScrollView:scrollView];
|
||||
+1
-1
@@ -22,6 +22,6 @@
|
||||
|
||||
#import "HippyViewManager.h"
|
||||
|
||||
@interface NativeRenderTextViewManager : HippyViewManager
|
||||
@interface HippyFooterRefreshManager : HippyViewManager
|
||||
|
||||
@end
|
||||
+4
-4
@@ -20,11 +20,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderFooterRefreshManager.h"
|
||||
#import "NativeRenderFooterRefresh.h"
|
||||
#import "HippyFooterRefreshManager.h"
|
||||
#import "HippyFooterRefresh.h"
|
||||
#import "HippyUIManager.h"
|
||||
|
||||
@implementation NativeRenderFooterRefreshManager
|
||||
@implementation HippyFooterRefreshManager
|
||||
|
||||
HIPPY_EXPORT_MODULE(PullFooterView);
|
||||
|
||||
@@ -54,7 +54,7 @@ HIPPY_EXPORT_METHOD(expandPullFooter:(nonnull NSNumber *)reactTag) {
|
||||
}
|
||||
|
||||
- (UIView *)view {
|
||||
return [[NativeRenderFooterRefresh alloc] init];
|
||||
return [[HippyFooterRefresh alloc] init];
|
||||
}
|
||||
|
||||
@end
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
#import "HippyRefresh.h"
|
||||
#import "HippyComponent.h"
|
||||
|
||||
@interface NativeRenderHeaderRefresh : HippyRefresh
|
||||
@interface HippyHeaderRefresh : HippyRefresh
|
||||
|
||||
@property (nonatomic, copy) HippyDirectEventBlock onHeaderReleased;
|
||||
@property (nonatomic, copy) HippyDirectEventBlock onHeaderPulling;
|
||||
+2
-2
@@ -20,9 +20,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderHeaderRefresh.h"
|
||||
#import "HippyHeaderRefresh.h"
|
||||
|
||||
@implementation NativeRenderHeaderRefresh
|
||||
@implementation HippyHeaderRefresh
|
||||
|
||||
- (void)setFrame:(CGRect)frame {
|
||||
CGRect properFrame = frame;
|
||||
+1
-1
@@ -22,6 +22,6 @@
|
||||
|
||||
#import "HippyViewManager.h"
|
||||
|
||||
@interface NativeRenderFooterRefreshManager : HippyViewManager
|
||||
@interface HippyHeaderRefreshManager : HippyViewManager
|
||||
|
||||
@end
|
||||
+4
-4
@@ -20,11 +20,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderHeaderRefreshManager.h"
|
||||
#import "NativeRenderHeaderRefresh.h"
|
||||
#import "HippyHeaderRefreshManager.h"
|
||||
#import "HippyHeaderRefresh.h"
|
||||
#import "HippyUIManager.h"
|
||||
|
||||
@implementation NativeRenderHeaderRefreshManager
|
||||
@implementation HippyHeaderRefreshManager
|
||||
|
||||
HIPPY_EXPORT_MODULE(PullHeaderView);
|
||||
|
||||
@@ -53,7 +53,7 @@ HIPPY_EXPORT_METHOD(collapsePullHeaderWithOptions:(nonnull NSNumber *)reactTag o
|
||||
}
|
||||
|
||||
- (UIView *)view {
|
||||
return [[NativeRenderHeaderRefresh alloc] init];
|
||||
return [[HippyHeaderRefresh alloc] init];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -25,8 +25,8 @@
|
||||
#import "NativeRenderBaseListViewCell.h"
|
||||
#import "NativeRenderBaseListViewDataSource.h"
|
||||
#import "NativeRenderCollectionViewFlowLayout.h"
|
||||
#import "NativeRenderFooterRefresh.h"
|
||||
#import "NativeRenderHeaderRefresh.h"
|
||||
#import "HippyFooterRefresh.h"
|
||||
#import "HippyHeaderRefresh.h"
|
||||
#import "HippyUIManager.h"
|
||||
#import "HippyShadowView.h"
|
||||
#import "UIView+DirectionalLayout.h"
|
||||
@@ -157,18 +157,18 @@ static NSString *const kListViewItem = @"ListViewItem";
|
||||
}
|
||||
|
||||
- (void)insertHippySubview:(UIView *)subview atIndex:(NSInteger)atIndex {
|
||||
if ([subview isKindOfClass:[NativeRenderHeaderRefresh class]]) {
|
||||
if ([subview isKindOfClass:[HippyHeaderRefresh class]]) {
|
||||
if (_headerRefreshView) {
|
||||
[_headerRefreshView unsetFromScrollView];
|
||||
}
|
||||
_headerRefreshView = (NativeRenderHeaderRefresh *)subview;
|
||||
_headerRefreshView = (HippyHeaderRefresh *)subview;
|
||||
[_headerRefreshView setScrollView:self.collectionView];
|
||||
_headerRefreshView.delegate = self;
|
||||
} else if ([subview isKindOfClass:[NativeRenderFooterRefresh class]]) {
|
||||
} else if ([subview isKindOfClass:[HippyFooterRefresh class]]) {
|
||||
if (_footerRefreshView) {
|
||||
[_footerRefreshView unsetFromScrollView];
|
||||
}
|
||||
_footerRefreshView = (NativeRenderFooterRefresh *)subview;
|
||||
_footerRefreshView = (HippyFooterRefresh *)subview;
|
||||
[_footerRefreshView setScrollView:self.collectionView];
|
||||
_footerRefreshView.delegate = self;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NativeRenderRefreshWrapper : NativeRenderTouchesView
|
||||
@interface HippyRefreshWrapper : NativeRenderTouchesView
|
||||
|
||||
- (void)refreshCompleted;
|
||||
- (void)startRefresh;
|
||||
+7
-7
@@ -20,21 +20,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderRefreshWrapper.h"
|
||||
#import "HippyRefreshWrapper.h"
|
||||
#import "UIView+Hippy.h"
|
||||
#import "NativeRenderRefreshWrapperItemView.h"
|
||||
#import "HippyRefreshWrapperItemView.h"
|
||||
#import "HippyScrollableProtocol.h"
|
||||
|
||||
@interface NativeRenderRefreshWrapper () <UIScrollViewDelegate>
|
||||
@interface HippyRefreshWrapper () <UIScrollViewDelegate>
|
||||
|
||||
@property (nonatomic, weak) NativeRenderRefreshWrapperItemView *wrapperItemView;
|
||||
@property (nonatomic, weak) HippyRefreshWrapperItemView *wrapperItemView;
|
||||
@property (nonatomic, weak) id<HippyScrollableProtocol> scrollableView;
|
||||
@property (nonatomic, copy) HippyDirectEventBlock onRefresh;
|
||||
@property (nonatomic, assign) CGFloat bounceTime;
|
||||
|
||||
@end
|
||||
|
||||
@implementation NativeRenderRefreshWrapper
|
||||
@implementation HippyRefreshWrapper
|
||||
- (void)addSubview:(UIView *)view {
|
||||
if (view != _wrapperItemView) {
|
||||
[super addSubview:view];
|
||||
@@ -75,8 +75,8 @@
|
||||
|
||||
- (void)insertHippySubview:(UIView *)view atIndex:(NSInteger)index {
|
||||
[super insertHippySubview:view atIndex:index];
|
||||
if ([view isKindOfClass:[NativeRenderRefreshWrapperItemView class]]) {
|
||||
_wrapperItemView = (NativeRenderRefreshWrapperItemView *)view;
|
||||
if ([view isKindOfClass:[HippyRefreshWrapperItemView class]]) {
|
||||
_wrapperItemView = (HippyRefreshWrapperItemView *)view;
|
||||
} else if ([view conformsToProtocol:@protocol(HippyScrollableProtocol)]) {
|
||||
_scrollableView = (id<HippyScrollableProtocol>)view;
|
||||
[_scrollableView addScrollListener:self];
|
||||
+1
-1
@@ -23,6 +23,6 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "NativeRenderTouchesView.h"
|
||||
|
||||
@interface NativeRenderRefreshWrapperItemView : NativeRenderTouchesView
|
||||
@interface HippyRefreshWrapperItemView : NativeRenderTouchesView
|
||||
|
||||
@end
|
||||
+2
-2
@@ -19,10 +19,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#import "NativeRenderRefreshWrapperItemView.h"
|
||||
#import "HippyRefreshWrapperItemView.h"
|
||||
#import "UIView+Hippy.h"
|
||||
|
||||
@implementation NativeRenderRefreshWrapperItemView
|
||||
@implementation HippyRefreshWrapperItemView
|
||||
|
||||
- (void)setFrame:(CGRect)frame {
|
||||
if ([self.superview isKindOfClass:[UIScrollView class]]) {
|
||||
+2
-1
@@ -24,7 +24,8 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NativeRenderRefreshWrapperViewManager : HippyViewManager
|
||||
@interface HippyRefreshWrapperItemViewManager : HippyViewManager
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+4
-4
@@ -20,14 +20,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderRefreshWrapperItemViewManager.h"
|
||||
#import "NativeRenderRefreshWrapperItemView.h"
|
||||
#import "HippyRefreshWrapperItemViewManager.h"
|
||||
#import "HippyRefreshWrapperItemView.h"
|
||||
|
||||
@implementation NativeRenderRefreshWrapperItemViewManager
|
||||
@implementation HippyRefreshWrapperItemViewManager
|
||||
|
||||
HIPPY_EXPORT_MODULE(RefreshWrapperItemView)
|
||||
|
||||
- (UIView *)view {
|
||||
return [NativeRenderRefreshWrapperItemView new];
|
||||
return [HippyRefreshWrapperItemView new];
|
||||
}
|
||||
@end
|
||||
+1
-2
@@ -24,8 +24,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NativeRenderRefreshWrapperItemViewManager : HippyViewManager
|
||||
|
||||
@interface HippyRefreshWrapperViewManager : HippyViewManager
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
+7
-6
@@ -20,32 +20,33 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderRefreshWrapperViewManager.h"
|
||||
#import "NativeRenderRefreshWrapper.h"
|
||||
#import "HippyRefreshWrapperViewManager.h"
|
||||
#import "HippyRefreshWrapper.h"
|
||||
#import "HippyComponent.h"
|
||||
#import "HippyUIManager.h"
|
||||
|
||||
@implementation NativeRenderRefreshWrapperViewManager
|
||||
@implementation HippyRefreshWrapperViewManager
|
||||
|
||||
HIPPY_EXPORT_MODULE(RefreshWrapper)
|
||||
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(onRefresh, HippyDirectEventBlock)
|
||||
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(bounceTime, CGFloat)
|
||||
|
||||
- (UIView *)view {
|
||||
return [NativeRenderRefreshWrapper new];
|
||||
return [HippyRefreshWrapper new];
|
||||
}
|
||||
|
||||
HIPPY_EXPORT_METHOD(refreshComplected:(NSNumber *__nonnull)componentTag) {
|
||||
[self.bridge.uiManager addUIBlock:^(HippyUIManager *uiManager, NSDictionary<NSNumber *,__kindof UIView *> *viewRegistry) {
|
||||
NativeRenderRefreshWrapper *wrapperView = viewRegistry[componentTag];
|
||||
HippyRefreshWrapper *wrapperView = viewRegistry[componentTag];
|
||||
[wrapperView refreshCompleted];
|
||||
}];
|
||||
}
|
||||
|
||||
HIPPY_EXPORT_METHOD(startRefresh:(NSNumber *__nonnull)componentTag) {
|
||||
[self.bridge.uiManager addUIBlock:^(HippyUIManager *uiManager, NSDictionary<NSNumber *,__kindof UIView *> *viewRegistry) {
|
||||
NativeRenderRefreshWrapper *wrapperView = viewRegistry[componentTag];
|
||||
HippyRefreshWrapper *wrapperView = viewRegistry[componentTag];
|
||||
[wrapperView startRefresh];
|
||||
}];
|
||||
}
|
||||
+2
-2
@@ -22,8 +22,8 @@
|
||||
|
||||
#import "NativeRenderBaseListViewCell.h"
|
||||
#import "NativeRenderBaseListViewDataSource.h"
|
||||
#import "NativeRenderFooterRefresh.h"
|
||||
#import "NativeRenderHeaderRefresh.h"
|
||||
#import "HippyFooterRefresh.h"
|
||||
#import "HippyHeaderRefresh.h"
|
||||
#import "HippyUIManager.h"
|
||||
#import "HippyShadowView.h"
|
||||
#import "NativeRenderSmartViewPagerView.h"
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#import "HippyFont.h"
|
||||
#import "HippyShadowText.h"
|
||||
#import "HippyText.h"
|
||||
#import "NativeRenderTextView.h"
|
||||
#import "HippyTextView.h"
|
||||
#import "NativeRenderUtils.h"
|
||||
|
||||
#include "dom/dom_manager.h"
|
||||
@@ -222,7 +222,7 @@ static void resetFontAttribute(NSTextStorage *textStorage) {
|
||||
*/
|
||||
UIView *parentView = viewRegistry[parentTag];
|
||||
if ([parentView respondsToSelector:@selector(performTextUpdate)]) {
|
||||
[(NativeRenderTextView *)parentView performTextUpdate];
|
||||
[(HippyTextView *)parentView performTextUpdate];
|
||||
}
|
||||
}];
|
||||
return parentProperties;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
|
||||
#import "HippyView.h"
|
||||
|
||||
@interface NativeRenderBaseTextInput : HippyView
|
||||
@interface HippyBaseTextInput : HippyView
|
||||
|
||||
@property (nonatomic, strong) UIFont *font;
|
||||
@property (nonatomic, assign) UIEdgeInsets contentInset;
|
||||
+2
-2
@@ -20,9 +20,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderBaseTextInput.h"
|
||||
#import "HippyBaseTextInput.h"
|
||||
|
||||
@implementation NativeRenderBaseTextInput
|
||||
@implementation HippyBaseTextInput
|
||||
- (void)focus {
|
||||
// base method, should be override
|
||||
}
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
|
||||
#import "HippyShadowView.h"
|
||||
|
||||
@interface NativeRenderObjectTextView : HippyShadowView
|
||||
@interface HippyShadowTextView : HippyShadowView
|
||||
|
||||
@property (nonatomic, copy) NSString *text;
|
||||
@property (nonatomic, copy) NSString *placeholder;
|
||||
+6
-6
@@ -21,25 +21,25 @@
|
||||
*/
|
||||
|
||||
#import "HippyUtils.h"
|
||||
#import "NativeRenderObjectTextView.h"
|
||||
#import "HippyShadowTextView.h"
|
||||
|
||||
#include "dom/dom_manager.h"
|
||||
#include "dom/dom_node.h"
|
||||
#include "dom/layout_node.h"
|
||||
|
||||
@interface NativeRenderObjectTextView ()
|
||||
@interface HippyShadowTextView ()
|
||||
|
||||
@property (nonatomic, strong) NSDictionary *dicAttributes;
|
||||
|
||||
@end
|
||||
|
||||
static hippy::LayoutSize x5MeasureFunc(
|
||||
NativeRenderObjectTextView *weakShadowText,
|
||||
HippyShadowTextView *weakShadowText,
|
||||
float width, hippy::LayoutMeasureMode widthMeasureMode, float height,
|
||||
hippy::LayoutMeasureMode heightMeasureMode, void *layoutContext) {
|
||||
hippy::LayoutSize result;
|
||||
if (weakShadowText) {
|
||||
NativeRenderObjectTextView *strongShadowText = weakShadowText;
|
||||
HippyShadowTextView *strongShadowText = weakShadowText;
|
||||
NSString *text = strongShadowText.text ?: strongShadowText.placeholder;
|
||||
if (nil == strongShadowText.dicAttributes) {
|
||||
if (strongShadowText.font == nil) {
|
||||
@@ -54,7 +54,7 @@ static hippy::LayoutSize x5MeasureFunc(
|
||||
return result;
|
||||
}
|
||||
|
||||
@implementation NativeRenderObjectTextView
|
||||
@implementation HippyShadowTextView
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
@@ -70,7 +70,7 @@ static hippy::LayoutSize x5MeasureFunc(
|
||||
int32_t componentTag = [self.hippyTag intValue];
|
||||
auto node = shared_domNode->GetNode(self.rootNode, componentTag);
|
||||
if (node) {
|
||||
__weak NativeRenderObjectTextView *weakSelf = self;
|
||||
__weak HippyShadowTextView *weakSelf = self;
|
||||
hippy::MeasureFunction measureFunc =
|
||||
[weakSelf](float width, hippy::LayoutMeasureMode widthMeasureMode,
|
||||
float height, hippy::LayoutMeasureMode heightMeasureMode, void *layoutContext){
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "HippyView.h"
|
||||
#import "HippyComponent.h"
|
||||
#import "NativeRenderBaseTextInput.h"
|
||||
#import "HippyBaseTextInput.h"
|
||||
|
||||
@protocol NativeRenderUITextFieldResponseDelegate <NSObject>
|
||||
@required
|
||||
@@ -40,7 +40,7 @@
|
||||
@property (nonatomic, assign) BOOL editable;
|
||||
@end
|
||||
|
||||
@interface NativeRenderTextField : NativeRenderBaseTextInput <UITextFieldDelegate>
|
||||
@interface HippyTextField : HippyBaseTextInput <UITextFieldDelegate>
|
||||
@property (nonatomic, copy) HippyDirectEventBlock onKeyPress;
|
||||
@property (nonatomic, assign) BOOL autoCorrect;
|
||||
//@property (nonatomic, assign) UIEdgeInsets contentInset;
|
||||
+5
-5
@@ -20,11 +20,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderTextField.h"
|
||||
#import "HippyTextField.h"
|
||||
|
||||
#import "HippyConvert.h"
|
||||
#import "HippyUtils.h"
|
||||
#import "NativeRenderTextSelection.h"
|
||||
#import "HippyTextSelection.h"
|
||||
#import "UIView+Hippy.h"
|
||||
|
||||
@implementation NativeRenderUITextField
|
||||
@@ -111,10 +111,10 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface NativeRenderTextField () <NativeRenderUITextFieldResponseDelegate>
|
||||
@interface HippyTextField () <NativeRenderUITextFieldResponseDelegate>
|
||||
@end
|
||||
|
||||
@implementation NativeRenderTextField {
|
||||
@implementation HippyTextField {
|
||||
UITextRange *_previousSelectionRange;
|
||||
NativeRenderUITextField *_textView;
|
||||
}
|
||||
@@ -257,7 +257,7 @@
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath
|
||||
ofObject:(__unused NativeRenderTextField *)textField
|
||||
ofObject:(__unused HippyTextField *)textField
|
||||
change:(__unused NSDictionary *)change
|
||||
context:(__unused void *)context {
|
||||
if ([keyPath isEqualToString:@"selectedTextRange"]) {
|
||||
+3
-3
@@ -25,7 +25,7 @@
|
||||
/**
|
||||
* Object containing information about a TextInput's selection.
|
||||
*/
|
||||
@interface NativeRenderTextSelection : NSObject
|
||||
@interface HippyTextSelection : NSObject
|
||||
|
||||
@property (nonatomic, assign, readonly) NSInteger start;
|
||||
@property (nonatomic, assign, readonly) NSInteger end;
|
||||
@@ -34,8 +34,8 @@
|
||||
|
||||
@end
|
||||
|
||||
@interface HippyConvert (NativeRenderTextSelection)
|
||||
@interface HippyConvert (HippyTextSelection)
|
||||
|
||||
+ (NativeRenderTextSelection *)NativeRenderTextSelection:(id)json;
|
||||
+ (HippyTextSelection *)HippyTextSelection:(id)json;
|
||||
|
||||
@end
|
||||
+5
-5
@@ -20,9 +20,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderTextSelection.h"
|
||||
#import "HippyTextSelection.h"
|
||||
|
||||
@implementation NativeRenderTextSelection
|
||||
@implementation HippyTextSelection
|
||||
|
||||
- (instancetype)initWithStart:(NSInteger)start end:(NSInteger)end {
|
||||
if (self = [super init]) {
|
||||
@@ -34,13 +34,13 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation HippyConvert (NativeRenderTextSelection)
|
||||
@implementation HippyConvert (HippyTextSelection)
|
||||
|
||||
+ (NativeRenderTextSelection *)NativeRenderTextSelection:(id)json {
|
||||
+ (HippyTextSelection *)HippyTextSelection:(id)json {
|
||||
if ([json isKindOfClass:[NSDictionary class]]) {
|
||||
NSInteger start = [self NSInteger:json[@"start"]];
|
||||
NSInteger end = [self NSInteger:json[@"end"]];
|
||||
return [[NativeRenderTextSelection alloc] initWithStart:start end:end];
|
||||
return [[HippyTextSelection alloc] initWithStart:start end:end];
|
||||
}
|
||||
|
||||
return nil;
|
||||
+2
-2
@@ -23,7 +23,7 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "HippyView.h"
|
||||
#import "NativeRenderBaseTextInput.h"
|
||||
#import "HippyBaseTextInput.h"
|
||||
#import "UIView+Hippy.h"
|
||||
|
||||
@protocol NativeRenderUITextViewResponseDelegate <NSObject>
|
||||
@@ -37,7 +37,7 @@
|
||||
@property (nonatomic, weak) id<NativeRenderUITextViewResponseDelegate> responderDelegate;
|
||||
@end
|
||||
|
||||
@interface NativeRenderTextView : NativeRenderBaseTextInput <UITextViewDelegate> {
|
||||
@interface HippyTextView : HippyBaseTextInput <UITextViewDelegate> {
|
||||
@protected
|
||||
NativeRenderUITextView *_textView;
|
||||
}
|
||||
+6
-6
@@ -20,13 +20,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderTextView.h"
|
||||
#import "HippyTextView.h"
|
||||
|
||||
#import "HippyConvert.h"
|
||||
#import "HippyShadowText.h"
|
||||
#import "HippyText.h"
|
||||
#import "HippyUtils.h"
|
||||
#import "NativeRenderTextSelection.h"
|
||||
#import "HippyTextSelection.h"
|
||||
#import "UIView+Hippy.h"
|
||||
|
||||
@implementation NativeRenderUITextView
|
||||
@@ -72,10 +72,10 @@
|
||||
}
|
||||
@end
|
||||
|
||||
@interface NativeRenderTextView () <NativeRenderUITextViewResponseDelegate>
|
||||
@interface HippyTextView () <NativeRenderUITextViewResponseDelegate>
|
||||
@end
|
||||
|
||||
@implementation NativeRenderTextView {
|
||||
@implementation HippyTextView {
|
||||
NSString *_placeholder;
|
||||
UITextView *_placeholderView;
|
||||
HippyText *_richTextView;
|
||||
@@ -249,7 +249,7 @@ static NSAttributedString *removeComponentTagFromString(NSAttributedString *stri
|
||||
|
||||
- (void)updateFrames {
|
||||
// Adjust the insets so that they are as close as possible to single-line
|
||||
// NativeRenderTextField defaults, using the system defaults of font size 17 and a
|
||||
// HippyTextField defaults, using the system defaults of font size 17 and a
|
||||
// height of 31 points.
|
||||
//
|
||||
// We apply the left inset to the frame since a negative left text-container
|
||||
@@ -385,7 +385,7 @@ static NSAttributedString *removeComponentTagFromString(NSAttributedString *stri
|
||||
return _textView.text;
|
||||
}
|
||||
|
||||
- (void)setSelection:(NativeRenderTextSelection *)selection {
|
||||
- (void)setSelection:(HippyTextSelection *)selection {
|
||||
if (!selection) {
|
||||
return;
|
||||
}
|
||||
+1
-1
@@ -22,6 +22,6 @@
|
||||
|
||||
#import "HippyViewManager.h"
|
||||
|
||||
@interface NativeRenderHeaderRefreshManager : HippyViewManager
|
||||
@interface HippyTextViewManager : HippyViewManager
|
||||
|
||||
@end
|
||||
+39
-39
@@ -20,18 +20,18 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderBaseTextInput.h"
|
||||
#import "HippyBaseTextInput.h"
|
||||
#import "HippyFont.h"
|
||||
#import "HippyUIManager.h"
|
||||
#import "NativeRenderObjectTextView.h"
|
||||
#import "HippyShadowTextView.h"
|
||||
#import "HippyShadowView.h"
|
||||
#import "NativeRenderTextField.h"
|
||||
#import "NativeRenderTextView.h"
|
||||
#import "NativeRenderTextViewManager.h"
|
||||
#import "HippyTextField.h"
|
||||
#import "HippyTextView.h"
|
||||
#import "HippyTextViewManager.h"
|
||||
#import "HippyBridgeModule.h"
|
||||
#import "NativeRenderTextSelection.h"
|
||||
#import "HippyTextSelection.h"
|
||||
|
||||
@implementation NativeRenderTextViewManager
|
||||
@implementation HippyTextViewManager
|
||||
|
||||
HIPPY_EXPORT_MODULE(TextInput)
|
||||
|
||||
@@ -41,11 +41,11 @@ HIPPY_EXPORT_MODULE(TextInput)
|
||||
if ([keyboardType isKindOfClass:[NSString class]] && [keyboardType isEqual:@"password"]) {
|
||||
multiline = @(NO);
|
||||
}
|
||||
NativeRenderBaseTextInput *theView;
|
||||
HippyBaseTextInput *theView;
|
||||
if (multiline != nil && !multiline.boolValue) {
|
||||
theView = [[NativeRenderTextField alloc] init];
|
||||
theView = [[HippyTextField alloc] init];
|
||||
} else {
|
||||
theView = [[NativeRenderTextView alloc] init];
|
||||
theView = [[HippyTextView alloc] init];
|
||||
}
|
||||
if (self.props[@"onKeyboardWillShow"]) {
|
||||
[[NSNotificationCenter defaultCenter] addObserver:theView
|
||||
@@ -63,7 +63,7 @@ HIPPY_EXPORT_MODULE(TextInput)
|
||||
}
|
||||
|
||||
- (HippyShadowView *)hippyShadowView {
|
||||
return [NativeRenderObjectTextView new];
|
||||
return [HippyShadowTextView new];
|
||||
}
|
||||
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(value, NSString)
|
||||
@@ -77,10 +77,10 @@ HIPPY_EXPORT_VIEW_PROPERTY(isNightMode, BOOL)
|
||||
|
||||
HIPPY_EXPORT_METHOD(focusTextInput:(nonnull NSNumber *)componentTag) {
|
||||
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
|
||||
NativeRenderBaseTextInput *view = (NativeRenderBaseTextInput *)viewRegistry[componentTag];
|
||||
HippyBaseTextInput *view = (HippyBaseTextInput *)viewRegistry[componentTag];
|
||||
if (view == nil) return ;
|
||||
if (![view isKindOfClass:[NativeRenderBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting NativeRenderBaseTextInput, got: %@", view);
|
||||
if (![view isKindOfClass:[HippyBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting HippyBaseTextInput, got: %@", view);
|
||||
}
|
||||
[view focus];
|
||||
}];
|
||||
@@ -88,10 +88,10 @@ HIPPY_EXPORT_METHOD(focusTextInput:(nonnull NSNumber *)componentTag) {
|
||||
|
||||
HIPPY_EXPORT_METHOD(isFocused:(nonnull NSNumber *)componentTag callback:(HippyPromiseResolveBlock)callback) {
|
||||
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
||||
NativeRenderBaseTextInput *view = (NativeRenderBaseTextInput *)viewRegistry[componentTag];
|
||||
HippyBaseTextInput *view = (HippyBaseTextInput *)viewRegistry[componentTag];
|
||||
if (view == nil) return ;
|
||||
if (![view isKindOfClass:[NativeRenderBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting NativeRenderBaseTextInput, got: %@", view);
|
||||
if (![view isKindOfClass:[HippyBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting HippyBaseTextInput, got: %@", view);
|
||||
}
|
||||
BOOL isFocused = [view isFirstResponder];
|
||||
callback([NSDictionary dictionaryWithObject:[NSNumber numberWithBool:isFocused] forKey:@"value"]);
|
||||
@@ -100,10 +100,10 @@ HIPPY_EXPORT_METHOD(isFocused:(nonnull NSNumber *)componentTag callback:(HippyPr
|
||||
|
||||
HIPPY_EXPORT_METHOD(blurTextInput:(nonnull NSNumber *)componentTag) {
|
||||
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry){
|
||||
NativeRenderBaseTextInput *view = (NativeRenderBaseTextInput *)viewRegistry[componentTag];
|
||||
HippyBaseTextInput *view = (HippyBaseTextInput *)viewRegistry[componentTag];
|
||||
if (view == nil) return ;
|
||||
if (![view isKindOfClass:[NativeRenderBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting NativeRenderBaseTextInput, got: %@", view);
|
||||
if (![view isKindOfClass:[HippyBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting HippyBaseTextInput, got: %@", view);
|
||||
}
|
||||
[view blur];
|
||||
}];
|
||||
@@ -111,31 +111,31 @@ HIPPY_EXPORT_METHOD(blurTextInput:(nonnull NSNumber *)componentTag) {
|
||||
|
||||
HIPPY_EXPORT_METHOD(clear:(nonnull NSNumber *)componentTag) {
|
||||
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
||||
NativeRenderBaseTextInput *view = (NativeRenderBaseTextInput *)viewRegistry[componentTag];
|
||||
HippyBaseTextInput *view = (HippyBaseTextInput *)viewRegistry[componentTag];
|
||||
if (view == nil) return ;
|
||||
if (![view isKindOfClass:[NativeRenderBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting NativeRenderBaseTextInput, got: %@", view);
|
||||
if (![view isKindOfClass:[HippyBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting HippyBaseTextInput, got: %@", view);
|
||||
}
|
||||
[view clearText];
|
||||
}];
|
||||
}
|
||||
|
||||
HIPPY_EXPORT_METHOD(setValue:(nonnull NSNumber *)componentTag
|
||||
text:(NSString *)text ) {
|
||||
text:(NSString *)text ) {
|
||||
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
||||
NativeRenderBaseTextInput *view = (NativeRenderBaseTextInput *)viewRegistry[componentTag];
|
||||
HippyBaseTextInput *view = (HippyBaseTextInput *)viewRegistry[componentTag];
|
||||
if (view == nil) return ;
|
||||
if (![view isKindOfClass:[NativeRenderBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting NativeRenderBaseTextInput, got: %@", view);
|
||||
if (![view isKindOfClass:[HippyBaseTextInput class]]) {
|
||||
HippyLogError(@"Invalid view returned from registry, expecting HippyBaseTextInput, got: %@", view);
|
||||
}
|
||||
[view setValue: text];
|
||||
}];
|
||||
}
|
||||
|
||||
HIPPY_EXPORT_METHOD(getValue:(nonnull NSNumber *)componentTag
|
||||
callback:(HippyPromiseResolveBlock)callback ) {
|
||||
callback:(HippyPromiseResolveBlock)callback ) {
|
||||
[self.bridge.uiManager addUIBlock:^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *,UIView *> *viewRegistry) {
|
||||
NativeRenderBaseTextInput *view = (NativeRenderBaseTextInput *)viewRegistry[componentTag];
|
||||
HippyBaseTextInput *view = (HippyBaseTextInput *)viewRegistry[componentTag];
|
||||
NSString *stringValue = [view value];
|
||||
if (nil == stringValue) {
|
||||
stringValue = @"";
|
||||
@@ -168,46 +168,46 @@ HIPPY_REMAP_VIEW_PROPERTY(returnKeyType, textView.returnKeyType, UIReturnKeyType
|
||||
HIPPY_REMAP_VIEW_PROPERTY(secureTextEntry, textView.secureTextEntry, BOOL)
|
||||
HIPPY_REMAP_VIEW_PROPERTY(selectionColor, tintColor, UIColor)
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(selectTextOnFocus, BOOL)
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(selection, NativeRenderTextSelection)
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(selection, HippyTextSelection)
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(text, NSString)
|
||||
HIPPY_REMAP_VIEW_PROPERTY(caretColor, textView.caretColor, UIColor)
|
||||
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontSize, NSNumber, NativeRenderObjectTextView) {
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontSize, NSNumber, HippyShadowTextView) {
|
||||
view.font = [HippyFont updateFont:view.font withSize:json];
|
||||
}
|
||||
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontWeight, NSString, NativeRenderObjectTextView) {
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontWeight, NSString, HippyShadowTextView) {
|
||||
view.font = [HippyFont updateFont:view.font withWeight:json];
|
||||
}
|
||||
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontStyle, NSString, NativeRenderObjectTextView) {
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontStyle, NSString, HippyShadowTextView) {
|
||||
view.font = [HippyFont updateFont:view.font withStyle:json]; // defaults to normal
|
||||
}
|
||||
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontFamily, NSString, NativeRenderObjectTextView) {
|
||||
HIPPY_CUSTOM_SHADOW_PROPERTY(fontFamily, NSString, HippyShadowTextView) {
|
||||
view.font = [HippyFont updateFont:view.font withFamily:json];
|
||||
}
|
||||
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontSize, NSNumber, NativeRenderBaseTextInput) {
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontSize, NSNumber, HippyBaseTextInput) {
|
||||
UIFont *theFont = [HippyFont updateFont:view.font withSize:json ?: @(defaultView.font.pointSize)];
|
||||
view.font = theFont;
|
||||
}
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontWeight, NSString, __unused NativeRenderBaseTextInput) {
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontWeight, NSString, __unused HippyBaseTextInput) {
|
||||
UIFont *theFont = [HippyFont updateFont:view.font withWeight:json]; // defaults to normal
|
||||
view.font = theFont;
|
||||
}
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontStyle, NSString, __unused NativeRenderBaseTextInput) {
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontStyle, NSString, __unused HippyBaseTextInput) {
|
||||
UIFont *theFont = [HippyFont updateFont:view.font withStyle:json];
|
||||
view.font = theFont; // defaults to normal
|
||||
}
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontFamily, NSString, NativeRenderBaseTextInput) {
|
||||
HIPPY_CUSTOM_VIEW_PROPERTY(fontFamily, NSString, HippyBaseTextInput) {
|
||||
view.font = [HippyFont updateFont:view.font withFamily:json ?: defaultView.font.familyName];
|
||||
}
|
||||
|
||||
- (HippyViewManagerUIBlock)uiBlockToAmendWithShadowView:(HippyShadowView *)hippyShadowView {
|
||||
NSNumber *componentTag = hippyShadowView.hippyTag;
|
||||
UIEdgeInsets padding = hippyShadowView.paddingAsInsets;
|
||||
return ^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, NativeRenderBaseTextInput *> *viewRegistry) {
|
||||
return ^(__unused HippyUIManager *uiManager, NSDictionary<NSNumber *, HippyBaseTextInput *> *viewRegistry) {
|
||||
viewRegistry[componentTag].contentInset = padding;
|
||||
};
|
||||
}
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class NativeRenderWaterfallViewDataSource, NativeRenderHeaderRefresh, NativeRenderFooterRefresh, WaterfallItemChangeContext, HippyShadowView;
|
||||
@class NativeRenderWaterfallViewDataSource, HippyHeaderRefresh, HippyFooterRefresh, WaterfallItemChangeContext, HippyShadowView;
|
||||
|
||||
typedef NS_ENUM(NSInteger, NativeRenderScrollState) {
|
||||
ScrollStateStop,
|
||||
@@ -50,8 +50,8 @@ typedef NS_ENUM(NSInteger, NativeRenderScrollState) {
|
||||
|
||||
NSMapTable<NSNumber *, UIView *> *_cachedWeakCellViews;
|
||||
|
||||
NativeRenderHeaderRefresh *_headerRefreshView;
|
||||
NativeRenderFooterRefresh *_footerRefreshView;
|
||||
HippyHeaderRefresh *_headerRefreshView;
|
||||
HippyFooterRefresh *_footerRefreshView;
|
||||
|
||||
BOOL _allowNextScrollNoMatterWhat;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
|
||||
#import "NativeRenderWaterfallView.h"
|
||||
#import "NativeRenderHeaderRefresh.h"
|
||||
#import "NativeRenderFooterRefresh.h"
|
||||
#import "HippyHeaderRefresh.h"
|
||||
#import "HippyFooterRefresh.h"
|
||||
#import "NativeRenderWaterfallItemView.h"
|
||||
#import "UIView+Hippy.h"
|
||||
#import "HippyRefresh.h"
|
||||
@@ -224,19 +224,19 @@ static const NSTimeInterval delayForPurgeView = 1.f;
|
||||
}
|
||||
|
||||
- (void)insertHippySubview:(UIView *)subview atIndex:(NSInteger)atIndex {
|
||||
if ([subview isKindOfClass:[NativeRenderHeaderRefresh class]]) {
|
||||
if ([subview isKindOfClass:[HippyHeaderRefresh class]]) {
|
||||
if (_headerRefreshView) {
|
||||
[_headerRefreshView removeFromSuperview];
|
||||
}
|
||||
_headerRefreshView = (NativeRenderHeaderRefresh *)subview;
|
||||
_headerRefreshView = (HippyHeaderRefresh *)subview;
|
||||
[_headerRefreshView setScrollView:self.collectionView];
|
||||
_headerRefreshView.delegate = self;
|
||||
_headerRefreshView.frame = subview.hippyShadowView.frame;
|
||||
} else if ([subview isKindOfClass:[NativeRenderFooterRefresh class]]) {
|
||||
} else if ([subview isKindOfClass:[HippyFooterRefresh class]]) {
|
||||
if (_footerRefreshView) {
|
||||
[_footerRefreshView removeFromSuperview];
|
||||
}
|
||||
_footerRefreshView = (NativeRenderFooterRefresh *)subview;
|
||||
_footerRefreshView = (HippyFooterRefresh *)subview;
|
||||
[_footerRefreshView setScrollView:self.collectionView];
|
||||
_footerRefreshView.delegate = self;
|
||||
_footerRefreshView.frame = subview.hippyShadowView.frame;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NativeRenderSimpleWebView : WKWebView <WKUIDelegate, WKNavigationDelegate>
|
||||
@interface HippySimpleWebView : WKWebView <WKUIDelegate, WKNavigationDelegate>
|
||||
@property (nonatomic, strong) NSString *userAgent;
|
||||
@property (nonatomic, strong) NSString *url;
|
||||
@property (nonatomic, strong) NSDictionary *source;
|
||||
+2
-2
@@ -20,10 +20,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderSimpleWebView.h"
|
||||
#import "HippySimpleWebView.h"
|
||||
#import "HippyUtils.h"
|
||||
|
||||
@implementation NativeRenderSimpleWebView
|
||||
@implementation HippySimpleWebView
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
+2
-2
@@ -21,11 +21,11 @@
|
||||
*/
|
||||
|
||||
#import "HippyViewManager.h"
|
||||
#import "NativeRenderSimpleWebView.h"
|
||||
#import "HippySimpleWebView.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NativeRenderSimpleWebViewManager : HippyViewManager
|
||||
@interface HippySimpleWebViewManager : HippyViewManager
|
||||
|
||||
@end
|
||||
|
||||
+3
-3
@@ -20,9 +20,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "NativeRenderSimpleWebViewManager.h"
|
||||
#import "HippySimpleWebViewManager.h"
|
||||
|
||||
@implementation NativeRenderSimpleWebViewManager
|
||||
@implementation HippySimpleWebViewManager
|
||||
|
||||
HIPPY_EXPORT_MODULE(WebView)
|
||||
|
||||
@@ -33,7 +33,7 @@ HIPPY_EXPORT_VIEW_PROPERTY(onLoadEnd, HippyDirectEventBlock)
|
||||
HIPPY_EXPORT_VIEW_PROPERTY(onLoad, HippyDirectEventBlock)
|
||||
|
||||
- (UIView *)view {
|
||||
return [NativeRenderSimpleWebView new];
|
||||
return [HippySimpleWebView new];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user