Skip to content
  • Eloy Durán's avatar
    Add suggested ‘view size’ powers to -[RCTShadowView setFrame:] · 6bae7f93
    Eloy Durán authored
    Summary:The UICollectionView example is actually my use-case, which is discussed in a
    bit more detail [here](https://github.com/alloy/ReactNativeExperiments/issues/2).
    
    ----
    
    This is useful when wrapping native iOS components that determine their
    own suggested size and which would be too hard/unnecessary to replicate
    in the shadow view. For instance a `UICollectionView` that after layout
    will update its `contentSize`, which could be used to suggest a size to
    the shadow view.
    
    The reason for adding it to -[RCTShadowView setFrame:] is mainly so it
    can be used via the existing -[RCTUIManager setFrame:forView:] API and
    because it might not be a feature you want to expose too prominently.
    
    An origin of `{ NAN, NAN }` is used as a sentinel to indicate that the
    frame should be used as a size suggestion. The size portion of the rect
    may contain a `NAN` to skip that dimension or a suggested value for the
    dimension which will be used if no explicit styling has been assigned.
    
    Examples:
    
    * Without any expl
    Closes https://github.com/facebook/react-native/pull/6114
    
    Differential Revision: D2994796
    
    Pulled By: nicklockwood
    
    fb-gh-sync-id: 6dd3dd86a352ca7d31a0da38bc38a2859ed0a410
    shipit-source-id: 6dd3dd86a352ca7d31a0da38bc38a2859ed0a410
    6bae7f93