react-native-mdcore
Material Design for both Android and iOS. ThemeProvider
has to be set at root of component tree. All children components can access theme properties via context
. Features:
- Provide default theme properties for all material components.
- Easy to customize theme.
- Provide most of material components to build cross platform apps with consistent APIs.
Installation
npm install react-native-mdcore --save
Sample app
Checkout https://github.com/henrytao-me/react-native-workshop
Usages
Setup ThemeProvider
Use default theme:
{ return <ThemeProvider> <HomeComponent /> </ThemeProvider> }
Use custom theme:
cons CUSTOM_THEME = Theme { return <ThemeProvider theme=CUSTOM_THEME> <HomeComponent /> </ThemeProvider> }
Access theme:
static contextTypes = theme: PropTypesany { const theme = thiscontext return <View style= backgroundColor: themepaletteprimary > <Text palette="primary">Home</Text> </View> }
All-in-one place
All components are now in react-native-mdcore
that makes it easiest to remember and use.
{ return null }
License
Copyright 2017 "Henry Tao <hi@henrytao.me>"
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.