Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react native speedometer is not working -- Help me to get value of speedometer from another screen #82

Open
Gauri1804 opened this issue Jun 20, 2023 · 0 comments

Comments

@Gauri1804
Copy link

Gauri1804 commented Jun 20, 2023

App.js

here i pass data everything fine over here
onPress={() => { setbmi("BMI = " + chnages(weigh, weightUnit, heigh, heightUnit)); navigation.navigate('Calculate',{ bmi:bmi }) }}

Calculate.js

`import { StyleSheet, Text, View} from 'react-native'
import React from 'react'
import RNSpeedometer from 'react-native-speedometer'


const Calculate = ({route, navigation}) => {
  const { bmi } = route.params;
alert(bmi)
  const [ bmiValue, setBmiValue ] = React.useState();
  React.useEffect((bmi)=>{
setBmiValue(bmi)
  },[])
  return (
<View> `

### //Here i got the value

  <Text style={{justifyContent:'center',alignItems:'center',color:'#000'}}>Bmi Is {JSON.stringify(bmi)}</Text>

but i did not get value on speedometer

  <RNSpeedometer value={bmi} size={200} 
  minValue = {0}
  maxValue = {50}
  allowedDecimals = {10}
  labels={
    [
      {
        name: 'You are Underweight',
        labelColor : 'pink',
        activeBarColor : 'red'
      },
      {
        name: 'You are Healthy',
        labelColor : 'green',
        activeBarColor : 'red'
      },
      {
        name: 'You are Overweight',
        labelColor : 'orange',
        activeBarColor : 'red'
      },
      {
        name: 'You are Obese',
        labelColor : 'red',
        activeBarColor : 'red'
      },
      {
        name: 'You are Severe Obese',
        labelColor : 'red',
        activeBarColor : 'red'
      }
    ]
  }
  />
</View>

)
}

export default Calculate

const styles = StyleSheet.create({})`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant