【发布时间】:2020-11-10 10:44:18
【问题描述】:
我正在使用 React Native Web 构建一个简单的 Reddit 克隆。 我在使用 React Navigation 中的 StackNavigator 时遇到了这个问题。
堆栈“屏幕”似乎是根据显示器的尺寸而不是内容来计算的。因此,当当前导航屏幕之前的屏幕高度大于当前屏幕时,内容仍然可见于堆栈屏幕的“后面/下方”。
我的主屏幕:
<View style={{ flex: 1, backgroundColor: colors.background }}>
<Button style={{ margin: 5 }} action={() => props.navigation.navigate('CreatePost')}><DText>Create post</DText></Button>
<FlatList
data={getPosts}
renderItem={renderPost}
keyExtractor={item => item.id}
/>
</View>
我的 createpost 屏幕:
<View style={{ flex: 1, backgroundColor: 'red' }}>
<View style={styles.element}>
<TextInput
placeholder={'Title'}
onChangeText={setTitle}
value={getTitle}
/>
<View style={styles.editor}>
<SlateEditor setBody={setBody} />
</View>
<Button action={() => onCreate(getTitle, getBody)}><DText>Post</DText></Button>
</View>
</View>
这是一个例子:
我不希望用户能够在 CreatePost 屏幕上滚动。
【问题讨论】:
-
我刚刚发布了一个新版本的堆栈,应该可以修复它。可以更新一下试试吗?
-
@satya164 在哪里可以找到它?编辑:在官方 github 上找到您的提交 :)
-
是的,已修复!非常感谢您如此迅速地实施这一点,非常感谢!
标签: react-native react-navigation react-native-web