instea / react-native-color-picker

Color picker component for IOS/Android
Apache License 2.0
272 stars 67 forks source link

Can't install properly #36

Closed nachiket-asbuilt closed 3 years ago

nachiket-asbuilt commented 3 years ago

I tried to install using following command but while installing getting error and can not use the color picker. command:- "npm i react-native-color-picker" I'm using expo. ![Uploading Screenshot 2020-08-24 at 9.51.26 PM.png…] Screenshot 2020-08-24 at 9 52 46 PM

dmko1610 commented 3 years ago

@nachiket-asbuilt, make sure that you have typescript pkg installed. If not, just complete npm i typescript -g or yarn global add typescript

sodik82 commented 3 years ago

sorry, for incovenience. In between, try to install version 0.5 instead.

npm i react-native-color-picker@0.5
sodik82 commented 3 years ago

@nachiket-asbuilt - can you try to install latest version again?

nachiket-asbuilt commented 3 years ago

@sodik82 it installed now but i can only see slider no circle or triangle colour picker.

nachiket-asbuilt commented 3 years ago

@nachiket-asbuilt, make sure that you have typescript pkg installed. If not, just complete npm i typescript -g or yarn global add typescript

@dmko1610 i tried it but got same error.

sodik82 commented 3 years ago

I have tried our example app with latest expo and both android phone and ios simulator and it worked fine.

do you have enough space for color picker - i.e. used eg. flex:1 or set enought height for your picker component?

nachiket-asbuilt commented 3 years ago

Thanks. It installed now but i am unable to change height or any style of the picker. Sorry but i'm new to react native. Can you please share your code snippet? My code: const Home = (props) => { return ( <ColorPicker onColorSelected={(color) => alert(Color selected: ${color})} style={{ flex: 1, height: 500 }} /> ); }; and following is the output. WhatsApp Image 2020-08-26 at 07 33 55

sodik82 commented 3 years ago

well, it looks almost correct :) there is something with width - you can try to set it explicitly. but usually the better way (than explicitly setting width/height) is to use flexbox https://reactnative.dev/docs/flexbox

color picker uses all the space the user/programmer will provide to it. so you just need to properly layout your components.