React Native custom iOS view that responds to height/width style
<p>I'm trying to get my custom UIView to respond to width and height styles, e.g.</p>

<pre><code>&lt;MyCustomView style={{width: 200, height: 300}}/&gt;
</code></pre>

<p>I've closely followed the simple example at <a href="https://github.com/brentvatne/react-native-dashed-border-example" rel="nofollow">https://github.com/brentvatne/react-native-dashed-border-example</a></p>

<p>Currently my View and ViewManager look like:</p>

<pre><code>#import "MyCustomView.h"
#import "RCTViewManager.h"

@implementation MyCustomView

- (instancetype)initWithFrame:(CGRect)frame
{
  self = [super initWithFrame:frame];
  if (self) {
      // Create the component view
  }
  return self;
}

@end
</code></pre>

<p>and the ViewManager:</p>

<pre><code>@implementation MyCustomViewManager

RCT_EXPORT_MODULE();

- (UIView *)view
{
  return [[MyCustomView alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
}

@end
</code></pre>

<p>However this of course always fills the screen. I want to be able to set the height on this component, and ideally using the RN method of passing it via <code>style</code>.</p>

<p>If I follow the simple border example, I end up with</p>

<pre><code>@implementation MyCustomView

- (instancetype)init
{
  self = [super init];
  if (self) {
      // Create the component view
  }
  return self;
}

@end
</code></pre>

<p>and</p>

<pre><code>@implementation MyCustomViewManager

RCT_EXPORT_MODULE();

- (UIView *)view
{
  return [[MyCustomView alloc] init];
}

@end
</code></pre>

<p>But the view does not show, and reports <code>self.bounds.size.height</code> to be 0.00.</p>

<p>Is there something I've missed to get this working? Do I need to employ RCTBridge? I did previously have the line </p>

<pre><code>@synthesize bridge = _bridge;
</code></pre>

<p>as in <a href="https://github.com/brentvatne/react-native-dashed-border-example/blob/master/BVDashedBorderViewManager.m#L9" rel="nofollow">https://github.com/brentvatne/react-native-dashed-border-example/blob/master/BVDashedBorderViewManager.m#L9</a> but I got an error saying "Bridge not set"</p>