Skip to content

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

@Gauri1804

Description

@Gauri1804

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({})`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions