必须通过contentContainerStyle prop应用ScrollView子布局

New*_*ver 9 javascript reactjs react-native react-native-android react-native-ios

我正在使用反应原生swiper.并且显示此错误我不知道为什么.怎么解决?在过去,没有像这样的问题.这是第一次发生.怎么了?

这是完整错误的图像:

这是完整错误的图像

<Swiper loop={false}
          index={0}
          style={styles.wrapper}
          activeDotColor={'#EEE'}>

          <View style={styles.slide1}>
            <Text style={styles.text}>Choose category you like</Text>
          </View>
          <View style={styles.slide2}>
            <Text style={styles.text}>Bookmark articles that you</Text>
            <Text style={styles.text}>like</Text>
          </View>
          <View style={styles.slide3}>
            <Text style={styles.text}>Get notifications about your</Text>
            <Text style={styles.text}>chosen topic</Text>
            <Button style={styles.text} onPress={() => this.props.navigation.navigate("Home")}>
              <Text style={styles.text}>Main Screen</Text>
            </Button>
          </View>
        </Swiper>
      )
    } else {
      return <View></View>
    }
  }
}

const styles = {
  wrapper: {
    justifyContent: 'center',
    alignItems: 'center'
  },
  slide1: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#9DD6EB'
  },
  slide2: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#97CAE5'
  },
  slide3: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#92BBD9'
  },
  text: {
    alignSelf: 'center',
    color: '#FFF',
    fontSize: 26,
    fontWeight: 'bold'
  },
}

export default WelcomeScreen
Run Code Online (Sandbox Code Playgroud)

请帮忙解决这个恼人的麻烦.

Par*_*tts 19

添加这样的风格

<Swiper loop={false}
          index={0}
          contentContainerStyle={styles.wrapper}
          activeDotColor={'#EEE'}>
Run Code Online (Sandbox Code Playgroud)


Sun*_*tan 16

使用contentContainerStyle道具代替style道具。

contentContainerStyle={styles.wrapper}
Run Code Online (Sandbox Code Playgroud)