Giter Site home page Giter Site logo

Comments (11)

chirag04 avatar chirag04 commented on July 19, 2024

I'm on vacation till 28th Dec. I will update this on 29th. Happy to accept a PR.

from react-native-tooltip.

eyaleizenberg avatar eyaleizenberg commented on July 19, 2024

This fork has done it already:
https://github.com/taskrabbit/react-native-tooltip

On Wed, Dec 23, 2015 at 6:19 AM Chirag [email protected] wrote:

I'm on vacation till 28th Dec. I will update this on 29th. Happy to accept
a PR.


Reply to this email directly or view it on GitHub
#5 (comment)
.

from react-native-tooltip.

chirag04 avatar chirag04 commented on July 19, 2024

@jrichardlai seems like you made some interesting changes in your fork. Seems like you tweaked the JS api as well. can you describe the changes here and eventually merge the two codebases if it works out?

from react-native-tooltip.

jrichardlai avatar jrichardlai commented on July 19, 2024

@chirag04 I have done some update to the api yes. Thank you for this library it is really useful.
The use case I was trying to do was mosty having a long press on a view and being able to copy it.

screen shot 2015-12-23 at 8 42 18 am

I wanted it to be able to create a tooltip on any element, you can put the tooltip around View and Image.

I also wanted to make only one component to use. And it seemed easier in our case to just pass down directly the callback instead of checking the value of the text clicked.

For example you could do this:

class Message extends React.Component {

  handleCopyPress = () => {
    Clipboard.set('Something something');
  }

  handleSendSMSPress = () => {
    alert('Sending SMS');
  }

  render() {
    return (
      <ToolTip
        actions={[
          {text: 'Copy', onPress: this.handleCopyPress},
          {text: 'Send By SMS', onPress: this.handleSendSMSPress},
        ]}
        underlayColor={cssVar('trGreen10')}
        longPress={true}
      >
        <Text>Something something</Text>
      </ToolTip>
    );
  }
}

I removed the ToolTipText component, since it was redundant with the Tooltip but I can keep it and make a PR if you'd like.

from react-native-tooltip.

eyaleizenberg avatar eyaleizenberg commented on July 19, 2024

@jrichardlai For some reason you fork doesn't work for me in RN 0.17
I am hit with: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object

This is my code:

<ToolTip
  actions={[
    {text: 'x', onPress: () => console.log("X") }
    {text: 'y', onPress: () => console.log("Y") }
  ]}
  underlayColor={'blue'}
  style={textElements.selectedName}
>
  <Text>
    {user.name}
  </Text>
</ToolTip>

it seems that in your ToolTop.ios.js file you need to write in the end: module.exports = ToolTipText

Sorry for posting this here but I couldn't find the 'issues' tab in your fork

from react-native-tooltip.

jrichardlai avatar jrichardlai commented on July 19, 2024

@eyaleizenberg thanks let me fix this :)

from react-native-tooltip.

jrichardlai avatar jrichardlai commented on July 19, 2024

@eyaleizenberg seems to work fine for me, I added an Example App you can take a look

from react-native-tooltip.

jrichardlai avatar jrichardlai commented on July 19, 2024

@eyaleizenberg @chirag04 any news?

from react-native-tooltip.

 avatar commented on July 19, 2024

@jrichardlai, @chirag04, I think the changes jrichardlai made are great additions to the component. I would suggest merging the changes back into the main project, although I would keep things ES5 compatible like it is today. Any objections?

from react-native-tooltip.

chirag04 avatar chirag04 commented on July 19, 2024

No objections. @jrichardlai @sevachb Can one of you PR?

from react-native-tooltip.

chirag04 avatar chirag04 commented on July 19, 2024

we merged the two codebases. It should be fixed on master now.

from react-native-tooltip.

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.