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:
what shown in simulator:
- you should not cache output of -view method, return new view new dependencies, instance view controller.
- you should use constraints layout view, since reactnative through mounting process send methods change frame of view. without constraints layout may broken.
- 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
Post a Comment