Design library for react-native
https://www.figma.com/file/8wxizvQ1u2RnV4WAaM1VuK/Host-App-Components
yarn add git+ssh://[email protected]:goibibo-labs/react-native-components.git
- Start using components
import { Text, Heading } from 'react-native-components';
- Clone the repository:
git clone https://github.com/goibibo-labs/react-native-components.git
- Move to project:
cd react-native-components
- Install dependencies:
yarn install
- Move to App folder:
cd RNComponents
- Install dependencies:
yarn install
- Start the Metro Server:
npx react-native start
- Run android app (in a separate terminal):
react-native run-android
You would be able to see all stories in App. If you wish to control navigation from Browser, you can follow below commands-
- Forward port 7007:
adb reverse tcp:7007 tcp:7007
- Star storybook server:
yarn storybook
This will open http://localhost:7007/ in Browser where you can see Navigator. Not that this will still show Preview on App & not on Web but from here you can control Navigator.
- Always declare
propTypes
&defaultProps
- Every container component must accept
style
prop - Always specify the underlying react-native element's proptypes and pass the
remainingProps
to it
Text.propTypes = {
...RNText.propTypes,
bold: PropTypes.bool,
dark: PropTypes.bool,
light: PropTypes.bool,
small: PropTypes.bool
};
return (
<RNText style={[...textStyles, style]} {...remainingProps}>
{children}
</RNText>
)
- Always specify the story of your component in Storybook with diverse variations: https://storybook.js.org/docs/react/writing-stories/introduction
- Define your own styles in storybook modules, do not pick styles from
GenericStyles