Giter Site home page Giter Site logo

Comments (9)

sergiop avatar sergiop commented on June 8, 2024 1

@rushilshah1 just released with version 1.4.0. 😉

from react-giphy-searchbox.

rushilshah1 avatar rushilshah1 commented on June 8, 2024 1

wohoo! Thanks @sergiop!

from react-giphy-searchbox.

sergiop avatar sergiop commented on June 8, 2024

Hi @rushilshah1, what's the purpose of managing the search text via prop instead of letting the user set it through the input field? Do you need to set a default query on component initialization?

from react-giphy-searchbox.

rushilshah1 avatar rushilshah1 commented on June 8, 2024

@sergiop - It is more for accessing the user query outside of the react-giphy-searchbox component. Similar to the onSelect callback which returns a Gif object, if that or some other prop could return the search query it can be used/displayed outside of the react-giphy-searchbox component.

from react-giphy-searchbox.

sergiop avatar sergiop commented on June 8, 2024

@rushilshah1 ah... ok! I've completely misunderstood your request, sorry. 🙂
Nice idea, we can call it onSearch and it will receive the searched text as a parameter, like this.

onSearch={
  text => console.log('Searched text', text)
}

What do you think?

from react-giphy-searchbox.

rushilshah1 avatar rushilshah1 commented on June 8, 2024

@sergiop sounds good to me! Thank you 😄

from react-giphy-searchbox.

sergiop avatar sergiop commented on June 8, 2024

@rushilshah1 I just added the feature in this PR, it was pretty simple. Please feel free to give it a try leaving your feedback. In the meantime maybe I can write some tests to run inside the CI.

from react-giphy-searchbox.

rushilshah1 avatar rushilshah1 commented on June 8, 2024

@sergiop Appreciate the quick turnaround! What would be the easiest way for me to try it out since it is not a new package version on npm just yet?

from react-giphy-searchbox.

sergiop avatar sergiop commented on June 8, 2024

To test:

Way 1:
you can fork or simply clone this repo, check out the feature/on-search-callback branch, run yarn install and yarn start. Once the project is running, you can open the demo page on http://localhost:3000/, adding the new callback on demo/src/index.js.

Way 2 (maybe simpler):
if you have already installed this library on a project, change your package.json from this:

"dependencies": {
  "react-giphy-searchbox": "^1.3.0"
}

to this:

"dependencies": {
  "react-giphy-searchbox": "git+ssh://[email protected]:sergiop/react-giphy-searchbox.git#62ad4e4"
}

(where #62ad4e4 is the hash related to the changes I just made) and run yarn install or npm install.

Otherwise, if you can wait a couple of days, I'll release the feature! 😉

from react-giphy-searchbox.

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.