[BREAKGLASS] Append-only mirror of github.com/bluewallet/react-native-tooltip
Go to file
2015-12-10 23:08:29 +05:30
ToolTipMenu Remove RCTSparseArray 2015-12-08 12:06:36 -08:00
ToolTipMenu.xcodeproj min deployment target 2015-10-26 11:39:05 -04:00
ToolTipMenuTests min deployment target 2015-10-26 11:39:05 -04:00
.flowconfig inital commit 2015-05-18 23:07:42 -04:00
.gitignore inital commit 2015-05-18 23:07:42 -04:00
package.json fix analyzer warnings 2015-11-18 16:29:07 -05:00
README.md update exports 2015-05-18 23:51:07 -04:00
screenshot.png inital commit 2015-05-18 23:07:42 -04:00
ToolTipText.android.js add android warning 2015-05-18 23:34:14 -04:00
ToolTipText.ios.js use composition for extending text.js 2015-08-22 22:51:07 -04:00

react-native-tooltip

A react-native component from displaying tooltip. Uses UIMenuController.

Add it to your project

  1. Run npm install react-native-tooltip --save
  2. Open your project in XCode, right click on Libraries and click Add Files to "Your Project Name" (Screenshot) then (Screenshot).
  3. Add libRNToolTipMenu.a to Build Phases -> Link Binary With Libraries (Screenshot).
  4. Whenever you want to use it within React code now you can: var ToolTipText = require('react-native-tooltip');

Example

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  TouchableHighlight,
  PixelRatio,
  View,
} = React;

var ToolTipMenu = require('NativeModules').ToolTipMenu;
var ToolTipText = require('react-native-tooltip');

var tooltip = React.createClass({
  getInitialState: function() {
    return {
      input: 'chirag',
    }
  },
  handleChange: function(event) {
    this.setState({input: event.nativeEvent.text});
  },
  handleFocus: function(change) {
    ToolTipMenu.show(React.findNodeHandle(this.refs.input), ['x', 'z']);
  },
  render: function() {
    return (
      <View style={styles.container}>
        <View style={styles.textinputContainer}>
          <ToolTipText
            suppressHighlighting={true}
            onChange={this.handleChange}
            onPress={this.handleFocus}
            ref={'input'}
            style={styles.textinput}
          >{this.state.input}</ToolTipText>
        </View>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  textinputContainer: {
    marginTop: 20,
    justifyContent: 'center',
    alignItems: 'center',
  },
  textinput: {
    width: 60,
    marginVertical: 2,
    marginHorizontal: 2,
    borderWidth: 1 / PixelRatio.get(),
    borderRadius: 5,
    borderColor: '#c7c7cc',
    padding: 2,
    fontSize: 14,
    backgroundColor: 'white',
  },
});

AppRegistry.registerComponent('tooltip', () => tooltip);

Here is how it looks:

Demo gif