Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is RN Swiper incompatible with React Navigation TabNavigator? #389

Open
borvanov opened this issue Apr 18, 2017 · 41 comments
Open

Is RN Swiper incompatible with React Navigation TabNavigator? #389

borvanov opened this issue Apr 18, 2017 · 41 comments

Comments

@borvanov
Copy link

borvanov commented Apr 18, 2017

When I use Swiper inside one of TabNavigation screen, slide's content become invisible (dots and right-left buttons still visible).

default

@quentin996007
Copy link

I have the same problem

@ghost
Copy link

ghost commented Apr 19, 2017

I used a swiper inside Tab Navigator and it works fine for me. Try disabling swiping in TabBarOptions.

@quentin996007
Copy link

@Roman2710 swipeEnabled and scrollEnabled are two options were closed, but the problem still exists, the image cannot be displayed.

@ghost
Copy link

ghost commented Apr 20, 2017

Maybe there's something wrong with the picture. Try to render a simple Component

@borvanov
Copy link
Author

borvanov commented Apr 20, 2017 via email

@quentin996007
Copy link

quentin996007 commented Apr 20, 2017

@Roman2710 @Q404

Version:"react": "~15.4.1", "react-native": "0.42.3", "react-native-swiper": "^1.5.4",

No need for "StackNavigator", is a problem in "TabNavigator".

It works well in the ios emulator, but not in an Android emulator.

There are data, but no pictures are displayed.
bug

Code:
code1
code2

It is normal in the ios simulator:
iosbug

tabBarOptions:
tabbug

I have done a lot of tests, but I still don 't know the question, please help me to see what the problem is? thank you.

@jiasaichao
Copy link

@qinfensky 是TabNavigator的问题react-native-swiper安卓用的ViewPagerAndroid所以有的问题
看: react-navigation/react-navigation#662

@quentin996007
Copy link

@jiasaichao 我找到问题所在了,是‘lazyLoad: true,’,设置为‘true’就可以显示了,但是还是有明显缺陷,就是‘initialRouteName: 'Home'’这个TabNavigator指定初始路由的react-native-swiper不显示,其余的三个都正常显示,这是什么问题呢?

@afinal
Copy link

afinal commented Apr 25, 2017

@qinfensky 您好,我和你有同样的问题,首屏渲染的不可以显示,其他的都可以显示,请问这个问题你解决了吗?

@afinal
Copy link

afinal commented Apr 25, 2017

我现在的临时解决方案是,默认跳转到其他的Tab,然后其他页面componentDidMount的时候,setTimeout跳转回到第一个Tab,首次进入的时候,我准备加个浮层进度条,要不然会看到跳转的过程,就尴尬了

@ayalpani
Copy link

ayalpani commented Apr 26, 2017

The same happens to me. Anyone with a workaround?

Here ist my TabNavigatorConfig:

