poolkhord / react-native-web-svg-charts

3 stars 1 forks source link

Cannot render simple pie chart #2

Open davidbutz opened 4 years ago

davidbutz commented 4 years ago

Webpack config snippet:

{ use: {
loader: "babel-loader", options: { presets: [ "@babel/preset-env", "@babel/preset-react", "@babel/preset-flow" ], plugins: [ '@babel/plugin-proposal-class-properties', "@babel/plugin-transform-runtime" ] }, },

            test: /\.(js|jsx)$/,
            include: [
                path.resolve(__dirname,'./ClientApp/src'),
                path.resolve(path.resolve(__dirname, './node_modules'), "native-base-shoutem-theme"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-navigation"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-easy-grid"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-drawer"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-safe-area-view"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-vector-icons"),
                path.resolve(
                    path.resolve(__dirname, './node_modules'),
                    "react-native-keyboard-aware-scroll-view"
                ),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-web"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-tab-view"),
                path.resolve(path.resolve(__dirname, './node_modules'), "react-native-web-svg-charts"),
                path.resolve(path.resolve(__dirname, './node_modules'), "static-container")
            ],
            exclude: /node_modules[/\\](?!react-native-easy-grid|react-native-keyboard-aware-scroll-view|react-native-drawer|react-native-web-svg-charts|react-native-vector-icons|react-native-safe-area-view|react-native-gesture-handler|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?\/.*|react-navigation|@react-navigation\/.*|@unimodules\/.*|unimodules-*|sentry-expo|native-base)/,
        },

Simply no render: no svg tag in web. I am using react-native-web... Any clues would help.

davidbutz commented 4 years ago

Update: If i change screen size, I can see the rendering, but not until I actually resize the browser window.

davidbutz commented 4 years ago

class PieChart extends PureComponent { constructor(...args) { super(...args);

_defineProperty(this, "state", {
  height: (this.props.height !== "") ? parseInt(this.props.height ): 0,
  width: (this.props.width !== "") ? parseInt(this.props.width ) : 0
});

}

I added in the height and width- which were 0 before. Am i doing something wrong ? This works, but the other never renders. No "Event" to reset the height and width.