material-components-react-native
React Native wrapper for material-components-ios from Google
Roadmap
- FlatButton, RaisedButton, ActivityIndicator, ProgressView,
- Card, Chip, ShadowLayer
- FloatingButton, Slider, Snackbar
- FeatureHighlight, Ink,
- ButtonBar
- Wrap controller API's like Collection and Navigation.
- Allow composing different many components like
Chip
intoTextField
.
TODO:
- Code Lint
- Testing
- Switch to TypeScript
- Rename ios project from
RNMaterialComponents
toRNMDC
. - Group components to folders.
Getting started
$ npm install material-components-react-native --save
Mostly automatic installation
$ react-native link material-components-react-native
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜material-components-react-native
and addRNMDC.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNMDC.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
Not yet available.
Run example for development
git clone git@github.com:birkir/material-components-react-native.gitcd material-components-react-nativeyarn linkcd exampleyarn link react-native-material-componentscd iospod installcd ..react-native run-ios
Documentation
FlatButton
; <FlatButton enabled=true // default true uppercaseTitle=false // default true hitAreaInsets= top: 0 left: 10 right: 0 bottom: 0 disabledAlpha=07 customTitleColor="orange" // deprecated underlyingColorHint="black" hasOpaqueBackground=true inkMaxRippleRadius=128 inkStyle="bounded" // You can select "bounded" or "unbounded" inkColor="blue"> Button content</FlatButton>
RaisedButton
; <RaisedButton enabled=true // default true uppercaseTitle=false // default true hitAreaInsets= top: 0 left: 10 right: 0 bottom: 0 disabledAlpha=07 customTitleColor="orange" // deprecated underlyingColorHint="black" inkMaxRippleRadius=128 inkStyle="bounded" // You can select "bounded" or "unbounded" inkColor="blue"> Button content</RaisedButton>
Card
; <Card style= flex: 1 cornerRadius=16 shadowElevation=8 borderWidth=2 borderColor="blue"> <View> <Text>Sub view</Text> </View></Card>
ProgressBar
; <ProgressBar style= height: 30 progress=075 progressTintColor="orange" trackTintColor="black"/>
TextField
; let fieldRef; <TextField ref= { fieldRef = ref; } style= height: 50 enabled=true // default true hidesPlaceholderOnInput=true // default true placeholder="Placeholder text" text="Set your own text" textColor="blue" textInsets= left: 10 top: 5 right: 0 bottom: 0 onChange= console onChangeText= console onFocus= console onBlur= console/> fieldRef;fieldRef;fieldRef;