Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
675 views
in Technique[技术] by (71.8m points)

react native - Getting Unexpected Design After using TouchableOpacity

am implementing flatlist in my app, and by using TouchableOpacity am getting Unexpected Design, here is my code

    <FlatList
      data={dummyData}
      keyExtractor={(item) => item.id}
      numColumns={2}
      renderItem={(item) => (
        <TouchableOpacity style={style.grid} onPress={() => console.log("ds")}>
          <View>
            <Text>{item.item.title}</Text>
          </View>
        </TouchableOpacity>
      )}
    ></FlatList>
  );
};

const style = StyleSheet.create({
  grid: {
    flex: 1,
    height: 150,
    margin: 20,
    alignItems: "center",
    backgroundColor: "white",
    borderRadius: 10,
    elevation: 10,
  },
});

before adding TouchableOpacity am getting this enter image description here

after adding TouchableOpacity am getting this enter image description here

how can i solve this issue basically i want same result as in first picture but using TouchableOpacity. (Sorry for my bad english)

question from:https://stackoverflow.com/questions/65863257/getting-unexpected-design-after-using-touchableopacity

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...