Javascript 反应本机+;NativeBase内容组件和转盘(不显示)

Javascript 反应本机+;NativeBase内容组件和转盘(不显示),javascript,react-native,react-jsx,react-native-android,native-base,Javascript,React Native,React Jsx,React Native Android,Native Base,你好 我的React Native应用程序有一个小问题,它使用NativeBase组件。问题出在NativeBase的组件中。我想使用github中的组件,它是 代码如下: index.android.js import React, { Component } from 'react'; import { AppRegistry, StyleSheet, Text, View, } from 'react-native'; import { Container, He

你好

我的React Native应用程序有一个小问题,它使用NativeBase组件。问题出在NativeBase的
组件中。我想使用github中的
组件,它是

代码如下:

index.android.js

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} from 'react-native';

import {
  Container,
  Header,
  Content,
  Title,
  Icon,
  Button,
} from 'native-base';

import Carousel from 'react-native-carousel';

import styles from './src/styles/styles';

export default class iABC extends Component {
  render() {
    return (
      <Container>
        <Header backgroundColor='#ffffff' height={50}>
          <Button transparent>
            <Icon name='md-menu' style={styles.header.icon} />
          </Button>

          <Title style={styles.header.title}>
            iABC
          </Title>

          <Button transparent>
            <Icon name='md-person' style={styles.header.icon} />
          </Button>
        </Header>

        <Content>
          <View style={styles.global.content}>            
            <Carousel width={375}
              hideIndicators={false}
              indicatorColor='#000000'
              indicatorSize={25}
              indicatorSpace={20}
              indicatorAtBottom={true}
              indicatorOffset={250}
              indicatorText='>'
              animate={true}
              delay={2000}
              loop={true}>

              <View style={styles.carousel.page1}>
                <Text>Page 1</Text>
              </View>
              <View style={styles.carousel.page1}>
                <Text>Page 2</Text>
              </View>
              <View style={styles.carousel.page1}>
                <Text>Page 3</Text>
              </View>
            </Carousel>
          </View>          
        </Content>
      </Container>
    );
  }
}

AppRegistry.registerComponent('iABC', () => iABC);
'use strict'
import { StyleSheet } from 'react-native';

export default StyleSheet.create({
  page1: {
    flex: 1,
    height: 150,
    width: 375,
    backgroundColor: '#cdcdcd',
    justifyContent: 'center',
    alignItems: 'center',
  }
})
'use strict'
import { StyleSheet } from 'react-native';

export default StyleSheet.create({
  content: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
})
样式:global.js

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} from 'react-native';

import {
  Container,
  Header,
  Content,
  Title,
  Icon,
  Button,
} from 'native-base';

import Carousel from 'react-native-carousel';

import styles from './src/styles/styles';

export default class iABC extends Component {
  render() {
    return (
      <Container>
        <Header backgroundColor='#ffffff' height={50}>
          <Button transparent>
            <Icon name='md-menu' style={styles.header.icon} />
          </Button>

          <Title style={styles.header.title}>
            iABC
          </Title>

          <Button transparent>
            <Icon name='md-person' style={styles.header.icon} />
          </Button>
        </Header>

        <Content>
          <View style={styles.global.content}>            
            <Carousel width={375}
              hideIndicators={false}
              indicatorColor='#000000'
              indicatorSize={25}
              indicatorSpace={20}
              indicatorAtBottom={true}
              indicatorOffset={250}
              indicatorText='>'
              animate={true}
              delay={2000}
              loop={true}>

              <View style={styles.carousel.page1}>
                <Text>Page 1</Text>
              </View>
              <View style={styles.carousel.page1}>
                <Text>Page 2</Text>
              </View>
              <View style={styles.carousel.page1}>
                <Text>Page 3</Text>
              </View>
            </Carousel>
          </View>          
        </Content>
      </Container>
    );
  }
}

AppRegistry.registerComponent('iABC', () => iABC);
'use strict'
import { StyleSheet } from 'react-native';

export default StyleSheet.create({
  page1: {
    flex: 1,
    height: 150,
    width: 375,
    backgroundColor: '#cdcdcd',
    justifyContent: 'center',
    alignItems: 'center',
  }
})
'use strict'
import { StyleSheet } from 'react-native';

export default StyleSheet.create({
  content: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
})
我尝试过很多方法,设置旋转木马组件的样式,给它一个单独的视图,同时设置两者的样式,但不幸的是,它不起作用。但是,只要我删除NativeBase的
组件,它就可以正常工作。我很确定问题出在NativeBase组件上

提前感谢。

关于

  • 呈现
    Carousel
  • Carousel
    渲染
    carouselpage
  • CarouselPager
    呈现RN的
    ScrollView
关于
内容
,它呈现RN的
滚动视图
。所以在另一个ScrollView中包装它是不必要的,这会导致问题

尝试排除NB的内容

了解有关NativeBase更换组件的更多信息-

关于

  • 呈现
    Carousel
  • Carousel
    渲染
    carouselpage
  • CarouselPager
    呈现RN的
    ScrollView
关于
内容
,它呈现RN的
滚动视图
。所以在另一个ScrollView中包装它是不必要的,这会导致问题

尝试排除NB的内容


了解有关NativeBase更换组件的更多信息-

谢谢,明白了。不确定NB的内容返回什么,认为它只返回视图组件:(试图避免使用NB的组件,并使用react native Carousel组件的另一个Carousel组件。我认为您不需要避免所有NB的组件。仅在这种情况下避免。您可以查看NB的文档,其中包括其所有组件的详细信息。明白了。不确定NB的内容是什么nt return,认为它只是返回视图组件:(试图避免使用NB的组件,并使用来自react native Carousel组件的另一个Carousel组件。我认为您不需要避免所有NB的组件。仅在这种情况下避免。您可以查看NB的文档,其中包括其所有组件的详细信息