ptmt/react-native-macos

UIExplorer: transforms not working with position

smallnewer opened this issue · 5 comments

Is this a bug report?

yes

Have you read the Contributing Guidelines?

yes

Environment

OS: macOS Sierra 10.13.6 (I only have this version)
UIExplorer: downloaded in v0.5.0 tag and here

and i can reproduce this question with :
react-native-macos-cli: 2.0.1
react-native-macos: 0.19.2

Steps to Reproduce

gif

Some Prerequisites

  1. position:absolute with right
  2. any transform
  3. resize the window

This will be fixed when #234 is merged.

Thanks^_^
It's also not working with #234 . Maybe I did something wrong?

My steps

  1. download code from https://github.com/ptmt/react-native-macos/tree/fa28701469188d2b757af84934e13014dacbed9d, which is last commit in #234
  2. delete node_modules/react-native-macos/React in my demo project,and copy React(downloaded) to my demo project
  3. build and run ,transform also not working after resize the window。

I'm sure it's #234 code.

key codes:

    render() {
        return (
            <TouchableOpacity 
                style={{position:"absolute", right:100,width:200,height:200,transform:[{translateY:101}],backgroundColor:"red"}}>     
            </TouchableOpacity>
        )
    }

After I delete some code at RCTView.m,It working right:

//  if (!CGSizeEqualToSize(self.bounds.size, oldSize)) {
    [self.layer setNeedsDisplay];
//  }

I don't know if it's appropriate to make such a change.

Nice find!

When the frame is updated (eg: by resizing the window), the transform needs to be reapplied.

I've added a new commit to #234, which you should try and let me know if it works. 572a274

If it doesn't work, we can call [self.layer setNeedsDisplay] when _transform is not an identity transform.

It works right . Thanks @aleclarson ! 👍