Giter Club home page Giter Club logo

Comments (7)

xotahal avatar xotahal commented on May 20, 2024 2

We could make some improvements in documentation. Make it "easy to read". Highlight the important things (like this one :))

from react-native-material-ui.

aktraore avatar aktraore commented on May 20, 2024

stupid of me :( should have really read the documentation, what an idiot

from react-native-material-ui.

KevinHu2014 avatar KevinHu2014 commented on May 20, 2024

@AbdoulayeKarimTraore
So what did you miss?
I have the same problem "Undefined is not an object (context.uiTheme.ActionButton)"
Any ideas?

from react-native-material-ui.

aktraore avatar aktraore commented on May 20, 2024

@KevinHu2014 all the components expect a uiTheme object to be present in the context, this is obtained by wrapping the component with à themeprovider component as described in the usage section of the readme, or even better wrapping the main component of your app with the themeprovider so that the uiTheme object is available in the context for all the over components, carefully read the readme, its not extremely evident at first glance, if you have further questions feel free to hl me, I'll post code snippets for you

from react-native-material-ui.

rsokz avatar rsokz commented on May 20, 2024

@aktraore Could you post a code snippet, please?

from react-native-material-ui.

luqmansungkar avatar luqmansungkar commented on May 20, 2024

Actually I stuck on the same problem and only notice the cause when I read @aktraore explanation. I read the readme but as @aktraore said it is not really clear that I should use wrap the component with ThemeProvider. Maybe highlight or explicitly write about it on the readme @xotahal ?

from react-native-material-ui.

aktraore avatar aktraore commented on May 20, 2024

@rostyys sorry for the delay, I must have missed the email, here is a snippet in which I wrap the main component of my app with a theme provider that's available to all the components, I'm using react-native-router flux for the routing and redux but that's not the main point, if you have any questions hl me

'use strict';

import React, { Component } from 'react';
import {
    StyleSheet,
    ScrollView
} from 'react-native';

import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { ActionCreators } from './redux/actions';

function mapDispatchToProps(dispatch) {
    return bindActionCreators(ActionCreators, dispatch);
}

import { Scene, Router, Actions } from 'react-native-router-flux';
import { ThemeProvider } from 'react-native-material-ui';
import StartingPage from './starting_page/StartingPage';
import Login from './login/Login';
import ShareComponent from './share/ShareComponent';
import HangoutList from './hangout/HangoutList';
import NewHangout from './hangout/NewHangout';
import Hangout from './hangout/Hangout';
import EventList from './event/EventList';
import EventParameter from './event/EventParameter';
import EventInvitation from './event/EventInvitation';
import NewEvent from './event/NewEvent';
import EventInfo from './event/EventInfo';
import EventLocation from './event/EventLocation';
import PlaceInfo from './place/PlaceInfo';
import EventDateTimePicker from './event/EventDateTimePicker';
import Menu from './menu/Menu';
import { I18n, constants } from './common/I18n';
import PersonList from './person/PersonList';
import ChoiceList from './place/ChoiceList';
import EventMembers from './event/EventMembers';
import SearchFriends from './friends/SearchFriends';
import Friends from './friends/Friends';

const scenes = Actions.create(
    <Scene key="root">
        <Scene key='startingPage' component={StartingPage} initial={true} animation={'fade'} hideNavBar={true} />
        <Scene key='login' component={Login} animation={'fade'} hideNavBar={true} />
        <Scene key='menu' component={Menu} animation={'fade'} hideNavBar={true}/>
        <Scene key='hangoutList' component={HangoutList}  animation={'fade'} hideNavBar={true} />
        <Scene key='hangout' component={Hangout} animation={'fade'}  hideNavBar={true} />
        <Scene key='newHangout' component={NewHangout} title={I18n.t(constants.NEW_HANGOUT)} animation={'fade'} hideNavBar={false} />
        <Scene key='eventList' component={EventList}  animation={'fade'} hideNavBar={false} />
        <Scene key='newEvent' component={NewEvent} title={I18n.t(constants.NEW_EVENT)} animation={'fade'} hideNavBar={false} />
        <Scene key='eventDateTimePicker' component={EventDateTimePicker} animation={'fade'} hideNavBar={false} />
        <Scene key='shareComponent' animation={'fade'} component={ShareComponent} />
        <Scene key='eventParameter' component={EventParameter} animation={'fade'} hideNavBar={false} />
        <Scene key='eventInvitation' component={EventInvitation} animation={'fade'}  hideNavBar={false} />
        <Scene key='eventInfo' component={EventInfo} animation={'fade'} hideNavBar={true} />
        <Scene key='eventLocation' component={EventLocation} animation={'fade'} hideNavBar={true} />
        <Scene key='eventMembers' component={EventMembers} animation={'fade'} hideNavBar={false} />
        <Scene key='placeInfo' component={PlaceInfo} animation={'fade'} hideNavBar={true} />
        <Scene key="personList" component={PersonList} animation={'fade'} hideNavBar={false}/>
        <Scene key="choiceList" component={ChoiceList} animation={'fade'} hideNavBar={false}/>
        <Scene key="searchFriends" component={SearchFriends} animation={'fade'}  hideNavBar={true}/>
        <Scene key="friends" component={Friends} animation={'fade'} hideNavBar={false} />
    </Scene>
);

class OutwegoApp extends Component {

    render() {
        return (
            <ThemeProvider uiTheme={uiTheme}>
                <Router
                    backAndroidHandler={() => false}
                    navigationBarStyle={styles.routerNavBar}
                    titleStyle={styles.routerNavBarTitle}
                    barButtonIconStyle={styles.routerBackButton}
                    scenes={scenes}
                />
            </ThemeProvider>
        )
    }
}

const uiTheme = {
    palette: {
        primaryColor: '#f38d11',
    },
    drawerSectionActiveItem: {
        container: {
            backgroundColor: 'transparent',
        }
    },
}

const styles = StyleSheet.create({
    routerNavBar: {
        backgroundColor: 'transparent',
        borderBottomColor: 'transparent'
    },
    routerNavBarTitle: {
        color: '#f38d11'
    },
    routerBackButton: {
        tintColor: '#f38d11'
    }

});

export default connect(() => { return {} }, mapDispatchToProps)(OutwegoApp);

from react-native-material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.