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

1.1.0 not working (at least for me) in Expo #43

Closed
darrylyoung opened this issue Jan 20, 2020 · 12 comments
Closed

1.1.0 not working (at least for me) in Expo #43

darrylyoung opened this issue Jan 20, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@darrylyoung
Copy link

Bug

I just upgraded to 1.1.0 and I'm now seeing the following. Note that I'm using Expo SDK 36.0.0. I've only recently started using this package so I'm not sure exactly what's happened but it was working before the upgrade and the Expo documentation still points to here for Segmented Control.

PNG image

Environment info

Steps To Reproduce

  1. Navigate to a screen where the component is being used
  2. The error (in the screenshot above) is shown before the page renders

Describe what you expected to happen:

  1. The page renders as usual and, according to the release notes, the only difference I see is that there's TypeScript support and support for textColor and backgroundColor props

Reproducible sample code

<SegmentedControlIOS
  values={[translate('common.categories'), translate('common.collections')]}
  selectedIndex={selectedIndex}
  onChange={event => {
    setSelectedIndex(event.nativeEvent.selectedSegmentIndex)
  }}
/>

Thanks for your work on this awesome package, by the way. 👍

@Naturalclar
Copy link
Member

@darrylyoung Thanks for opening up an issue!

I believe the error is caused by the rename of module happened in #33.
Expo currently doesn't support the renamed RNCSegmentedControl since that was a recent change.

For now, could you import the SegmentedControlIOS component from react-native itself? (Even though the document says that it's deprecated, it should still be usable)
Unfortunately the iOS 13 support that I recently added won't work for the SegmentedControlIOS from react-native.

I'll look into Expo to see if I can make the addition of this package to Expo.

@Naturalclar Naturalclar added the enhancement New feature or request label Jan 20, 2020
@darrylyoung
Copy link
Author

Hi, @Naturalclar.

Sure, I'll just keep using it the way I was doing and check back here at some point to see if anything has changed with regard to getting Expo supporting the change.

Thanks for the quick reply. Have a nice day.

@nacho-carnicero
Copy link
Contributor

@Naturalclar I'm having the same exact issue in my project, which is not depending on Expo. I think the issue is due to the fact that the library needs to be linked to the project. I tried manually linking it to mine and now the build fails while trying to compile the libRNCSegmentedControl.a library, but without any error message, which is weird... any thoughts?

Thanks for your time on this package by the way!

@nacho-carnicero
Copy link
Contributor

Ok I managed to get it working for my project, I will add a PR

@nacho-carnicero
Copy link
Contributor

Ok PR added in #44, @Naturalclar let me know if you have questions! :)

@evanheckert
Copy link

Problem persists in 1.1.1.

@Naturalclar
Copy link
Member

@evanheckert could you tell me which version of react-native you are using?

@evanheckert
Copy link

I’m using Expo, so I’m on their latest fork. @Naturalclar.

@nacho-carnicero
Copy link
Contributor

@evanheckert from my understanding expo is not yet using this package for the segmented control component, but is still using the react native one, so the issue has to be fixed on expo.
Indeed, as you can see in the list of bundled native modules there is no mention to this package.

Since @Naturalclar decided to rename the native module from RCTSegmentedControl to RNCSegmentedControl (which makes sense since now the component is outside of React-native core) Expo needs to bundle the native code from this package into their SDK so that the import of the RNCSegmentedControl works.

@evanheckert
Copy link

@nacho-carnicero That makes sense! Thank you for taking the time to describe why :)

@Naturalclar
Copy link
Member

@evanheckert Sorry for the late response!
@nacho-carnicero has explained it for me.
This repo is currently not supported by expo, but I'd like to have it supported some day, so I'll try to communicate with the expo team.

Mean while, you're still able to import SegmentedControlIOS from react-native if you're using expo 36.

@darrylyoung
Copy link
Author

Thanks, everyone. I'll close this as I now know this isn't supported in Expo. Their documentation wasn't particularly clear on this but somebody fixed that (thanks!).

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

No branches or pull requests

4 participants