#import "ToponNativeAdView.h"
#import <React/UIView+React.h>

@implementation ToponNativeAdView {
  UIView *_contentView;
}

- (instancetype)initWithFrame:(CGRect)frame {
  self = [super initWithFrame:frame];
  if (self != nil) {
    _contentView = [[UIView alloc] initWithFrame:self.bounds];
    _contentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    [super addSubview:_contentView];
  }
  return self;
}

- (UIView *)contentView {
  return _contentView;
}

- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index {
  [_contentView insertSubview:subview atIndex:index];
}

- (void)removeReactSubview:(UIView *)subview {
  [subview removeFromSuperview];
}

- (NSArray<UIView *> *)reactSubviews {
  return _contentView.subviews;
}

@end
