Skip to content

Commit

Permalink
Refactor nickWidth calculator styles
Browse files Browse the repository at this point in the history
While not currently used, position: absolute on the text element fixes
height calculation. Move the opacity to the wrapper in case we need to
measure anything else in the future.
  • Loading branch information
mhoran committed Apr 17, 2024
1 parent d19657f commit 5f320f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/usecase/buffers/ui/Buffer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ export default class Buffer extends React.PureComponent<Props, State> {

if (!this.state.nickWidth) {
return (
<View style={{ flexDirection: 'row', flex: 1 }} aria-hidden={true}>
<View style={{ flex: 1, opacity: 0 }} aria-hidden>
<Text
onLayout={(layout) => {
this.setState({ nickWidth: layout.nativeEvent.layout.width });
}}
style={[lineStyles.text, { opacity: 0 }]}
style={[lineStyles.text, {position: 'absolute'}]}
>
aaaaaaaa
</Text>
Expand Down

0 comments on commit 5f320f0

Please sign in to comment.