Skip to content

Commit

Permalink
Merge pull request #1514 from storybooks/1509-fix-react-native-example
Browse files Browse the repository at this point in the history
Fix react native example and bootstrapping
  • Loading branch information
ndelangen authored Jul 25, 2017
2 parents 9b80a99 + 04a15a8 commit 0ceac7d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 24 deletions.
6 changes: 3 additions & 3 deletions docs/components/Homepage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ import Footer from '../Footer';
const Homepage = ({ users }) =>
<div className="container">
<Helmet title="Storybook - UI dev environment you'll love to use" />
{/* <Header currentSection="home" />*/}
{/* <Header currentSection="home" /> */}
<Heading />
<Demo />
{/* <Platforms />*/}
{/* <Platforms /> */}
<MainLinks />
<UsedBy users={users} />
{/* <Featured featuredStorybooks={featuredStorybooks} />*/}
{/* <Featured featuredStorybooks={featuredStorybooks} /> */}
<Footer />
</div>;

Expand Down
8 changes: 7 additions & 1 deletion examples/test-cra/src/stories/ComponentWithRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ class ComponentWithRef extends Component {
}
scrollWidth = 0;
render() {
return <div ref={r => (this.ref = r)} />;
return (
<div
ref={r => {
this.ref = r;
}}
/>
);
}
}

Expand Down
11 changes: 3 additions & 8 deletions lib/addons/src/index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
function channelError() {
throw new Error(
'Accessing nonexistent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel'
);
}

export class AddonStore {
constructor() {
this.loaders = {};
this.panels = {};
// this.channel should get overwritten by setChannel if package versions are
// correct and AddonStore is a proper singleton. If not, throw an error.
this.channel = { on: channelError, emit: channelError };
// correct and AddonStore is a proper singleton. If not, this will be null
// (currently required by @storybook/react-native getStorybookUI)
this.channel = null;
this.preview = null;
this.database = null;
}
Expand Down
24 changes: 12 additions & 12 deletions scripts/hoist-internals.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const passingLog = fn => i => {
fn(i);
return i;
};
const getPackageNameOfFolder = sourcePath =>
fse
.readJson(path.join(sourcePath, 'package.json'))
.then(json => json.name.replace('@storybook/', ''));
const getPackageOfFolder = sourcePath => fse.readJsonSync(path.join(sourcePath, 'package.json'));

const task = getLernaPackages()
.then(
Expand Down Expand Up @@ -60,14 +57,17 @@ const task = getLernaPackages()
log.silly(prefix, 'found package path', item);
})
)
.map(sourcePath =>
getPackageNameOfFolder(sourcePath)
.then(
passingLog(packageName => {
log.silly(prefix, 'found package name', packageName);
})
)
.then(packageName => path.join(targetPath, packageName))
.map(sourcePath => ({
sourcePath,
packageJson: getPackageOfFolder(sourcePath),
}))
.filter(({ packageJson }) => !packageJson.private)
.map(({ sourcePath, packageJson }) =>
Promise.resolve(packageJson.name.replace('@storybook/', ''))
.then(packageName => {
log.silly(prefix, 'found package name', packageName);
return path.join(targetPath, packageName);
})
.then(localTargetPath =>
symlink(sourcePath, localTargetPath)
.then(
Expand Down

0 comments on commit 0ceac7d

Please sign in to comment.