3f49e74 added support for percentages in some style properties, and its awesome.
we should also have support for transform translates.
I want to absolutely position a view and center it vertically.
I can now do top: '50%', but thats not centered. To make it centered I would also need transform: [{translateY: '50%'}].
Add support for percentages for translates
We're cutting down on the number of outstanding issues, in order to allow us to focus. I'm closing this issue because it has been open for over 60 days with no activity. If you think it should still be opened let us know why. PRs are always welcome.
i think it is important, since we have percentages for the top-level styles, to also have it for transforms.
It seems like this is more of an enhancement request, which we track using Canny.io.
+1 for this
100% need this!
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1 please update on this issue
+1 this is a huge deal when attempting fluid layouts for Android devices in particular.
+1
+1
Example Workaround with RN onLayout event:
class Foo extends Component {
...
onLayout = event => {
const { width } = event.nativeEvent.layout;
this.setState({ myWidth: width });
};
...
render() {
const { myWidth } = this.state;
return(
<View
onLayout={this.onLayout}
style={{transform: [{translateY: myWidth / 2 }]}}>
...
<View/>
)
}
}
+1
+1
+1
+1
Most helpful comment
i think it is important, since we have percentages for the top-level styles, to also have it for transforms.