AndreiCalazans / rn-tooltip

A <Tooltip /> component for React Native
MIT License
323 stars 75 forks source link

React Native Web support? #58

Closed jameschetwood closed 2 years ago

jameschetwood commented 3 years ago

Does this library work with React Native Web? It doesn't work with this simple Expo Snack: https://snack.expo.io/@jamesweblondon/intelligent-yogurt

import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
import Tooltip from 'rn-tooltip';

export default function App() {
  return (
    <View style={styles.container}> 
      <Tooltip 
        width={200}
        containerStyle={{width: 200, height: 100, backgroundColor: 'gold'}}
        popover={<Text>Info here</Text>}>
        <Text>Press me</Text>
      </Tooltip>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
});

Screenshot 2020-09-24 at 10 12 58

AndreiCalazans commented 3 years ago

No work was put into supporting Web. I'm been a bit busy lately. You are welcome to make PR for web support.

nandorojo commented 3 years ago

@jameschetwood did you end up finding a solution for web? CC https://github.com/SteffeyDev/react-native-popover-view/issues/82

neerajkh96 commented 3 years ago

Added PR https://github.com/AndreiCalazans/rn-tooltip/pull/65 to support hover events for tooltip in react-native-web.

BossBele commented 2 years ago
- Expo using babel `babel.config.js`:

module.exports = function (api) { api.cache(true); return { presets: ['babel-preset-expo'], plugins: [['@babel/plugin-proposal-decorators', {legacy: true}]], }; };


- Expo web using webpack `webpack.config.js`:

const createExpoWebpackConfigAsync = require('@expo/webpack-config');

module.exports = async function (env, argv) { const config = await createExpoWebpackConfigAsync( { ...env, babel: { dangerouslyAddModulePathsToTranspile: [ // Ensure that all packages here are transpiled. 'rn-tooltip', ], }, }, argv, ); config.resolve.symlinks = true; // Customize the config before returning it. return config; };

AndreiCalazans commented 2 years ago

It's not in my intention to extend this library to support web. Feel free to fork it and use your own version. Thank you for understanding.