Git Product home page Git Product logo

react-native-paper's Introduction

react-native-paper

Material design for React Native.
reactnativepaper.com


Greenkeeper badge

Build Status Version MIT License All Contributors PRs Welcome Chat Sponsored by Callstack

React Native Paper is the cross-platform UI kit library containing a collection of customizable and production-ready components, which by default are following and respecting the Google’s Material Design guidelines.

Getting Started

Refer to the getting started guide for instructions.

Documentation

Check the components and their usage in our documentation.

Features

Try it out

🧑‍💻 Run the example app with Expo to see it in action. The source code for the examples are under the /example folder.

📲 You can also try out components in our demo apps available in the both stores Android and iOS.

Contributing

Read the contribution guidelines before contributing.

Figma and Sketch component kits

Use official component kits provided by Material Design.

Made with ❤️ at Callstack

react-native-paper is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. Callstack is a group of React and React Native geeks, contact us at [email protected] if you need any help with these or just want to say hi!

Like the project? ⚛️ Join the team who does amazing stuff for clients and drives React Native Open Source! 🔥

Contributors

Thanks goes to these wonderful people (emoji key):

Satyajit Sahoo
Satyajit Sahoo

🤔 💻 📖
Ferran Negre
Ferran Negre

🤔 💻
Dawid
Dawid

🤔 💻 📖
Kacper Wiszczuk
Kacper Wiszczuk

🤔 💻
Luke Walczak
Luke Walczak

💻 📖
Ahmed Elhanafy
Ahmed Elhanafy

🤔 💻
K. P. Sroka
K. P. Sroka

💻 📖
Iyad Thayyil
Iyad Thayyil

💻 📖
Julian Hundeloh
Julian Hundeloh

💻 📖
Grzegorz Gawrysiak
Grzegorz Gawrysiak

💻 📖
Luís
Luís

💻
Rajendran Nadar
Rajendran Nadar

💻
Brent Vatne
Brent Vatne

💻
Jakub Beneš
Jakub Beneš

💻
Paweł Szymański
Paweł Szymański

💻 📖
Kuba
Kuba

💻 🤔
jbinda
jbinda

💻 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

react-native-paper's People

Contributors

ahmedlhanafy avatar brunohkbx avatar dependabot[bot] avatar dimitarnestorov avatar drakeoon avatar esemesek avatar ferrannp avatar gawrysiak avatar gedu avatar greenkeeper[bot] avatar haxonadora avatar hurali97 avatar imgbot[bot] avatar iyadthayyil avatar jaulz avatar jaworek avatar jayu avatar jbinda avatar lukewalczak avatar olimpiazurek avatar pan-pawel avatar raajnadar avatar rafikitiki avatar richardlindhout avatar satya164 avatar taym95 avatar thymikee avatar tjaniczek avatar trancever avatar unikvozm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-paper's Issues

Portal

Description

Elements like FAB and Snackbar render on a different plane above the content in z-axis. Many other elements such as bottom sheets, modals etc. need to be rendered above content too. It'll be useful to have a single Portal component to handle these cases.

To determine which elements exist on which plane, we need to refer to their elevation - https://material.google.com/material-design/elevation-shadows.html#elevation-shadows-elevation-android

Use cases

  • Elements with same elevation should be grouped in the same layer along the z-axis (e.g. FAB, Snackbar)
  • Grouped elements should move together, e.g. when a Snackbar slides in from button, the FAB should move up

Detailed design

Props

The Portal component will accept two props, elevation and layered.

The elevation prop determines the elevation of the layer in the z-axis. There will be predefined elevations for internal use according to material design guidelines:

const Elevations = {
  DIALOG: 24, // Dialogs and Pickers
  DRAWER: 16, // Drawer, Bottom sheet
  FAB_RAISED: 12, // Floating action button (raised)
  CARD_RAISED: 8, // Card (raised), Button (raised), Bottom navigation, Menu
  FAB_RESTING: 6, // Floating action button, Snackbar
  APPBAR: 4, // Floating action button, Snackbar
  CARD_RESTING: 2, // Card, Button, Search bar
}

This is not the full list of elevations, rather the ones we need. Naming is up-to-debate. This will be internal for now, so we can change them later.

