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

TextInput width applied by a variant will shrink after input is received #458

Open
bsluther opened this issue Dec 18, 2024 · 0 comments
Open
Labels
bug Something isn't working reproduced
Milestone

Comments

@bsluther
Copy link

Description

When a variant sets the width of a TextInput, the size of the input will shrink to the size of the inputted text.

Steps to Reproduce

Mount the following components and enter text into each text input. The text input without a variant will retain the same width, while the text input with the variant will shrink to the size of the inputted text.

import { TextInput, View } from 'react-native'
import { StyleSheet } from 'react-native-unistyles'


export function InputVariantRepro() {
  styles.useVariants({ size: 'small' })

  return (
    <View style={styles.container}>
      <TextInput style={styles.withoutVariant} />
      <TextInput style={styles.withVariant} />
    </View>
  )
}

const styles = StyleSheet.create({
  withoutVariant: {
    backgroundColor: 'white',
    width: 40
  },
  withVariant: {
    backgroundColor: 'white',
    variants: {
      size: {
        small: {
          width: 40
        }
      }
    }
  },
  container: {
    flex: 1,
    width: '100%',
    alignItems: 'center',
    justifyContent: 'center',
  }
})

Snack or Repository Link (Optional)

No response

Unistyles Version

3.0.0-beta.4

React Native Version

0.76.2

Platforms

iOS

Expo

Yes

@jpudysz jpudysz added bug Something isn't working reproduced labels Dec 19, 2024
@jpudysz jpudysz added this to the 3.0.0-beta.5 milestone Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reproduced
Projects
None yet
Development

No branches or pull requests

2 participants