acrn
acrn copied to clipboard
An Accessibility First Component Library for React Native
acrn-rn
An accessibility first component library and development environment for React Native.
Features
- Customizable accessibility presets for indiviual components, as well as containers designed to provide standalone accessible experiences.
- Works on both iOS and Android
- Sandbox Expo based Storybook environment for developers to build and test components
- Preconfigured tools to create and package your own component library
Try it Out
git clonethis respository andyarn install- Run
yarn storybookto launch the Storybook server - Run
yarn web,yarn ios, oryarn androidto launch the Storybook app in Expo and begin building or testing components
Using the Components
- Simply
npm install acrn-rnin your React Native project and import any of the components or containers listed innode_modules/acrn-rn/src/index.tsx
Building and Demoing Your Own Components
- Create a folder for your component in the
srcdirectory - To view your components in Storybook, create a
stories.tsxfile for your component in/storybook/stories/and import it in/storybook/stories/index.js - If you plan on importing your components into other projects, create an entry for your component in
/src/index.tsx. You can then useyarn prepareto build yoursrcdirectory for CommonJS, ES modules, and Typescript, configuring the"react-native-builder-bob"field in yourpackage.jsonas needed
Testing Your Components with Jest
- create a
__tests__subdirectory in the directory containing your component and place atest.tsxfile inside - simply run
yarn testoryarn test <your-test-file>to execute the tests in your__tests__directories
Configuring Your Expo App
- Adjust any fields in
app.jsonto configure your expo app as needed. - Keep in mind that
"entryPoint"must be specified in order to prevent Expo's default behavior, which attempts to launch from the"main"field in yourpackage.json- The default entrypoint provided by
expo-initis./node_modules/expo/AppEntry.js, which will attempt to look for anApp.tsxfile in the root directory of your project
- The default entrypoint provided by