0

Is there any repo or something that can be used to change the splash screen image automatically without doing a release?

For example 1 week I want to display image X and after that I wanna do Y, but Y its also not on the phone so I have to download it from an api and so on.

AleXzpm
  • 1,024
  • 2
  • 10
  • 22
  • Possible duplicate of [iOS Launch screen in React Native](https://stackoverflow.com/questions/34027270/ios-launch-screen-in-react-native) – mugimugi Jul 05 '17 at 08:55
  • not a duplicate, i want to change it when its already installed on a phone, locally I know how to do that. – AleXzpm Jul 05 '17 at 09:04
  • 1
    Change your launch screen image to a uri with a fixed name, then you can replace the image when you need. EX: – Dinith Minura Jul 05 '17 at 09:18
  • Remove launch screen from main UIViewController and in index.js get an Image component to render for some ms time(maybe setTimeout might help) and setState to render your app thereon. – Arnav Yagnik Jul 05 '17 at 10:00

2 Answers2

1

You can do that by yourself easily. Just write your api and once a week make your app check that endpoint while opening the app. Save the image to the disk of the device then serve your image on the splash screen from the memory of the device.

If you do not want to write your own api, keep some state and persist it. Again once a week check the api you want if there are any new images, if yes download them to your device then serve them.

This is a broad answer for a broad question, but you can achieve what you want with a little bit react(native) and js.

milkersarac
  • 3,399
  • 3
  • 31
  • 31
  • The api and getting the images its not the problem, but how do you override the launch image? – AleXzpm Jul 05 '17 at 14:27
  • You can check [react-native-fs](https://github.com/itinance/react-native-fs) in order to read/write from the file system where you can store your launch image. – milkersarac Jul 05 '17 at 15:53
0
  1. You can use existing npm packages to make splash screens. like react-native-splash-screen

  2. using setTimeout method

componentDidMount() {
  setTimeout(function(){
    // place your navigator code here
  }, 1000); // update your own time interval value
}

Hope this will help you :) Happy coding!

Moorthy
  • 723
  • 1
  • 6
  • 20