iRoachie / react-native-material-tabs

Material Design implementation of Tabs
MIT License
121 stars 56 forks source link

Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail. #9

Closed strayer closed 7 years ago

strayer commented 7 years ago

Sorry if I'm wrong, but I think this warning happens in this library. It popped up after upgrading from 2.1.0 to 3.0.1.

ExceptionsManager.js:71 Warning: Stateless function components cannot be given refs. Attempts to access this ref will fail.

Check the render method of `Styled(undefined)`.
    in Touchable (created by Styled(undefined))
    in Styled(undefined) (at Tab.js:28)
    in Tab (at MaterialTabs.js:153)
    in RCTView (at View.js:127)
    in View (created by Styled(View))
    in Styled(View) (at MaterialTabs.js:151)
    in RCTScrollContentView (at ScrollView.js:649)
    in RCTScrollView (at ScrollView.js:734)
    in ScrollView (at MaterialTabs.js:145)
    in RCTView (at View.js:127)
    in View (created by Styled(View))
    in Styled(View) (at MaterialTabs.js:141)
    in MaterialTabs (at CalculationModeTabs.js:15)
    [...]

I found an issue in the styled-components repository, so maybe this can be fixed by a version upgrade: https://github.com/styled-components/styled-components/issues/766

iRoachie commented 7 years ago

@Strayer I haven't been able to reproduce this locally. I'm not sure if this error is from this library however I did upgrade to style-components v2 and pushed a fix in 3.0.2. Let me know if it still shows

strayer commented 7 years ago

It seems like this fixed the issue, the warning isn't popping up anymore. Thanks!

Not sure why you weren't able to reproduce it, react-native-material-tabs is the only module I use that uses styled-components – strange!

iRoachie commented 7 years ago

@Strayer Haha the magical styled components. Thanks mate 👍