2
我正在尝试构建显示推文的RN组件。我分出了一个很棒的RN组件,react-native-fabric-twitterkit并添加了一个显示推文的组件。到目前为止这么好,但是当我想在ScrollView中显示Tweet时,我必须指定组件的高度和宽度,否则它将不会显示。任何想法我做错了什么?React Native自定义组件不会动态设置组件的大小
这里是我的分叉RN组件:https://github.com/adamivancza/react-native-fabric-twitterkit
这里是一个测试应用程序,展示了我的问题:https://github.com/adamivancza/react-native-twitterkit-test
<View style={styles.container}>
<ScrollView
style={{ flex: 1 }}>
// this component is displayed because I've set a specific height
<Tweet
style={{ flex: 1, height: 200 }}
tweetId='788105828461006848'/>
// this component is not displayed
<Tweet
style={{ flex: 1 }}
tweetId='788105828461006848'/>
</ScrollView>
</View>
你试着将'height'和'width'设置为'null'吗?有一些错误,例如图片在RN – jonzee
@jonzee可悲的是,没有帮助 – Roosevelt
一直有同样的问题。看起来像本地反应有调整意见的问题。 https://github.com/facebook/react-native/issues/4990和https://github.com/facebook/react-native/issues/9275对此问题进行了一些讨论。 – smilledge