is it possible, to show animated GIFs with - source={require(...)} on iOS with React-Native?
The following example do not work:
<ImageBackground source={require(...)} style={{width:'100%',height:'100%'}} />
This Example works:
<Image source={{uri: 'https://media.giphy.com/media/JQ3IMbDi5Jkw8/giphy.gif'}} style={{width:'100%',height:'100%'}} />
I will use ImageBackground with "require" to show an animated GIF on IOS.
Everything works on Android.
I hope someone can help me.
OfCourse, it will also work on IOS. You can test it by using https://snack.expo.io
Here is using ImageBackground component in IOS.
Related
I'm currently trying to set a full background image on my login view. I want to be able to fill my Background image on the whole screen for the iPhone 11. I've read a bit about safeAreaView and SafeAreaViewInset but not sure how I can implement that in my current case.
I've used the following code to do so but noticed that iPhone 11 has like a white bar at the bottom and top of the phone. Is this something that can't be overlapped since it's like the navigation?
How app currently looks
return <SafeAreaView style={styles.container}><Background source={require('../../assets/images/background-cover.jpg')}>
<CoverLogo width={100} height={100} color={Colors.White} />
<Introduction loop={false}>
<TextHeading text={`#test`} />
<TextPage text={`Btest2`} />
<TextPage text={`Ttest3`} />
<TextPage text={`test4 Sign up !`} />
</Background>
</SafeAreaView>
I have an iOS react native app where I load images from the CameraRoll and display them in another view.
This works fine for most images, but when an image is an animated GIF, the image displays, but it is not animated. I want to be able to show the animated original, not a static thumbnail.
The image information returned from the CameraRoll is of the form:
{
filename: "test animated gif 1.gif",
height: 480,
isStored: true,
playableDuration: 0,
uri: "assets-library://asset/asset.GIF?id=8627D49D-CF91-414A-94DA-035F46850867&ext=GIF",
width: 480
}
I display this in an image component:
<Image
source={{uri: asset.uri}
style={{
width: 300,
height: 225,
borderRadius: 15,
}}
/>
As I said, a static version of the GIF will display - I believe this is one of the automatic thumbnails iOS generates of CameraRoll images.
The URI seems like a dynamic accessor sort of URI, and not a link to a specific file, and that the Image component is picking a thumbnail, as per the React Native docs.
Is there a way to force ReactNative to access the original asset file of the GIF?
Additional info:
I can successfully display animated GIFs loaded from http:// URIs, but that does not help me.
I have explored using other filesystem tools like ReactNativeFetchBlob to access or display the file and the URI remains the same assets-library:// URI.
I have tried a different image display component (react-native-fast-image), but this also simply displays the static version of the GIF.
This has to do with how you're formatting your Image source code. React Native renders network images primarily using uri within the image source so they can load later than using require. Try out using require instead.
<Image
source={require('/react-native/img/favicon.png')}
/>
More info: https://facebook.github.io/react-native/docs/image
I have a React Native project I've written using Expo -- when I develop and publish on Expo, the Status Bar up top (the time, wifi etc) is fine, I've never had to be concerned about it -- it's always been there, so I've never had to read-in a separate StatusBar component or anything like that.
But when I 'build' the app to get the IPA file and then deploy on TestFairy, the App's statusbar is completely invisible (not sure if the font is white or it's an overlay or what).
Any ideas? Thanks!
As mentioned in the Expo docs
Expo makes the status bar translucent by default on Android which is consistent with iOS, and more in line with material design.
Therefore using the react-native's StatusBar you can configure it as follows
<ParentWrapper style={{flex: 1}}>
<View style={{ height, backgroundColor }}>
<StatusBar { ...props } />
</View>
// ... Your navigation or the child components
</ParentWrapper>
and the height is Platform.OS === 'ios' ? 20 : StatusBar.currentHeight
My TextInput is missing inside ScrollView for iOS. It works fine on android.
Included is the sample app using Playground.
https://rnplay.org/apps/KtTZ2g
You could see that android is showing the TextInput, but the iOS's one does not show it.
These kind of bugs is making me crazy...
When using the TextInput, be sure to provide a height:
<TextInput
style={{flex: 1, color: 'black', height:40}}
editable={false}
defaultValue="+"
underlineColorAndroid='#C8C7CC' />
https://rnplay.org/apps/a6i08w
I'm using gravatar to generate avatars like so:
<img src="http://www.gravatar.com/avatar/516d060859b00e099588610cfd973432?s=64&d=retro" width="32" height="32">
Works great on desktops, all browsers. But results in a broken image on IOS (e.g. iPhone). Any idea how I get it this to work for IOS?