当flexDirection中的“列反转”时,React Native ScrollView不起作用

时间:2019-08-26 09:50:22

标签: react-native react-native-scrollview

我正在使用React Native,当我将flexDirection设置为“ column-reverse”时,ScrollView在iOS中向下滚动,在Android中不滚动。我的代码如下所示。

class Chatting extends Component {
  render() {
    return (
      <View style={styles.container}>
        <ScrollView style={styles.messages}>
          <Message isMe={true} text="Hi" />
          <Message isMe={false} text="Hi" />
          <Message isMe={true} text="Hi" />
        </ScrollView>
        <Input placeholder="Type Message" />
        <CustomButton
          value="Send"
          extraStyle={styles.button}
          color={colors.delyColor}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    display: "flex",
    width: "100%",
    height: "100%",
    flexDirection: "column",
    justifyContent: "center",
    paddingRight: 15,
    paddingLeft: 15,
    paddingBottom: HEIGHT * 0.03
  },
  messages: {
    height: "100%",
    width: "100%",
    padding: 10,
    display: "flex",
    flexDirection: "column-reverse"
  },
  button: {
    width: "100%",
    marginTop: 10
  }
});

我想滚动消息部分,但是没有滚动。它应该在iOS上向上滚动而不是向下滚动,并且应该在Android上运行。 请帮我解决这个问题。

0 个答案:

没有答案