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: bbee2c9b7319e41a9fcde47d53fc3baeadde91ef
  • Loading branch information
javache authored and facebook-github-bot committed Sep 5, 2023
1 parent 4bc089a commit 0674f85
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 0674f85

Please sign in to comment.