-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Update to 0.4.1 - rendering not working for e.g. texts and images #1051
Update to 0.4.1 - rendering not working for e.g. texts and images #1051
Comments
I've just updated from 0.4 to 0.4.1 and everything works fine, texts and images |
@PhilippKrone - just a shot in the dark, did you try restarting XCode? |
@brentvatne did not before, but just did - no success. I'll try to create a minimal example, let's see whether my weird behaviour can be localized. :-) |
@brentvatne ok, I was able to figure it out, atleast to elimate the error, although I dont know the reason yet. Old stylesheet (working under 0.4.0 and not working under 0.4.1) container: {
flex: 1,
justifyContent: 'flex-start',
alignItems: 'stretch',
backgroundColor: '#ffffff',
}, New stylesheet (working under 0.4.0 and 0.4.1) container: {
flex: 1,
justifyContent: 'flex-start',
alignItems: 'center',
backgroundColor: '#ffffff',
}, So it seems the interpretation of alignItems has changed from 0.4.0 to 0.4.1 - I can now fix the layout again for my app, but the root cause would be of interest for me anyway. |
Mhh, I have to deep dive into this change - from a first look this might be what has caused my issue. Thanks for the hint! |
Perhaps not, it looks like that was just some dead code removal (unless it produces some side effects). |
Mhh, currently checking: Anyway, priority is rather low as a solid "work around" / fix can be used. |
@PhilippKrone - fair. Could you post the full code or something that will reproduce it so we can determine if the change was a fix or a regression? 😄 |
@brentvatne Sure thing! :)
/**
* Test app
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
Navigator,
Text,
Image,
View,
AlertIOS,
NetInfo,
TouchableHighlight,
AppRegistry,
StyleSheet,
} = React;
var TestProject = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Image
style={styles.backdrop}
source={require('image!Test')}>
<View style={styles.ClearBackground}>
<View style={styles.backdropView}>
<Text style={styles.appNameText}>
SMIPE
</Text>
</View>
</View>
</Image>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'flex-start',
alignItems: 'center',
backgroundColor: '#ffffff',
},
backdrop: {
flex: 1,
marginTop: 0,
alignItems: 'stretch',
},
backdropView: {
backgroundColor: 'rgba(0,0,0,0)',
alignItems: 'stretch',
width: 250,
},
ClearBackground: {
backgroundColor: 'rgba(0,0,0,0)',
flex: 1,
alignItems: 'center',
marginTop: 130,
},
appNameText: {
textAlign: 'center',
fontSize: 48,
fontFamily: 'Gill Sans',
color: '#ffffff',
},
});
AppRegistry.registerComponent('TestProject', () => TestProject);
|
It's actually related to /cc @amasad |
Indeed setting the width and height works. I just figured out a case in which I'm only setting the height of an image (and no width, as I want to have the same aspect ratio as the original image) and this is not working correctly as well. I'm now calculating the width as well by just multiplying the calculated height with the (known) aspect ratio and it's working again. Thanks a lot for all your support! |
We started to mix in image width/hight if they are not set on image style. Will probably have to reconsider this - use case when image is sized using flex is valid. @vjeux the layout guru, thoughts? |
@frantic or when image is sized using the parent's align-items:'stretch' property, that is also valid imo, and changing it would break my current use case. |
Erg yeah, I didn't think of this use case. As a workaround I think you can do style={{width: undefined}} I'm not such a fan of auto injecting the dimensions but it's worth trying out and see how that works |
Hi,
I've just updated to 0.4.1 and each screen is rendering completely wrong, e.g. without images and texts.
Anyone else experiencing the same? After going back to 0.4.0, everything is working again.
Regards
Philipp
The text was updated successfully, but these errors were encountered: