react-native-navigation ios - push UIViewController to navigation stack -


i building navigation stack consisting of both native ios views , react-native screens. when push native ios view, view layout not coming out designed in storyboard. using autolayout in xcode native views.

icnativeviewmanager.h --------------------- #import <react/rctviewmanager.h>  @interface icnativeviewmanager : rctviewmanager  @end  icnativeviewmanager.m --------------------- #import <react/rctviewmanager.h> #import <react/rctview.h>  #import "icnativeviewmanager.h"  @implementation icnativeviewmanager  uiviewcontroller *vc;  rct_export_module()  -(uiview *)view {   if (vc == nil)   {     uistoryboard *storyboard = [uistoryboard storyboardwithname:@"icnativeui" bundle:nil];     vc = [storyboard instantiateinitialviewcontroller];   }   return vc.view; }  rct_export_view_property(labeltext, nsstring)  @end 

design in xcode:

view design in storyboard

what shown in simulator:

view shown in simulator

  1. you should not cache output of -view method, return new view new dependencies, instance view controller.
  2. you should use constraints layout view, since reactnative through mounting process send methods change frame of view. without constraints layout may broken.
  3. for calculate frame of view react native use yogalayout (old csslayout), make sure calculate right size of view. if not implement -shadowview method of viewmanager , return rctshadowview instance right value of width , height property.

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -