Skip to content

Commit

Permalink
Fix Transform flip example on new renderer (facebook#39259)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#39259

This matches the [behaviour we had in the old renderer](https://github.com/facebook/react-native/blob/main/packages/react-native/React/Views/UIView%2BReact.m#L145) where zIndex is mapped to the CALayer's zPosition. This is required to prevent clipping of views in rotation transforms as currently used in the TransformExample.

Changelog: [iOS][Fixed] Rotation transforms are no longer clipped when zIndex is applied

Reviewed By: christophpurrer

Differential Revision: D48905010

fbshipit-source-id: 56dea38da94ae32a88bbce3f29c3cce9ddbbf010
  • Loading branch information
javache authored and facebook-github-bot committed Sep 6, 2023
1 parent 99a306d commit 850349b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &
self.accessibilityIdentifier = RCTNSStringFromString(newViewProps.testId);
}

// `zIndex`
if (oldViewProps.zIndex != newViewProps.zIndex) {
self.layer.zPosition = newViewProps.zIndex.value_or(0);
}

_needsInvalidateLayer = _needsInvalidateLayer || needsInvalidateLayer;

_props = std::static_pointer_cast<const ViewProps>(props);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ const styles = StyleSheet.create({
justifyContent: 'center',
backgroundColor: 'blue',
backfaceVisibility: 'hidden',
zIndex: 1024,
},
flipCard1: {
position: 'absolute',
Expand Down

0 comments on commit 850349b

Please sign in to comment.