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

addon-knobs for React-Native not working #6918

Closed
lyqht opened this issue May 31, 2019 · 14 comments
Closed

addon-knobs for React-Native not working #6918

lyqht opened this issue May 31, 2019 · 14 comments

Comments

@lyqht
Copy link

lyqht commented May 31, 2019

Describe the bug
In the index.tsx file, I have tried adding a global decorator for add-on knobs with the code below. (Notes is working, knobs is not.)

addDecorator(withNotes)
addDecorator(withKnobs)

configure(() => {
  loadStories()
}, module)

const StorybookUIRoot = getStorybookUI(
  {port: 7070, host: 'localhost'});

AppRegistry.registerComponent(appName, () => StorybookUIRoot);
export default StorybookUIRoot;

And in my story file,

// ...
import { number } from '@storybook/addon-knobs';

storiesOf('Pill', module)
  .add('Configuring Colors', () => {
    const pill1R = number('R', 255)
    const pill1G = number('G', 118)
    const pill1B = number('B', 0)
    const pill1Color = `rgb(${pill1R}, ${pill1G}, ${pill1B})`

    return (
    <View style={StoryStyle.centerComponent}>
      <View style={StoryStyle.buttonSubsection}>
        <Pill label="Hello" indicatorColor={pill1Color}  />
        <View style={StoryStyle.space} />
        <Text.H5>Indicator Color: {pill1Color}</Text.H5>
      </View>
    </View> )
  }

I can see that the const values are parsed correctly in the app, but there is no knobs available.
image

relevant dependencies:

    "@storybook/addon-actions": "^5.0.11",
    "@storybook/addon-info": "^5.0.11",
    "@storybook/addon-knobs": "^5.0.11",
    "@storybook/addon-notes": "^5.0.11",
    "@storybook/addon-ondevice-backgrounds": "^4.1.18",
    "@storybook/addon-ondevice-knobs": "^4.1.18",
    "@storybook/addon-ondevice-notes": "^4.1.18",
    "@storybook/addons": "^5.0.11",
    "@storybook/react-native": "^4.1.18",
@aswin-s
Copy link

aswin-s commented Jun 2, 2019

Facing the same issue. Tried alpha & next channels as well.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2019

Automention: Hey @Armanio @benoitdion @Gongreg @igor-dv @leoyli, you've been tagged! Can you give a hand here?

@shilman
Copy link
Member

shilman commented Jun 3, 2019

@lyqht @aswin-s You should either use 4.1.x versions across the board or upgrade everything to 5.1.0-rc.x. Can't guarantee it will fix the problem, but I wouldn't expect the example posted here to work due to version inconsistency (4.x to 5.x is a breaking change, that's why we use semver)

@Gongreg Gongreg closed this as completed Jun 3, 2019
@Gongreg Gongreg reopened this Jun 3, 2019
@Gongreg
Copy link
Member

Gongreg commented Jun 3, 2019

Sorry, accidentally closed it.

@aswin-s
Copy link

aswin-s commented Jun 3, 2019

@shilman Yes I did the same. When I was trying out stable build, all storybook dependencies were on 4.1.18. And for 'rc' tag, I used 5.1.0-rc.3 across.

@shilman shilman added the bug label Jun 3, 2019
@shilman
Copy link
Member

shilman commented Jun 3, 2019

@aswin-s Ok, thanks for letting me know. Hopefully we can get a fix out soon.

@lyqht
Copy link
Author

lyqht commented Jun 3, 2019

@shilman , thank you for getting back on this issue!

image

@aswin-s
Copy link

aswin-s commented Jun 3, 2019

I tried this on a new CRNA app and to my surprise, it's working. I don't know where I messed up last time. Please mark this as a non-issue.

@shilman shilman modified the milestones: 5.1.0, 5.1.x Jun 5, 2019
@stale
Copy link

stale bot commented Jun 26, 2019

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jun 26, 2019
@Gongreg
Copy link
Member

Gongreg commented Jun 26, 2019

Hey, is there still an issue here?

@stale stale bot removed the inactive label Jun 26, 2019
@lyqht
Copy link
Author

lyqht commented Jun 27, 2019

@Gongreg Nope, they are working! But theres still the debounce interval problem that i highlighted. But i guess this issue can be closed for its topic :) Thanks for helping out !

@lyqht lyqht closed this as completed Jun 27, 2019
@slorber
Copy link
Contributor

slorber commented Jul 4, 2019

is there someone having an Expo SDK33 setup that works? I can't find any RN example anymore in the repo and by ondevice knobs don't appear :(

@Gongreg
Copy link
Member

Gongreg commented Jul 4, 2019

Hey @slorber, this is the example: https://github.com/storybookjs/storybook/tree/next/examples-native/crna-kitchen-sink . I hope it works, I am not sure, didn't test it.

@slorber
Copy link
Contributor

slorber commented Jul 15, 2019

Thanks @Gongreg this probably saved me few hours :)

Just noticed I simply forgot to add "/register" at the end of each import.

Isn't there a way to warn the user if he types the wrong import, like I did?

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

No branches or pull requests

5 participants