2016-03-21 91 views
0

我正在使用React Native的Navigator来浏览iOS应用程序中的场景。我发现,尽管我可以通过从左边滑动到右边来滑回到前一个屏幕,但看起来我可以滑动的区域并不像本地导航那么大或者响应快。有时我从边缘轻扫一下,不起作用。React本机导航手势

我想知道是否有一种方法可以对这个区域进行一些调整,也就是使刷卡回去的区域稍大一些,这样用户的成功率就会更高。

回答

1

它可能不是最好的解决办法,但你可以在NavigatorSceneConfigs.js

改变edgeHitWidth

默认为“左到右”是30

这会影响你的整个项目,每次你升级原生你需要重新做这些改变。

0

不知道,如果它仍然可以帮助,但:

const SCREEN_WIDTH = require('Dimensions').get('window').width; 

const buildStyleInterpolator = require('buildStyleInterpolator'); 

const BaseSceneConfig = Navigator.SceneConfigs.HorizontalSwipeJump; 
const CustomBackGesture = Object.assign({}, BaseSceneConfig.gestures.jumpBack, { 
    // Make it so we can drag anywhere on the screen 
    edgeHitWidth: SCREEN_WIDTH, 

}); 
const CustomForwardGesture = Object.assign({}, BaseSceneConfig.gestures.jumpForward, { 
    // Make it so we can drag anywhere on the screen 
    edgeHitWidth: SCREEN_WIDTH, 

}); 
const CustomSceneConfig = Object.assign({}, BaseSceneConfig, { 
    // A very tighly wound spring will make this transition fast 
    springTension: 100, 
    springFriction: 1, 
    gestures: { 
    jumpBack: CustomBackGesture, 
    jumpForward: CustomForwardGesture, 
    }, 
}); 

您可以自定义手势和edgeHitWidth:SCREEN_WIDTH的伎俩。