react native ui lib
7.34.0

UI工具集和組件庫,用於本機


下載我們的博覽會演示應用程序
(您將需要EXPO應用程序)或在設備[EXPO] EXP://exp.host/@vn.chemgio/rnuilib? Release-channel = Default中打開鏈接
請參閱此處的設置說明。
請參閱打破變化
請使用react-native-ui-lib
請使用react-native-ui-lib@^3.0.0
加載您的基礎和預設(顏色,版式,間距等...)
// FoundationConfig.js
import { Colors , Typography , Spacings } from 'react-native-ui-lib' ;
Colors . loadColors ( {
primaryColor : '#2364AA' ,
secondaryColor : '#81C3D7' ,
textColor : '##221D23' ,
errorColor : '#E63B2E' ,
successColor : '#ADC76F' ,
warnColor : '##FF963C'
} ) ;
Typography . loadTypographies ( {
heading : { fontSize : 36 , fontWeight : '600' } ,
subheading : { fontSize : 28 , fontWeight : '500' } ,
body : { fontSize : 18 , fontWeight : '400' }
} ) ;
Spacings . loadSpacings ( {
page : 20 ,
card : 12 ,
gridGutter : 16
} ) ;將默認配置設置為組件
// ComponentsConfig.js
import { ThemeManager } from 'react-native-ui-lib' ;
// with plain object
ThemeManager . setComponentTheme ( 'Card' , {
borderRadius : 8
} ) ;
// with a dynamic function
ThemeManager . setComponentTheme ( 'Button' , ( props , context ) => {
// 'square' is not an original Button prop, but a custom prop that can
// be used to create different variations of buttons in your app
if ( props . square ) {
return {
borderRadius : 0
} ;
}
} ) ;一起使用。您的配置將應用於Uilib組件上,因此您可以輕鬆地將它們與修飾符一起使用。
// MyScreen.js
import React , { Component } from 'react' ;
import { View , Text , Card , Button } from 'react-native-ui-lib' ;
class MyScreen extends Component {
render ( ) {
return (
< View flex padding-page >
< Text heading marginB-s4 >
My Screen
</ Text >
< Card height = { 100 } center padding-card marginB-s4 >
< Text body > This is an example card </ Text >
</ Card >
< Button label = "Button" body bg-primaryColor square > </ Button >
</ View >
) ;
}
} 請參閱貢獻指南