Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use scaleX, scaleY on <View> #1157

Closed
amitverma opened this issue May 5, 2015 · 5 comments
Closed

Unable to use scaleX, scaleY on <View> #1157

amitverma opened this issue May 5, 2015 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@amitverma
Copy link

I have been trying to use scaleX and scaleY on a <View/> component, but it is not working. Do I need to keep something in mind while using it?

@brentvatne
Copy link
Collaborator

@amitverma - the documentation seems to be a bit unclear about this, this is how you need to specify it:

<View style={{flex: 1, transform: [{translateY: 50}, {scaleX: 0.5}, {scaleY: 0.5}]}}>
   <Text>Text here!</Text>
</View>

@brentvatne
Copy link
Collaborator

Updated docs to remove this, working on fixing it up to better display those options under the transform prop.

@vjeux also informed me of something interesting: the reason that these are in an array in separate objects inside of the transform property is because order matters here - translate followed by scale is different than scale followed by translate.

@amitverma
Copy link
Author

thanks @brentvatne for clearing things up. would switching order between scaleX and scaleY also produce different results?

@brentvatne
Copy link
Collaborator

@amitverma - nope, those should be the same as they scale the X and Y axis independently and irrespective of aspect ratio. Another interesting thing to know is you can apply transforms multiple times:

transform: [{scaleX: 0.5}, {scaleY: 1.5}, {scaleX: 1.5}] 😄

@brentvatne
Copy link
Collaborator

See #1181 for doc fix

@facebook facebook locked as resolved and limited conversation to collaborators May 29, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants