Image nested in Text only show half content part on Android.
See original GitHub issuePlease provide all the information requested. Issues that do not follow this format are likely to stall.
Description
When an Image is nested in Text, only half part content would be showed on android.
React Native version:
Run react-native info
in your terminal and copy the results here.
info
React Native Environment Info:
System:
OS: macOS 10.15.5
CPU: (4) x64 Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
Memory: 30.19 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.3.0 - ~/.nvm/versions/node/v8.3.0/bin/node
Yarn: 1.22.4 - ~/.nvm/versions/node/v8.3.0/bin/yarn
npm: 6.8.0 - ~/.nvm/versions/node/v8.3.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 23.0.1, 24.0.1, 25.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.1, 27.0.3, 28.0.3
System Images: android-27 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
IDEs:
Android Studio: 3.2 AI-181.5540.7.32.5056338
Xcode: 11.5/11E608c - /usr/bin/xcodebuild
npmPackages:
react: ^16.10.2 => 16.10.2
react-native: ^0.59.10 => 0.59.10
npmGlobalPackages:
create-react-native-module: 0.19.0
react-native-cli: 2.0.1
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- put a
<Image/>
inside<Text/>
component - run on android
Expected Results
Image would show full content.
Snack, code example, screenshot, or link to a repository:
render() {
const uri = 'https://cdn.sspai.com//2020/08/01/f91d9770d0d5d2bb270fa9340384a274.png?imageView2/2/w/1120/q/90/interlace/1/ignore-error/1'
const width = Dimensions.get('window').width
const height = width * 0.6231481481481481 // h/w ratio of the example image
return (<Text style={{ width, height, backgroundColor:'blue', }}>
<Image source={{uri}} style={{
width,
height,
resizeMode: 'contain',
}}/>
</Text>
)
}
Extra
Everything is fine on iOS, this issue only occurs on Android.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Is it possible to place one view over another in android?
But in Linear/Relative Layout, views can be placed only one after another or relative to each other, and AbsoluteLayout is advised against. So...
Read more >Reveal or hide a view using animation - Android Developers
There are three common animations to use when showing or hiding a view. You can use the circular reveal animation, a crossfade animation, ......
Read more >Why My Text Is Going Off Screen? The Truth about React ...
The blue element has a parent-driven width. It also has a content-driven height: fits to what is inside only. The parent-driven width is...
Read more >Copy, insert graphics - Adobe Support
Learn to place graphics, import images, and insert pictures or other ... If you've selected Text only, you'll see the Paste text only...
Read more >Add or edit text & images - Sites Help - Google Support
Tip: This section is for new Google Sites. ... You can add images in .png, .jpg, or .gif format. ... Add text, headings,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had the same issue, getting only half of my image. To solve my issue, I set a fontSize big enough to handle my image. My image was 100x100, so I gave <Text> a fontSize:150 and it display my image ok on Android. I did a condition to handle IOS and Android differently since IOS working fine without any fontsize.
Hope it can help someone else 😉
same