Git Product home page Git Product logo

panza's Introduction

panza

Panza is a collection of ui-components for react-native modelled after iOS.

This library is currently undergoing a rewrite and will be updated soon along with new documentation.

Getting Started

$ npm i panza --save
$ npm i react-native-vector-icons --save
$ rnpm link react-native-vector-icons

Components

Inputs

Rows

Navigation

Pages

Buttons

Text

Images

Icons

  • Icon
  • TouchableIcon
  • PlusIcon
  • ArrowRightIcon
  • CloseIcon
  • BackIcon
  • SearchIcon
  • MoreIcon

Base Components

Customize

You can override parts of the global configuration to provide custom colours, font sizes, scales, etc.

import { config } from 'panza'

class App extends React.Component {

  static childContextTypes = {
    panza: PropTypes.object
  }

  getChildContext() {
    panza: this.state.styles
  }

  state = {
    styles: {
      colors: Object.assign(
        {},
        config.colors,
        { primary: config.colors.red } // change the primary color from blue to red
      )
    }
  }

  // ... render your app
}

Example

You can install the example application contained within this repository.

$ git clone https://github.com/bmcmahen/panza.git
$ cd panza && npm install
$ react-native run-ios
$ react-native run-android

License

MIT

panza's People

Contributors

bmcmahen avatar levito avatar meta-dreamer 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

panza's Issues

InputGroup with single child

  • bottom borders of single child is shown if there's only one child
  • the name suggests a narrower function than it actually provides

Failed propType: Invalid props.style key `fontSize` supplied to `Picker`.

Getting warnings using InputPicker

<InputGroup label='Tracking' inset={16} backgroundColor='white'>
                        <InputPicker expanded={this.state.focusPicker}
                            value={this.state.tracking}
                            label='Idle tracking'
                            onToggleExpansion={() => {
                            this.setState({ focusPicker: !this.state.focusPicker })
                        }}>
                        <Picker
                            prompt='Select a Idle tracking'
                            style={{ width: 300 }}
                            selectedValue={this.state.tracking}
                            onValueChange={(lang) => this.setState({ tracking: lang })}>
                              <Picker.Item label='Aggressive' value='0' />
                              <Picker.Item label='Calm' value='1' />
                        </Picker>
                        </InputPicker>
                    </InputGroup>

Gives the following error in console

Bad object: {
  "padding": 0,
  "fontSize": 17,
  "width": 300
}
Valid keys: [
  "width",
  "height",
  "top",
.....
] Check the render method of `Picker`.

test various underlayColor options

For instance, if I have a backgroundColor: transparent, darken doesn't work. Also ensure that we can provide a custom underlayColor prop in these circumstances.

InputRow. default value is not set.

Hello using panza 3.0.0-beta-1 on android. Having some issues with InputRow
InputRow default preloaded value "ssss" is not set, onChangeText works though and normal Input works fine.

  <InputRow
            value={'ssss'}
            onChangeText={() => false} />

Other issues: There are difficulties on styling label, especially if InputRow is not vertical. It's just small bold text.

I guess this project is dead

master has bugs

v3 is completely different from v2, rewriting config by context doesn't work on v3. Only temp fix is using panza prop.

Examples folder contains examples for v3 and master, when readme covers v2.

InputToggle's onTintColor doesn't work. And a lot more small details I didn't cover.

It's a pity, cause I really like the idea of customizable stateless components.

v3 bugs

  • Add Item label appears unevenly when condensed
  • ItemGroup showBottomBorder={false} also removes Dividers
  • Something in the NavBar sets color='#111' to a non-text element.

panza-future ideas

  • Allow users to supply their own prop -> style conversion functions, perhaps using a plugin architecture of some sort.
  • Make themes responsive -- i.e., when the theme changes, perform setState on our HOC.

inverted option

Base should accept an inverted prop, that uses an inverted color scheme provided by our config. This will be useful when building menus or writing text over a dark background (or, conversely, over a white background if the predominant theme is dark).

refactor removableInput

it can be broken up into multiple smaller components which would be useful independently of this module

panza org

if this project becomes something bigger & better, and there are significant contributors like @HammadJ this repo should probably be moved from my namespace to its own org.

Fix Documentation Generation

trying to run generate-docs script right now gives errors because of multiple exports in some components (Icon) and also because its trying to read the index.js files. Not too familiar with how react-docgen is setup and works.

generate-doc-json:

Error with path "components/panza/RowInput/RemovableInput.js": Error: Multiple exported component definitions found.
Error with path "components/panza/Text/index.js": Error: No suitable component definition found.

generate-doc-markdown:

Error: ENOENT: no such file or directory, open '/Users/hammadjutt/Dev/panza/scripts/../documentation/components/panza/RowInput/RevealingRow.js.md'

How to call focus() for a InputRow

The usual way I do this is by calling this.refs.myInput.focus(), being the myInput a focusable element, like the normal TextInput.

As this are stateless components there is no way to attach a ref. Is there another way to focus the Input?

Component list discussion

We can keep track of what components we feel should make the cut, here.

Elements

  • Base
  • Text
  • Button
  • Icon
  • Divider
  • Input
  • Image - Fade on load, circular, width & height, cover as default resizeMode
  • Loading
  • CheckMark - a with toggle on / off state.

Views

  • InputGroup
  • TouchableRow
  • InputRow
  • InputExpandable
  • InputToggle
  • InputDatePicker
  • SectionHeader
  • TouchableInput (Rethink the difference between TouchableRow & TouchableInput)
  • ErrorPage
  • NavBar
  • NavTitle
  • NavTouchableText
  • NavTouchableIcon
  • SubNav
  • Card, CardHeader - a simple card, much like that provided by material design.
  • Grid - Wrapper around listview to make grids easier
  • ButtonGroup - Deprecate VerticalButtonGroup. Allow groups of 2, or 3, with centered attributes.

Modules

  • TabView - like that provided by material design.
  • Popup - Generic Popup (Modal?)
  • PopupMenu - Pop up menu component -- similar to ActionSheet, but cross-platform.
  • ProgressBar - indicates progress, alternative to loading indicator
  • ImageSwiper - component that takes an array of image sources and creates a horizontal, paged swiper/carousel
  • ProgressiveImage - component that renders a default image (low res, could be blurred) and smoothly transitions to the high res image once it's loaded.

InputDatePicker won't show - React Native android

image

<ModalInput
value={dof}
label='Birthday'
modalId='personal_birthday'
placeholder={dof}
loading={loadingMemberInfo}
onDone={() => {
const date = moment(this.state.form.date).format('YYYY-MM-DD')
editMemberInfo('dof', date, 'personal_birthday')
}}
>
<InputDatePicker
expanded={this.state.focusDate}
date={this.state.form.date}
editable={this.state.focusDate}
value={moment(this.state.form.date).format('MMMM DD YYYY')}
onDateChange={this.handledate}
label='Birthday'
onToggleExpansion={() => {
LayoutAnimation.spring()
this.setState({ focusDate: !this.state.focusDate })
}}
/>
</ModalInput>

https://github.com/panza-org/panza/blob/master/documentation/InputDatePicker.md

border shorthand

I'm always manually adding style={{ borderTopWidth: 1, borderTopColor: '#eee' }}

we should have a border shorthand like bt, by, ie., like padding, margin.

Text "g" rendering on Android

I am using v3 of panza.
Text component doesn't render "g" as it should on android device.
And text in buttons is not centered vertically, now i have paddingBottom: 5 as a temp fix

screenshot_2016-09-05-13-15-47

Object.freeze can only be called on Objects

Object.freeze can only be called on Objects is thrown on SubNav.js:93:0.

Since styles is not used at all, it should be removed. This also fixes the bug.

I'm running master with react-native 0.27 on an android simulator.

Allow customization of config without root context

supplying a context from the app root isn't always an option in react native (i.e. when using multiple roots) and the current way of setting up the custom config options is pretty messy (relies on user remembering to Object.assign to default config).

I propose we have something like this where the user can call once anywhere in their application:

import panza from 'panza'

panza.configure({
  colors: {
    primary: '#505050',
    customColor: '#123456'
  }
})

Also, I think we should change how the size configs work. Instead of arrays, we should have objects with keys:

const fontSizes = {
  1: 48,
  2: 32,
  3: 24,
  4: 20,
  5: 17,
  6: 15,
  7: 12
}

This way users will be able to customize the font/line-height/scale configurations easier

Let me know what you think and I can put something together sometime soon.

ErrorPage `message` prop never used

The ErrorPage component does not respect the message property.

Looks like the value is just hard-coded in the component:

see components/panza/Pages/Error.js:

  render () {

    const {
      error,
      retry,
      message,
      isOffline,
      children,
      offlineMessage,
      detailMessage,
      ...other
    } = this.props

    return (
      <Base baseStyle={styles.container} {...other}>
        <View style={styles.messageContainer}>
          <Base pb={2}>
            <LargeText light textAlign='center'>
              Hmm, loading appears to be taking a while.
            </LargeText>

Development status?

Hi there,
First, thanks for the amazing work! I was looking forward to a Rebass equivalent on RN and Panza seems to be an amazing library.
I'm wondering what's the status of this library. Is there a roadmap somewhere?

consistent sizing

use 'tiny', 'small', 'large', 'giant' sizing consistently across components

Performance discussion

I was testing performance with react-perf-tools yesterday and if I hadn't already optimized the container components with shouldComponentUpdate and immutable data, the Base > View took up the majority of wasted render time (calculated using Perf.printWasted()). This becomes a significant problem especially when you use the Base component everywhere as a replacement for View because of the nice syntax.

Here are the options we have that I could think of right off the bat:

  • shouldComponentUpdate
  • memoize calculation functions in Base (margins, paddings, colorStyle, radii, underlay). lodash memoize should work like a charm
  • create a separate component that is more stripped down and light-weight as a replacement for View instead of having to use Base, but would still support the nice layout syntax (mt, p, flex, etc)

shouldComponentUpdate might help the situation, but could also make it even slower since it's an extra function that needs to be called on every base component. Will have to do some more testing to verify if it would help, but even if it would we shouldn't resort to using it if we don't have to. The library should be as performant as possible and we should leave the advanced tuning with things like shouldComponentUpdate to the user.

I think if the memoization works well the second point woudn't even be necessary. I'll try doing some benchmarking and see what combination of the options above works best

React-Native-Web support

I've been looking for a UI kit for react native and this project seems very promising.
Do you know if it supports react-native-web out of box currently?
If not, do you have any plans to do so?

v3

  • support react-native-web out of the box
  • add date-picker, toggle for the web
  • create native version of RevealableRow
  • border short-hand
  • refactored Base component, with improved performance
  • invert option
  • refactor config styling api
  • centralized config for all of the components
  • fontWeights as an object
  • consolidate sizing
  • merge Text into TextBase
  • custom props for sizes using custom validator
  • more tests, especially for Base, TextBase, theming, hoc
  • comb through all the old code

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.