jeudi 13 juin 2019

React Native: Switch/(Un)Hide Components - conditional

First time doing React Native. I am trying to switch the components by statement if const video = undefined/null. So if someone can give a hand about that, please. Thank you.

I would like to

  • if 'video' obj is undefined/null then to - hide className="Video"(the WebView component) and hide "gallerySecond" and show "galleryFirst"

  • if there's data at the video obj: then would like to hide "galleryFirst" and show gallerySecond and show the video (WebView component)

    export const video = 'DyDfgMOUjCI';

              <WebView
                style=
                javaScriptEnabled={true}
                className="Video"
                domStorageEnabled={true}
                source=}
              />
            </View>
    
            <Gallery className="galleryFirst" style=/>
    
            <View style={styles.description}>
                <Text style={styles.descriptiontext}>
                    Some Text
                </Text>
            </View>
    
            <Gallery className="gallerySecond" style=/>
    
    

Aucun commentaire:

Enregistrer un commentaire