(react-native-svg)onPress properly working on Expo (android) , in cli Unexpected behavior , even in clean project also with same code #1743
Labels
Close when stale
This issue is going to be closed when there is no activity for a while
Missing repro
This issue need minimum repro scenario
### i am making wheel of emotions :
issue: its perfectly working as per expected , but in cli project its not working
what i did for expo project
https://www.tutorialspoint.com/react_native/react_native_environment_setup.htm
in this project i used react-native-svg , here is package.json
{
"name": "emotionswheel",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "expo start --dev-client",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "~44.0.2",
"expo-splash-screen": "~0.14.1",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-svg": "^12.3.0",
"react-native-web": "0.17.1"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
here every thing is working fine
///////////////////////////////////////////////////////////////////////////////////////////////
i created another project by following this link
here is my package.json
{
"name": "firstapp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "17.0.2",
"react-native": "0.68.0",
"react-native-svg": "^12.3.0",
},
"devDependencies": {
"@babel/core": "7.17.9",
"@babel/runtime": "7.17.9",
"@react-native-community/eslint-config": "2.0.0",
"babel-jest": "26.6.3",
"eslint": "7.32.0",
"jest": "26.6.3",
"metro-react-native-babel-preset": "0.67.0",
"react-test-renderer": "17.0.2"
},
"jest": {
"preset": "react-native"
}
}
////////////////////////////////////////////////////////////////////
i am getting output as per expected , each emotion is clickable , touches are properly working in Expo not in Cli
before click
///////////////////////////////////////////////////////////////////////
after clicked any perticuler emotion it is like this,
///////////////////////////////////
here is my source code that wheel of emotions
import React, { Component } from 'react';
import { StyleSheet, Dimensions, Text, View, ScrollView, ViewPropTypes, Pressable } from 'react-native';
import Svg, { G, Circle, Defs, ClipPath, Path, Rect, Line } from "react-native-svg";
const maxPercentage = 100;
const generateCoordinates = percent => {
const a = (percent * 2 * Math.PI) / maxPercentage;
const x = Math.cos(a);
const y = Math.sin(a);
return [x, y];
};
function degreeToRadian(degree) {
return degree * (Math.PI / 180);
}
const pie = (radius, value) => {
const x = radius - Math.cos((2 * Math.PI) / (100 / value)) * radius
const y = radius + Math.sin((2 * Math.PI) / (100 / value)) * radius
const long = (value <= 50) ? 0 : 1
const d =
M${radius},${radius} L${radius},${0}, A${radius},${radius} 0 ${long},1 ${y},${x} Z
}
const label1 = ['Trust', 'Joy', 'Disgust', 'Sadness', 'Fear', 'Anger', 'Surprise', 'Anticipation'].reverse();
const label2 = ['Remorse', 'Disapproval', 'Awe', 'Anxiety', 'Submission', 'Love', 'Optimism', 'Aggression', 'Contempt',];
const colorcodesinner = ['#B8DD67', '#5DC27E', '#49CBEE', '#4999E9', '#8F71CD', '#E8706E', '#FD9E59', '#FFE948'];
const restColor = "#F1F1F1";
const windowWidth = Math.min(Dimensions.get('window').width, Dimensions.get('window').height);
var size = windowWidth * 0.5;
const radius = size / 2;
const viewBox =
-${radius} -${radius} ${size} ${size}
;let cumulativePercent = 0;
const initialArr = [];
let transparent = "#00000000"
for (var i = 0; i < 9; i++) {
initialArr.push(i);
}
const label2Pie = ['Anxiety', 'Submission', 'Love', 'Optimism', 'Aggression', 'Contempt', 'Remorse', 'Disapproval', 'Awe',];
const colorcodes = ['#B8DD67', '#D0E89A', '#FFF085', '#FEBF91', '#F0A09E', '#B4A1DE', '#86BBF1', '#86DDF3', '#93D6A9',];
var width = windowWidth * 0.5;
var height = width / 2;
var center = height / 2;
var xPoint = center + Math.cos(degreeToRadian(40.0 * initialArr.length)) * center;
var yPoint = center + Math.sin(degreeToRadian(40.0 * initialArr.length)) * center;
var borderWidth = 1.5;
var data = [
{
id: 1,
percent: 12.5,
percentScale: 96,
color: 'red',
},
{
id: 2,
percent: 12.5,
percentScale: 96,
color: 'green',
},
{
id: 3,
percent: 12.5,
percentScale: 96,
color: 'blue',
},
{
id: 4,
percent: 12.5,
percentScale: 96,
color: 'pink',
},
{
id: 5,
percent: 12.5,
percentScale: 96,
color: 'pink',
},
{
id: 6,
percent: 12.5,
percentScale: 96,
color: 'pink',
},
{
id: 7,
percent: 12.5,
percentScale: 96,
color: 'pink',
},
{
id: 8,
percent: 12.5,
percentScale: 96,
color: 'pink',
},
];
export default class CreateStoryItem extends Component {
state = {
{/* Outer Text Start */}
}
const styles = StyleSheet.create({
});
please help me in this. thanks
The text was updated successfully, but these errors were encountered: