0.0.38 • Published 9 months ago

react-native-pbb v0.0.38

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

react-native-components

RN 组件库

安装

$ yarn add react-native-components $ cd ios && pod install

组件

import { Alert,Button,... } from "react-native-components";

<Alert />
<Button />
<Card />
<Cascade />
<Container />
<Context />
<Drawer />
<Empty />
<Fade />
<FadeImage />
<Form />
<GradientButton />
<Icon />
<ListView />
<Loading />
<NavigationBar />
<PageControl />
<PickCard />
<SearchBar />
<Segment />
<StatusBar />
<TabBar />

样式

import { cs } from "react-native-components";

//内置样式,如下,x1表示4*1,且经过缩放
//缩写规则为单词首字母拼写,下划线_后面跟的是值

cs.mt_x1 //{ marginTop:scale(4) }
cs.pt_x2 //{ paddingTop:scale(4)*2 }
cs.fd_r //{ flexDirection:'row' }
cs.ai_c //{ alignItems:'row' }

//使用如下,好处在于不再需要为每个组件创建样式名称。
//但不利于阅读,需要熟悉
<Button style={[cs.mt_x1,cs.pt_x2,cs.fd_r]}
...

主题 provider

import { ThemeProvider ,useThemeAwareObject,Theme } from "react-native-components";

//推款和选款配置
<ThemeProvider initial={ThemeVogue}>
  <Navigation />
</ThemeProvider>

//受主题色影响的组件如下获得主题色并配置颜色
const createStyle =(theme:Theme)=>{
  const styles =StyleSheet.Create({
   button:{
     color:theme.color
  })
}

//然后再组件中是用hook创建style
const styles = useThemeAwareObject(createStyle)

权限 provider

import { PermissionProvider ,Permission } from "react-native-components";

//App.tsx
<PermissionProvider permissions={['1100','1101']}>
  <Navigation />
</PermissionProvider>


//需要权限控制的组件
<Permission permissionId='1100'>
 <Button />
</>

颜色

import { Color } from "react-native-components";

Color.primary
Color.normal
Color.secondary
Color.unimportance
Color.separator
Color.background
...
0.0.37

10 months ago

0.0.38

9 months ago

0.0.36

10 months ago

0.0.35

10 months ago

0.0.34

11 months ago

0.0.33

11 months ago

0.0.32

11 months ago

0.0.31

11 months ago

0.0.30

11 months ago

0.0.29

11 months ago

0.0.28

11 months ago

0.0.27

12 months ago

0.0.26

12 months ago

0.0.25

12 months ago

0.0.24

12 months ago

0.0.23

12 months ago

0.0.22

12 months ago

0.0.21

12 months ago

0.0.20

12 months ago

0.0.19

12 months ago

0.0.18

12 months ago

0.0.17

12 months ago

0.0.16

1 year ago

0.0.15

1 year ago

0.0.14

1 year ago

0.0.13

1 year ago

0.0.12

1 year ago

0.0.11

1 year ago

0.0.10

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago