embiem / react-canvas-draw

React Component for drawing in canvas
https://embiem.github.io/react-canvas-draw/
MIT License
892 stars 315 forks source link

Invariant Violation: View config getter callback for component `canvas` must be a function (received `undefined`). Make sure to start component names with a capital letter. #135

Open Moodax opened 2 years ago

Moodax commented 2 years ago

When trying to run CanvasDraw on Android, I get this error from the title. Everything is fine when using web browser, but for some reason it doesn't work on Android. This is the code I'm using:

import React from 'react';
import { Dimensions,StyleSheet, View } from 'react-native';
import CanvasDraw from "react-canvas-draw";

  function Library({ navigation }) {
  return (
    <View style={styles.container}>
    <View style={{ backgroundColor: "blue", flex: 0.2}} >
    </View>
    <View style={{ backgroundColor: "red", flex: 0.8,maxHeight:"100%",maxWidth:"100%" }}  >
    <CanvasDraw style={{ position:'relative',height:'100%',width:'100%' }}
    canvasHeight={Dimensions.get('window').height}
     canvasWidth={Dimensions.get('window').width}
     brushColor='black'
      hideGrid
     />
     </View>
     </View>
  )

  }
  export default Library;

  const styles = StyleSheet.create({
    container: {
      backgroundColor: '#fff',
      width:'100%',
      flexDirection:"row",
      height:'100%',
      maxHeight:'100%',
      maxWidth:'100%'
    },
  });