question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Styling issue with Card element after upgrading to RN 0.50

See original GitHub issue

Description

  1. I have a Card element inside a FlatList. I had this working last week, it has crashed AFTER an upgrade I did yesterday to React Native 0.50. I also Had to replace the wrapper element of the FlatList for a View, I had a List, but after I upgraded it showed a white background as well. With View it works as you can see on SS.

Version:

"react-native": "0.50.4",
"react-native-elements": "^0.18.4",

Sample Code

return(
      <View style={styles.list}>
        { this.state.loaded ?
          <FlatList
            data={this.state.data}
            renderItem={ ({item}) =>
              <TouchableWithoutFeedback
                onPress={
                  () => this.props.navigation.navigate('RecipeInfo', {'uri': item.recipe.uri})
                }
              >
                <View>
                  <Card
                    style={itemsUserStyles.card}
                    title={item.recipe.label}
                    titleStyle={itemsUserStyles.title}
                    image={{uri: item.recipe.image}}
                  >
                    <View style={[itemsUserStyles.recipeTagsContainer]}>
                      {
                        (item.recipe.dietLabels.concat(item.recipe.healthLabels)).map((tag, i) => {
                          return (
                            <Text
                              key={i}
                              style={itemsUserStyles.recipeTags}
                            >
                              {tag}
                            </Text>
                          )
                        })
                      }
                    </View>
                  </Card>
                </View>
              </TouchableWithoutFeedback>
            }
            keyExtractor={item => item.recipe.uri}
          />
          :
          <View style={styles.spinnerContainer}>
            <ActivityIndicator color="#ea4e3c" size={1} />
          </View>
        }
      </View>
    );

As you can see, I’m getting a default white background for Card element, which I cannot replace for transparent, it just doesn’t work! I presume this is because I updated to RN 0.50. Since Last week I still used .49 and this didn’t happen.

bildschirmfoto 2017-11-30 um 18 54 54

Thanks a lot for your time/help.

  • F

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
fsunsetcommented, Dec 4, 2017

cc @xavier-villelegier

@iRoachie - yes sir! That’s the fix for it. Closing this one. Thanks a lot for the time guys.

1reaction
iRoachiecommented, Dec 4, 2017

Hey @fsunset the prop for styling the container is called containerStyle. Can you try using that instead of style?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Card Payment renders without style · Issue #248 - GitHub
Summary I try to render And it only renders the Card Number, Date, and CVV inputs, with No Styling at all. I do...
Read more >
react-stripe-elements styling Card Element - Stack Overflow
I'm using the module react-stripe-elements and I want to style the CardElement to create something like the attached.
Read more >
react-native-elements | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Boost Your User Experience with Lottie for React Native
We've encountered problems where animation “doubles” the style properties. This can mean that your “let's add 50px margin over there” may turn ...
Read more >
React Native development tools - Part 3: Testing tools - Pusher
While I was testing it though, I had problems getting Detox to work for React Native version 0.51. That's why we're sticking with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found