-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Support "100%" or flex: 1 width #9
Comments
Is there any update on this? |
Did anyone figure out a workaround on this? Edit, here's what I ended up doing, maybe not the slickest thing ever but it works for me: const example = () => {
const [wrapperWidth, setWrapperWidth] = useState(0)
return (
<View
style={{ display: 'flex', flexDirection: 'row' }}
onLayout={event => setWrapperWidth(event.nativeEvent.layout.width)}
>
<AutoHeightImage
width={wrapperWidth}
source={{ uri: 'https://i.imgur.com/example.png' }}
/>
</View>
)
} |
@coffenbacher good workaround man... it's still a little strange that react-native don't do it for free... I know they say that they don't add this functionality by default when talking of images taken from the web ({{uri:...}} but this decision should be left to the programmer... |
I enhanced @coffenbacher 's solution a little, so you can also use it also as a ImageBackground.
Usage:
You can still use this component just as an image, if you don't provide children. |
No description provided.
The text was updated successfully, but these errors were encountered: