Skip to content

UIExplorer: transforms not working with position #232

Description

@smallnewer

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

Activity

  1. aleclarson commented on Mar 18, 2019

    @aleclarson
    Collaborator

    This will be fixed when #234 is merged.

  2. smallnewer commented on Mar 19, 2019

    @smallnewer
    Author

    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 Various fixes to RCTView props #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>
            )
        }
  3. smallnewer commented on Mar 19, 2019

    @smallnewer
    Author

    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.

  4. aleclarson commented on Mar 19, 2019

    @aleclarson
    Collaborator

    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.

  5. smallnewer commented on Mar 20, 2019

    @smallnewer
    Author

    It works right . Thanks @aleclarson ! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions