Open alexzel opened 3 months ago
The actual reason of flickering b/c translateX has some default value based on label width === 0 before the first rendering of the label element. Then it gets the correct width from onLayout
event, and renders the correct position with new translateX value. Unfortunately there is no way to detect label width before rendering it, so transformOrigin
should help, so no need to apply translateX
.
See related source code: https://github.com/callstack/react-native-paper/blob/813cdd47a90ee3bb693c6ec143af73092cd3edae/src/components/TextInput/Label/InputLabel.tsx#L62
See React Native 0.73 docs mentioning
transformOrigin
https://reactnative.dev/docs/0.73/transforms#transform-originIt means we do not need to move TextInput label with translateX to adjust label position after scaling. Most likely
translateX
was needed b/c transform origin was always related tocenter
before v0.73. Now we can set itleft
and removetranslateX
position adjustments.Related issues: https://github.com/callstack/react-native-paper/issues/4245 https://github.com/callstack/react-native-paper/issues/4299 https://github.com/callstack/react-native-paper/issues/4340 and possibly more related issues reporting TextInput label flickering..