react-native - 如何通过滑动来导航堆栈导航器?
问题描述
在堆栈导航器。
我不想嵌套底部/顶部导航器来执行此操作。我能够将 transitionConfig 道具配置为类似的动画,但动画被触发并且不响应手势(缓慢滑动使其缓慢显示下一个屏幕等。)它只有在您滑动返回时才能完美运行,但是不要导航到新屏幕。
PS我想使用堆栈导航器来执行此操作,而不是可滚动视图或类似的东西
export default createStackNavigator({
bottomNavigator,
Profile: Profile,
tempScreen: TempScreen
}, {
transitionConfig: (prop) => NavigationConfig(prop)
})
这是 NavigationConfig 返回的动画
const trackFromRightToLeft = {
transitionSpec: {
duration: 350
},
screenInterpolator: sceneProps => {
const { position, layout, scene } = sceneProps
const thisSceneIndex = scene.index
const width = layout.initWidth
const translateX = position.interpolate({
inputRange: [thisSceneIndex - 1, thisSceneIndex, thisSceneIndex + 1],
outputRange: [width, 0, -width]
})
const slideFromRight = { transform: [{ translateX }] }
return slideFromRight
},
}
解决方案
您可以使用 react-native-gesture-handler中的寻呼机,但不完全是您想要的,但通过一些逻辑您可以实现它
推荐阅读
- c++ - LNK2019 未解决的外部 sumbol (cURL & Jsoncpp)
- ios - 使用 PPBadgeView 的自定义徽章未显示在导航项中 - swift
- android - 获取启动器的图标资源标识符
- hyperledger-composer - Hyperledger Composer 中的交易函数返回类型
- php - PHP $stmt 获取正确的用户
- excel - open encrypted excel workbook as zip archive (I know the password)
- email - Ansible 邮件模块不适用于 Office 365
- nunit - 使用捆绑的 NUnit 工具时缺少 NUnit 扩展
- javascript - Zeller's algorithm
- c# - ASP Core 2.1 对 Quartz 的依赖注入