Code Monkey home page Code Monkey logo

Comments (6)

MikaelCarpenter avatar MikaelCarpenter commented on June 29, 2024

Where would you like to pass it the onChange from? You can do it when you push to the screen with the search bar using this.props.toRoute({ passProps: { onChange: *whatever you want* } })

from gb-native-router.

davide-scalzo avatar davide-scalzo commented on June 29, 2024

My understanding was that passprops would pass the props to the new component, not the titleComponent?

I'll give it a shot tonight then.

Ps, I simply edited the flex amount of the titleComponent in your library to stretch it :)

On 19 Oct 2015, at 02:03, Mikael Carpenter [email protected] wrote:

Where would you like to pass it the onChange from? You can do it when you push to the screen with the search bar using this.props.toRoute({ passProps: { onChange: whatever you want } })


Reply to this email directly or view it on GitHub.

from gb-native-router.

webwelten avatar webwelten commented on June 29, 2024

How would you pass Props in an InitialRoute to the TitleComponent?

from gb-native-router.

davide-scalzo avatar davide-scalzo commented on June 29, 2024

Sorry @webwelten it's not documented well. It would use the same approach as this.props.setRightProps or this.props.setRightProps rather than doing it in a route.

from gb-native-router.

webwelten avatar webwelten commented on June 29, 2024

How does it work? I didn't understand it as well.

from gb-native-router.

davide-scalzo avatar davide-scalzo commented on June 29, 2024

Say I call the Main component

renderMain: function () {
    var firstRoute = {
      name: 'Welcome!',
      component: Main,
      titleComponent: Search,
    };

    return (
      <Router
      firstRoute={firstRoute} />
    );
  }

then on Main.js

var Main = React.createClass({

    componentWillMount: function () {
        this.props.setTitleProps({
            onChange: this.onChange
        });
    },

    render: function () {
....
    }
});

from gb-native-router.

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.