oceanbit / react-native-button-toggle-group

An animated button toggle group for React Native
47 stars 14 forks source link

RNCMaskedView Error #17

Open WrathChaos opened 2 years ago

WrathChaos commented 2 years ago

CleanShot 2021-11-21 at 19 32 34

Hello, Lovely library however I could not even make it work with react-native 0.66+. This error just throwing. I'm using the same usage with your example:

import ButtonToggleGroup from 'react-native-button-toggle-group';

const [value, setValue] = React.useState('Light');

return (
<ButtonToggleGroup
    highlightBackgroundColor={'blue'}
    highlightTextColor={'white'}
    inactiveBackgroundColor={'transparent'}
    inactiveTextColor={'grey'}
    values={['Auto', 'Light', 'Dark']}
    value={value}
    onSelect={val => setValue(val)}
/>
)
crutchcorn commented 2 years ago

We've run into this issue before and I'm not convinced it's a problem on our end. (it tends to be two libraries fighting for dep version control and ending up installing two versions)

Here's how we fixed it in our app - Use yarn for your package manager and add a resolution for masked-view:

  "resolutions": {
    "@react-native-masked-view/masked-view": "0.2.6"
  },
WrathChaos commented 2 years ago

Unfortunately, we don't use yarn for the package manager. Do you have any other solution for that?

crutchcorn commented 2 years ago

Unfortunately not. NPM 7 mentioned adding support for something similar to resolutions, but memory serving it didn't quite make it in

Maybe if you can find a PR for anything with a lower version of this dep (something that doesn't fit in the carret range), it could help to make a PR back up and resolve the dup dep issue:

https://github.com/oceanbit/react-native-button-toggle-group/blob/master/package.json#L41

You can find this easier using npm ls @react-native-masked-view/masked-view

nikitph commented 2 years ago

we are running into this too

crutchcorn commented 2 years ago

@nikitph are you able to run the npm list command, as suggested and give the output for me?

Does the yarn workaround work as-intended?

daniel-keen commented 2 years ago

Couldn't make it work, same error. Is there any solution available? I get the following error, when I add "@react-native-masked-view/masked-view": "0.2.6" to the package: requireNativeComponent: "RNCMaskedView" was not found in the UIManager.

WrathChaos commented 2 years ago

Couldn't make it work, same error. Is there any solution available? I get the following error, when I add "@react-native-masked-view/masked-view": "0.2.6" to the package: requireNativeComponent: "RNCMaskedView" was not found in the UIManager.

He is not even do anything like 8 months. Don't wait anything from him. You can make a fork if you need it

daniel-keen commented 2 years ago

@WrathChaos I decided to create my own component instead :) It's actually not that hard.

WrathChaos commented 2 years ago

@thexdd Please share with me when you're done :)

crutchcorn commented 2 years ago

Please don't close this issue, since others are experiencing it as well.

@thexdd PRs welcome. The real solution would be to simply add in a peerDeps

daniel-keen commented 2 years ago

@crutchcorn https://stackoverflow.com/a/69266249/2203872 Here is a post that describes how you can do that.

crutchcorn commented 2 years ago

@thexdd to be clear, that answer is a valid (although much more simple) answer to how to create a button group.

This library adds in additional animations that are much more complex to add in. You're welcome to dive into the source code of what's been built to see the differences and additional complexity (in favor of a nicer UI/UX)

olaitanade commented 1 year ago

To solve this all I did, was replace "@react-native-community/masked-view": "0.1.11", with "@react-native-masked-view/masked-view": "0.2.6".