The layered prop is a boolean which determines whether the item is grouped with other layered items in a single layer. Grouped items are rendered under the same View and positioned using flexbox, so items will appear one below another. When the layered prop is false or not passed, the items will be positioned absolutely instead. Non-layered items will render below layered elements.

Usage

<Portal elevation={Elevations.FAB_RESTING} layered>
  <View style={styles.snackbar}>
    Hey! I'm a `Snackbar` :)
  </View>
</Portal>

Animations

The main motivation behind this is animations, i.e. when you show a new Snackbar, it should slide in from the bottom and move everything else up (FAB). The easiest way seems to be to handle the animation inside Portal. This is how it'll work:

  1. On initial render, render everything normally.
  2. When a new element is rendered later, render it offscreen and measure the height ({ position: 'absolute', left: 0, right: 0, bottom: -9999 }).
  3. Now render the element normally, but also apply a translateY of height to all the elements. This should have no visual difference.
  4. Animate the translateY to 0 so everything moves up.
  5. When the element is removed, animate the translateY to height so everything moves down.
  6. Now remove that element and reset the translateY to 0
  7. If new elements are added/removed mid-transition, it'll wait till the transition is complete to reflect the changes.

This approach assumes that all the elements in a layer are going to use the same slide up/slide down animations for appearing/disappearing.

Touchable

Cross-platform touchable component that implements ripple effect. In Android we will use TouchbaleNativeFeedback in IOS we need to bridge a native library or implementation

Prepare a nice/bigger example

Our current example is good to see all the components we build but I think it would be nice to create an extra more complex example where all material patterns can shine.

Layer

To have consistent styling on Android and iOS we need Layer component (have a better name?) which takes an elevation prop and renders a View with correct shadows on both Android and iOS.

We'll need this before working on any component with shadows.

Unexpected Token Error in src/index.js

I just imported from react-native-paper and this happened:

<path-to-project>/node_modules/react-native-paper/src/index.js: Unexpected token (6:9) at index.js:6:9

Seems like this line is the culprit:

export * as Colors from './styles/colors';

I fixed it by adding installing babel-plugin-transform-export-extensions and adding transform-export-extensions babel plugin in my .babelrc.

Shouldn't this plugin be added as default?

Versions

  1. react-native: 0.37.0.
  2. react-native-paper: 0.0.2 (Latest master also has the issue)

Dark theme

We'll add a property called dark: boolean in the theme object to signal that it's dark theme so component's can adjust their appearance based on it.

The guidelines have things like different opacity based on if the theme is light or dark, so we need this property. Almost all components need to be changed to support dark theme.

Card not displaying

Here's my code,

<Card>
  <Card.Content>
    <Title>The Ocean<Title>
    <Paragraph>Singin' in the sunshine, laughing in the rain.</Paragraph>
  </Card.Content>
</Card>

Doesn't get displayed. Went in the code, saw that both the wrapping TouchableWithoutFeedback and theView inside, has flex: 1. flex: 1 inside TouchableWithoutFeedback doesn't display content.

I removed flex: 1 for the view inside and sure enough, everything started working. What do you guys think?

Drawer

MD Docs Link
For this component, we need to have different components for items and groups of items we may implement an API similar to the Android native in android support library link

Switch

MD Docs Link
I don't know if we should implement this in JS or to look for a library in IOS and use the default Android one

Using flow over `propTypes`

The contributing guide as well as the current files use and mention propTypes. Is that going to be our preferred approach or shall we favour Flow types instead?

Improve documentation

  • Improve the design @satya164
  • Include examples in the description
  • Include screenshots
  • Preserve scrolling when selecting different option

Improve documentation generation

These are potential improvements to the docs generation process

  • Show info regarding required/optional props
  • Support markdown in documentation
  • Add ability to document and link to a type definition, e.g. Theme
  • Add quick search in sidebar
  • Sections with headers
  • Support mobile layout

Write a Babel plugin to update imports

We should write a babel plugin to change import statements from

import { Button, Divider } from 'react-native-paper';

to

import Button from 'react-native-paper/src/components/Button';
import Divider from 'react-native-paper/src/components/Divider';

This will help to avoid importing components we don't use and will make the bundle smaller.

GridView

A responsive GridView is extremely useful in apps.

Remove the drawer component

Remove the drawer component and export its content, in order to maintain compatibility with react-navigation and to make it work nicely with any drawer library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.