{ // https://reactnavigation.org/docs/navigators/tab
    initialRouteName: 'NotificationsEpic',
    swipeEnabled: false,
    animationEnabled: false,
    tabBarComponent: TabBarComponent,
    tabBarPosition: 'bottom',
    lazyLoad: true,
    tabBarOptions: {
      style: {
        height: 60
      }
    }

@quentin996007
Copy link

@afinal @ayalpani
这个问题我解决了,展示我的代码。
I solved the problem and show my code.
1.
fixbug1
2.
fixbug2

解决问题,大家玩得愉快
Solve the problem, everyone have a good time.

@jiasaichao
Copy link

@qinfensky @afinal 我不准备解决这个问题了,自己写一个TabBar,我对TabBar要求也不高,点击切换就完了,想怎么显示自己控制,只用react-navigation中的StackNavigator,这样好扩展而且也有可能不用react-navigation用react-native-navigation这样切换起来比较方便,我一直纠结是用react-navigation还是react-native-navigation。

@quentin996007
Copy link

@jiasaichao 我上面贴了代码,这样也能很好的显示了,navigation用起来确实方便。目前问题算是解决了~

@jiasaichao
Copy link

@qinfensky 嗯,解决了就行,估计以后bug解决了,你这个setTimeout也就不用加了。

@afinal
Copy link

afinal commented Apr 27, 2017

@qinfensky 确实是个不错的方案,setTimeout 0也是可以的

@ayalpani
Copy link

Thank you @qinfensky
Works!

@smartPiz
Copy link

smartPiz commented May 8, 2017

still not working ...

@quentin996007
Copy link

@smartPiz show me the code

@StarOfLife
Copy link

StarOfLife commented May 22, 2017

如果我早点翻到的话,我就不发issue了 @qinfensky 还是你这个方法管用啊

@quentin996007
Copy link

@StarOfLife 哈哈,现在 "react-native" 升级到了 "0.44.0","react-navigation"升级到了 "^1.0.0-beta.9"之后,不需要添加定时器了,直接渲染是没问题的,试试吧~

@StarOfLife
Copy link

@qinfensky 我现在就是用的这个版本的,然后出的这个问题。现在只能是先用着定时器了

@quentin996007
Copy link

@StarOfLife 嗯,OK,能解决问题就好,有问题随时联络~

@Adar-Li
Copy link

Adar-Li commented May 27, 2017

@qinfensky 您好,这个代码能私发我一下吗?

@gusgard
Copy link

gusgard commented May 29, 2017

What works for me was to set the height and wrap the Swiper in a View with position absolute, and also add removeClippedSubviews={false}

import { Dimensions } from 'react-native';
const { height } = Dimensions.get('window');


<View style={{ position: 'absolute' }}>
        <Swiper
          height={height}
          removeClippedSubviews={false}
        >
        ...
...

Hope it helps.

@quentin996007
Copy link

timer invalid? @gusgard

@gusgard
Copy link

gusgard commented May 31, 2017

@qinfensky I didn't use any setTimeOut, if that is what you are asking

@cielu
Copy link

cielu commented Jun 2, 2017

@qinfensky 不需要设置100,设置0就好了

@sayhei
Copy link

sayhei commented Aug 4, 2017

@gusgard your solution solve my problems,thx

@zoofei
Copy link

zoofei commented Aug 31, 2017

@qinfensky it work! thank

@wangweifeng66
Copy link

wangweifeng66 commented Sep 4, 2017

After I added the timer, I still could not display the picture and needed to slide manually @qinfensky
If the time setting of the timer is too short, there is no effect

@quentin996007
Copy link

@wangweifeng66 拼音?那就说中文啦,抱歉,我没在用这个组件了,现在具体细节我不知道了……

@montzkie18
Copy link

Hi guys, I ran into this issue as well on Android. Try setting animationEnabled to false on TabNavigatorConfig. That seems to fix the issue for me.

@d-gubert
Copy link

d-gubert commented Oct 9, 2017

Disabling the animation works, but is a really big drawback for the usability of the TabNavigator component.

I'm looking for a better solution. Any help would be very appreciated :)

@sunnynegi
Copy link

sunnynegi commented Nov 9, 2017

Getting a same issue, Inside tabNavigator swiper content is not displaying, Any help provided on this issue will be helpful.
Any help on this group

@wutianlin
Copy link

Hi Guys,it looks like something wrong in showing images like this:
image
I have been add the timer but it still no work,I have no idea could you please help me?

@wutianlin
Copy link

Here are the timers:
componentDidMount(){
setTimeout(()=>{
this.setState({
swiperShow:true
});
},0)
}

@Hancoson
Copy link

@qinfensky 不错,可以解决问题

Fadingvision added a commit to Fadingvision/react-native-cloud-music that referenced this issue Dec 7, 2017
@karottc
Copy link

karottc commented Sep 27, 2018

@StarOfLife 嗯,OK,能解决问题就好,有问题随时联络~

加了定时器还是无法解决。 0.52.3 版本

@zengyunLee
Copy link

@qinfensky why dose it work? what is the root cause?

@quentin996007
Copy link

@qinfensky为什么它的剂量有效?根本原因是什么?

I hadn't used this component for a long time, and I was just trying to delay display and I was able to solve my problem. Now that "Swiper" and "React-Navigation" have been updated a lot, I guess the problem has been solved and I haven't had time to test it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests