pijma
TypeScript icon, indicating that this package has built-in type declarations

2.4.12 • Public • Published

Велосипед над react-native

Равноправие

react-native

<View
  style={{
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    width: 200,
    height: 100,
    padding: 20,
  }}
/>

pijma

<View
  flex={1}
  alignItems="center"
  justifyContent="center"
  width={200}
  height={100}
  padding={20}
>

Адаптация

react-native

import React from 'react'
import { Provider, Theme } from 'pijma'

const Box = () => (
  <View
    style={view}
  />
)

const styles = StyleSheet.create({
  view: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    width: 200,
    height: 100,
    padding: 20,
  },
})

const stylesLarge = StyleSheet.create({
  view: {
    width: 400,
    height: 200,
  },
})

let view = styles.view

if (Dimensions.get('window').width > 400) {
  view = StyleSheet.compose(stylesLarge.view)
}

pijma

import React from 'react'
import { Provider, Theme } from 'pijma'

const Box = () => (
  <View
    flex={1}
    alignItems="center"
    justifyContent="center"
    width={[200, 400]}
    height={[100, 200]}
    padding={20}
  />
)

const theme: Theme = {
  breakpoints: [600, 1240],
}

const App = () => (
  <Provider theme={theme}>
    <Box />
  </Provider>
)

/pijma/

    Package Sidebar

    Install

    npm i pijma

    Weekly Downloads

    0

    Version

    2.4.12

    License

    MIT

    Unpacked Size

    245 kB

    Total Files

    498

    Last publish

    Collaborators

    • antongolub
    • qiwibot