diff --git a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm index ee20118124..4d3f4c9110 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm +++ b/ios/sdk/WeexSDK/Sources/Component/WXScrollerComponent.mm @@ -226,7 +226,11 @@ -(instancetype)initWithRef:(NSString *)ref type:(NSString *)type styles:(NSDicti //may be list if ([@"scroller" isEqualToString:type]) { [weexInstance.apmInstance updateDiffStats:KEY_PAGE_STATS_SCROLLER_NUM withDiffValue:1]; - } + } + + if (weexInstance.instanceCallback) { + weexInstance.instanceCallback(weexInstance, WXScrollerComponentCreatedCallback, self); + } } return self; diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h index c28a2d6f21..dcd4ea5b82 100644 --- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h +++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.h @@ -151,6 +151,10 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code FrameworkVersionErrorCode, }; +typedef enum : NSUInteger { + WXScrollerComponentCreatedCallback +} WXSDKInstanceCallbackType; + @property (nonatomic, assign) WXState state; @@ -225,6 +229,15 @@ typedef NS_ENUM(NSInteger, WXErrorCode) {//error.code **/ @property (nonatomic, copy) void (^onScroll)(CGPoint contentOffset); +/** + * The callback of the instance + * + * When the callbackType is WXScrollerComponentCreatedCallback, the result type is WXScrollerComponent. + * + * @return A block that takes instance, callbackType and a result. + **/ +@property (nonatomic, copy) void (^instanceCallback)(WXSDKInstance* instance, WXSDKInstanceCallbackType callbackType, id result); + /** * the callback to be run repeatedly while the instance is rendering. *