title: Exposing Fragment in React Native Android ViewManager
body: <p>I am attempting to wrap the YouTube Android API as a UI Component for React Native. I have been successful in the Android configuration of things (getting onInitializationSuccess), however I am unable to figure out how get the YouTubePlayerView back to my React Native app.</p>
  
  <p>According to the docs, they recommend using YouTubePlayerFragment if you can not extend YouTubeBaseActivity. Since React Native on Android does not use XML based layouts I attempted to create the views programmatically. However, when I return the wrapping View ( I tried as a FrameLayout, but not sure if that was the right choice) I created it does not render anything on the application.</p>
  
  <p>I am looking to keep it extremely simple for now, here are the necessary bits of code:</p>
  
  <p><strong>YouTubeManager.java</strong></p>
  
  <pre><code>public class YouTubeManager extends SimpleViewManager&lt;FrameLayout&gt;  implements YouTubePlayer.OnInitializedListener {
  // ...
  @Override
      protected FrameLayout createViewInstance(ThemedReactContext reactContext) {
          this.reactContext = reactContext;
  
          FrameLayout view = new FrameLayout(reactContext);
          view.setId(View.generateViewId());
  
  
          FragmentManager fragmentManager = activity.getFragmentManager();
          FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
  
          YouTubePlayerFragment fragment = new YouTubePlayerFragment();
          fragmentTransaction.add(view.getId(), fragment);
  
          fragmentTransaction.commit();
  
          fragment.initialize("SECRET_KEY", this);
  
          return view;
      }
  // ... 
  }
  </code></pre>
  
  <p><strong>YouTube.js</strong></p>
  
  <pre><code>class YouTube extends Component {
      render () {
          return &lt;YouTubeAndroid {...this.props}/&gt;;
      }
  };
  
  var iface = {
      name : 'YouTube',
      propTypes : {
          ...View.propTypes
      },
  };
  
  
  var YouTubeAndroid = requireNativeComponent('YouTube', iface);
  
  module.exports = YouTube;
  </code></pre>
  
  <p><strong>index.android.js</strong></p>
  
  <pre><code>var YouTube = require('./YouTube');
  
  class YouTubePlayer extends Component {
    render() {
      return (
        &lt;View style={styles.container}&gt;
          &lt;Text&gt;hello&lt;/Text&gt;
          &lt;YouTube /&gt;
        &lt;/View&gt;
      );
    }
  }
  </code></pre>
  
  <p>Any help would be really appreciated, thank you!</p>