Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@kadira/react-native-storybook
Advanced tools
A better way to develop React Native Components for your app
With React Native Storybook you can design and develop individual React Native components without running your application.
First, install the package from the npm registry and copy initial set of files
npm i -D @kadira/react-native-storybook
cp -r ./node_modules/@kadira/react-native-storybook/assets/template ./storybook
Edit index.ios.js file and the index.android.js file to set your root component name when calling AppRegistry.registerComponent
. And add the storybook npm script to the scripts section of your package.json file.
{
"start": "node node_modules/react-native/local-cli/cli.js start",
"storybook": "storybook start -p 9001"
}
Now you can write stories to preview and interact with your components. These story files can be placed almost anywhere within your project directory.
import React from 'react';
import { storiesOf } from '@kadira/react-native-storybook';
import ExampleComponent from '../../components/ExampleComponent';
storiesOf('ExampleComponent')
.add('First Story', () => (
<ExampleComponent foo="bar">First Story</ExampleComponent>
));
After writing stories, they must be imported into the storybook by requiring them inside the storybook/config.js file. Check the react-native-button repo for an example.
The fastest way to start storybook is to temporarily load it from your main index.ios.js
and index.android.js
files. When you want to run the storybook insert this line and comment out the rest of the file.
import './storybook';
Start the react-native debug server
npm run start
Start the storybook server
npm run storybook
And start your android/ios device or simulator. Stories will appear on http://localhost:9001 as soon as your device connects successfully.
There are a couple of drawbacks with the previous method.
React Native Storybook can be run without making changes to your index.__.js files but it'll take a few minutes to set it up.
In order to work with React Native Storybook, one or more devices should be connected. Stories will only show when devices are available. At the moment, remote javascript debugging should also be enabled for storybook to work #3.
react-native run-ios
CMD+D
emulator -list-avds
emulator -avd MY_AVD_NAME
adb reverse tcp:8081 tcp:8081
adb reverse tcp:9001 tcp:9001
react-native run-android
adb shell input keyevent 82
adb reverse tcp:8081 tcp:8081
adb reverse tcp:9001 tcp:9001
react-native run-android
adb shell input keyevent 82
FAQs
A better way to develop React Native Components for your app
We found that @kadira/react-native-storybook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.